inverse_solver

PURPOSE ^

function [solf,solp] = inverse_solver(I,voltage,tol,mat_ref,vtx,simp,elec,no_pl,zc,perm_sym,gnd_ind,tfac,Reg,it);

SYNOPSIS ^

function [solf,solp] = inverse_solver(I,voltage,tol,mat_ref,vtx,simp,elec,no_pl,zc,perm_sym,gnd_ind,tfac,Reg,it);

DESCRIPTION ^

function [solf,solp] = inverse_solver(I,voltage,tol,mat_ref,vtx,simp,elec,no_pl,zc,perm_sym,gnd_ind,tfac,Reg,it);

Calculates a Newton non-linear inverse solution by iteration.



solf    = The non-linear inverse solution
mat_ref = Initial guess on the solution
I       = The current patterns
elec    = The electrode faces
zc      = The contact impedance vector
voltage = The measurements
tfac    = The regularisation parameter
Reg     = The regularisation matrix
it      = Number of iterations
vtx     = The vertices matrix
simp    = The simplices matrix
gnd_ind = The ground index (node/electrode)
no_pl   = The number of planes

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [solf,solp] = inverse_solver(I,voltage,tol,mat_ref,vtx,simp,elec,no_pl,zc,perm_sym,gnd_ind,tfac,Reg,it);
0002 %function [solf,solp] = inverse_solver(I,voltage,tol,mat_ref,vtx,simp,elec,no_pl,zc,perm_sym,gnd_ind,tfac,Reg,it);
0003 %
0004 %Calculates a Newton non-linear inverse solution by iteration.
0005 %
0006 %
0007 %
0008 %solf    = The non-linear inverse solution
0009 %mat_ref = Initial guess on the solution
0010 %I       = The current patterns
0011 %elec    = The electrode faces
0012 %zc      = The contact impedance vector
0013 %voltage = The measurements
0014 %tfac    = The regularisation parameter
0015 %Reg     = The regularisation matrix
0016 %it      = Number of iterations
0017 %vtx     = The vertices matrix
0018 %simp    = The simplices matrix
0019 %gnd_ind = The ground index (node/electrode)
0020 %no_pl   = The number of planes
0021 
0022 
0023 warning('EIDORS:deprecated','INVERSE_SOLVER is deprecated as of 06-Jun-2012. ');
0024 
0025 tol = 1e-4; %Inverse calculations error tolerance. Change accodringly
0026 
0027 sol_upd = mat_ref; %Initial estimate - homogeneous background
0028 
0029 solp = zeros(size(simp,1),1); %Total change (plotting purposes)
0030 
0031 Ib = I(size(vtx,1)+1:end,:);
0032 
0033 el_no = size(elec,1);
0034 
0035 if it==1
0036    disp('A linear solution will be calculated')
0037 end
0038 
0039 
0040 for i=1:it
0041 
0042    [E,D,Ela,pp] = fem_master_full(vtx,simp,sol_upd,gnd_ind,elec,zc,perm_sym);
0043 
0044    if i==1
0045       %sprintf('Current fields for iteration %d',i)
0046       [V] = forward_solver(E,I,tol,pp);
0047       [viH,viV,indH,indV,df] = get_3d_meas(elec,vtx,V,Ib,no_pl);
0048       dfv = df(1:2:end);
0049       vi = viH;
0050       %sprintf('Measurement fields for iteration %d',i)
0051       [v_f] = m_3d_fields(vtx,el_no,indH,E,tol,gnd_ind);
0052    else
0053       %sprintf('Current fields for iteration %d',i)
0054       [V] = forward_solver(E,I,tol,pp,V);
0055       [viH,viV,indH,indV,df] = get_3d_meas(elec,vtx,V,Ib,no_pl);
0056       dfv = df(1:2:end);
0057       vi = viH;
0058       %sprintf('Measurement fields for iteration %d',i)
0059       [v_f] = m_3d_fields(vtx,el_no,indH,E,tol,gnd_ind,v_f);
0060    end
0061 
0062    [J] = jacobian_3d(I,elec,vtx,simp,gnd_ind,sol_upd,zc,v_f,dfv,tol,perm_sym);
0063 
0064    sol = (J.'*J + tfac*Reg.'*Reg)\ (J.' * (voltage - vi));
0065    %sol = pinv([J;sgrt(tfac)*Reg],tol) * [sqrt(tfac)*Reg*sol_upd; (voltage - vi)];
0066    sol_upd = sol_upd + sol;
0067    solp = solp + sol;
0068 
0069    h1 = figure;
0070    set(h1,'NumberTitle','off');
0071    set(h1,'Name','Reconstructed conductivity distribution');
0072    subplot(2,3,1); [fc] = slicer_plot_n(2.63,sol_upd,vtx,simp); view(2); grid; colorbar; axis off; title('z=2.63');
0073    subplot(2,3,2); [fc] = slicer_plot_n(2.10,sol_upd,vtx,simp,fc); view(2); grid; colorbar; axis off; title('z=2.10');
0074    subplot(2,3,3); [fc] = slicer_plot_n(1.72,sol_upd,vtx,simp,fc); view(2); grid; colorbar; axis off; title('z=1.72');
0075    subplot(2,3,4); [fc] = slicer_plot_n(1.10,sol_upd,vtx,simp,fc); view(2); grid; colorbar; axis off; title('z=1.10');
0076    subplot(2,3,5); [fc] = slicer_plot_n(0.83,sol_upd,vtx,simp,fc); view(2); grid; colorbar; axis off; title('z=0.83');
0077    subplot(2,3,6); [fc] = slicer_plot_n(0.10,sol_upd,vtx,simp,fc); view(2); grid; colorbar; axis off; title('z=0.10');
0078    drawnow;
0079 
0080 
0081    sprintf('Error norm at iteration %d is %f',i,norm(voltage - vi))
0082 
0083 end %for it
0084 
0085 solf = sol_upd;
0086 
0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0088 % This is part of the EIDORS suite.
0089 % Copyright (c) N. Polydorides 2003
0090 % Copying permitted under terms of GNU GPL
0091 % See enclosed file gpl.html for details.
0092 % EIDORS 3D version 2.0
0093 % MATLAB version 6.1 R12
0094 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Generated on Fri 30-Dec-2022 19:44:54 by m2html © 2005