jacobian_3d_fields

PURPOSE ^

[J] = jacobian_3d_fields(V,Ela,D,elec,vtx,simp,mat_ref,v_f,df, c2f);

SYNOPSIS ^

function [J] = jacobian_3d_fields(V,Ela,D,elec,vtx,simp,mat_ref,v_f,df, c2f);

DESCRIPTION ^

 [J] = jacobian_3d_fields(V,Ela,D,elec,vtx,simp,mat_ref,v_f,df, c2f);

calculates the Jacobian (sensitivity) matrix from V fwd

J        = The Jacobian (sensitivity) matrix with respect to conductivity

V        = forward solver voltage
D,Ela    = parameters from the fem_master_full
elec     = the electrodes matrix
vtx      = The vertices matrix
simp     = The simplices matrix
mat_ref  = The reference conductivity vector
v_f      = The measurement fields
df       = Measurements per current pattern as used in v_f 
c2f      = Coarse to fine map between fine and coarse model (optional)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [J] = jacobian_3d_fields(V,Ela,D,elec,vtx,simp,mat_ref,v_f,df, c2f);
0002 % [J] = jacobian_3d_fields(V,Ela,D,elec,vtx,simp,mat_ref,v_f,df, c2f);
0003 %
0004 %calculates the Jacobian (sensitivity) matrix from V fwd
0005 %
0006 %J        = The Jacobian (sensitivity) matrix with respect to conductivity
0007 %
0008 %V        = forward solver voltage
0009 %D,Ela    = parameters from the fem_master_full
0010 %elec     = the electrodes matrix
0011 %vtx      = The vertices matrix
0012 %simp     = The simplices matrix
0013 %mat_ref  = The reference conductivity vector
0014 %v_f      = The measurement fields
0015 %df       = Measurements per current pattern as used in v_f
0016 %c2f      = Coarse to fine map between fine and coarse model (optional)
0017 
0018 % $Id: jacobian_3d_fields.m 3089 2012-06-07 18:18:58Z aadler $
0019 
0020 warning('EIDORS:deprecated','JACOBIAN_3D_FIELDS is deprecated as of 07-Jun-2012. ');
0021 
0022 [vr,dim] = size(vtx);
0023 
0024 if sum(df)~= size(v_f,2);
0025    error('Mismatched data input');
0026 end
0027 
0028 %Select the part referring to the interior nodes
0029 V = V(1:vr,:);
0030 v_f = v_f(1:vr,:);
0031 
0032 n_elem= size(simp,1);
0033 %diag_Ela = diag(Ela(1:dim:size(Ela,1),1:dim:size(Ela,2)));
0034 diag_Ela = diag(Ela(1:dim:size(Ela,1),1:dim:size(Ela,2)));
0035 diag_Ela = spdiags(diag_Ela, 0, n_elem, n_elem);
0036 
0037 if nargin>=10 % coarse2fine provided
0038    J = zeros(sum(df), size(c2f,2) );
0039    diag_Ela = diag_Ela*c2f;
0040 else
0041    J = zeros(sum(df),n_elem );
0042 end
0043 cnt = 0;
0044 
0045 for p=1:size(V,2)  % for each stimulation pattern
0046 
0047    DV =  D*V(:,p); %Gradient of the current fields
0048    df_idx= sum(df(1:p-1));
0049 
0050    for m=1:df(p)   % for each measurement in this stim
0051 
0052      Dvf = D*v_f(:,df_idx + m); %Gradient of the measurement fields
0053 
0054      Jrow_x3 = Dvf .* DV ;  
0055      Jrow_u = sum(reshape(Jrow_x3,dim,[]),1); % Works for 2D and 3D now
0056      
0057 %    Jrow = Jrow_u .* diag_Ela.';
0058      Jrow = Jrow_u * diag_Ela;
0059      
0060      cnt = cnt+1;
0061      J(cnt,:) = -Jrow;
0062      
0063   end %m
0064 end %p
0065   
0066 
0067 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0068 % This is part of the EIDORS suite.
0069 % Copyright (c) N. Polydorides and W.R.B. Lionheart 2003
0070 % Copying permitted under terms of GNU GPL
0071 % See enclosed file gpl.html for details.
0072 % EIDORS 3D version 2.0
0073 % MATLAB version 5.3 R11
0074 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0075

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