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
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 warning('EIDORS:deprecated','INVERSE_SOLVER is deprecated as of 06-Jun-2012. ');
0024
0025 tol = 1e-4;
0026
0027 sol_upd = mat_ref;
0028
0029 solp = zeros(size(simp,1),1);
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
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
0051 [v_f] = m_3d_fields(vtx,el_no,indH,E,tol,gnd_ind);
0052 else
0053
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
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
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
0084
0085 solf = sol_upd;
0086
0087
0088
0089
0090
0091
0092
0093
0094