JACOBIAN_3D_WITH_FIELDS: calculate jacobian_3d, but accept V fields as parameters. Differs from jacobian_3d in that V is not calculated inside. I = The currents used elec = the electrodes matrix vtx = The vertices matrix simp = The simplices matrix gnd_ind = The ground index (node) mat_ref = The reference conductivity vector zc = The electrode contact impedance vector IntGrad = The integrals of the gradients v_f = The measurement fields df = Measurements per current pattern as used in v_f tol = Tolerance J = The Jacobian (sensitivity) matrix with respect to conductivity (C) 2003-2005 Nick Polydorides and David Stephenson. Licensed under GPL $Id: jacobian_3d_with_fields.html 2819 2011-09-07 16:43:11Z aadler $
0001 function [J] = jacobian_3d_with_fields(V,Ela,D,I,elec,vtx,simp,gnd_ind,mat_ref,zc,v_f,df,tol,sym); 0002 % JACOBIAN_3D_WITH_FIELDS: calculate jacobian_3d, but accept V fields as 0003 % parameters. Differs from jacobian_3d in that V is not calculated inside. 0004 % 0005 %I = The currents used 0006 %elec = the electrodes matrix 0007 %vtx = The vertices matrix 0008 %simp = The simplices matrix 0009 %gnd_ind = The ground index (node) 0010 %mat_ref = The reference conductivity vector 0011 %zc = The electrode contact impedance vector 0012 %IntGrad = The integrals of the gradients 0013 %v_f = The measurement fields 0014 %df = Measurements per current pattern as used in v_f 0015 %tol = Tolerance 0016 %J = The Jacobian (sensitivity) matrix with respect to conductivity 0017 % 0018 % (C) 2003-2005 Nick Polydorides and David Stephenson. Licensed under GPL 0019 % $Id: jacobian_3d_with_fields.html 2819 2011-09-07 16:43:11Z aadler $ 0020 0021 [vr,vc] = size(vtx); 0022 [sr,sc] = size(simp); 0023 0024 el_no = size(elec,1); 0025 0026 if sum(df)~= size(v_f,2); 0027 error('Mismatched data input'); 0028 end 0029 0030 %Select the part referring to the interior nodes 0031 V = V(1:vr,:); 0032 v_f = v_f(1:vr,:); 0033 0034 J = zeros(sum(df),size(simp,1)); 0035 Jrow = zeros(1,size(simp,1)); 0036 cnt = 0; 0037 0038 h = waitbar(0,'Calculating Jacobian Matrix'); 0039 0040 for p=1:size(V,2) 0041 0042 waitbar(p/(size(V,2))) 0043 0044 DV = D*V(:,p); %Gradient of the current fields 0045 0046 for m=1:df(p) 0047 0048 0049 Dvf = D*v_f(:,sum(df(1:p-1))+m); %Gradient of the measurement fields 0050 0051 Jrow_x3 = Dvf .* DV ; 0052 Jrow_u = Jrow_x3(1:3:end) + Jrow_x3(2:3:end) + Jrow_x3(3:3:end); 0053 0054 Jrow = Jrow_u .* diag(Ela(1:3:end,1:3:end)); 0055 0056 cnt = cnt+1; 0057 J(cnt,:) = -Jrow.'; 0058 Jrow = zeros(1,size(simp,1)); 0059 0060 end %m 0061 0062 end %p 0063 0064 close(h)