np_calc_jacobian

PURPOSE ^

NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)

SYNOPSIS ^

function J= np_calc_jacobian( fwd_model, img)

DESCRIPTION ^

 NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)
 Fwd solver for Nick Polydorides EIDORS3D code
 J         = Jacobian matrix
 fwd_model = forward model
 img = image background for jacobian calc

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function J= np_calc_jacobian( fwd_model, img)
0002 % NP_CALC_JACOBIAN: J= np_calc_jacobian( fwd_model, img)
0003 % Fwd solver for Nick Polydorides EIDORS3D code
0004 % J         = Jacobian matrix
0005 % fwd_model = forward model
0006 % img = image background for jacobian calc
0007 
0008 % (C) 2005 Andy Adler. License: GPL version 2 or version 3
0009 % $Id: np_calc_jacobian.html 2819 2011-09-07 16:43:11Z aadler $
0010 
0011 p= np_fwd_parameters( fwd_model );
0012 
0013 s_mat= calc_system_mat( fwd_model, img );
0014 
0015 v_f = np_calc_3d_fields( fwd_model, img );
0016 
0017 tol = 1e-5; %tolerance for the forward solver
0018 
0019 % Calculating the Jacobian
0020 Vfwd = forward_solver(s_mat.E, p.I, tol, s_mat.perm);
0021 
0022 if isfield(fwd_model,'coarse2fine');
0023    J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0024                           p.vtx,p.simp, img.elem_data, v_f, p.df, ...
0025                           fwd_model.coarse2fine);
0026    nparam= size(fwd_model.coarse2fine,2);
0027 else 
0028    J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0029                           p.vtx,p.simp, img.elem_data, v_f, p.df);
0030    nparam= p.n_elem;
0031 end
0032 
0033 % calculate normalized Jacobian if required
0034 if p.normalize
0035    data= fwd_solve( img );
0036    J= J ./ (data.meas(:)*ones(1,nparam));
0037 end
0038

Generated on Tue 09-Aug-2011 11:38:31 by m2html © 2005