0001 function J= np_calc_jacobian( fwd_model, img)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 warning('EIDORS:deprecated','NP_CALC_JACOBIAN is deprecated as of 07-Jun-2012. Use CALC_JACOBIAN_ADJOINT instead.');
0012
0013 if nargin==1
0014 img = fwd_model;
0015 fwd_model = img.fwd_model;
0016 else
0017 img.fwd_model = fwd_model;
0018 end
0019
0020 p= np_fwd_parameters( fwd_model );
0021
0022 s_mat= calc_system_mat( img );
0023
0024 v_f = np_calc_3d_fields( img );
0025
0026 tol = 1e-5;
0027
0028
0029 Vfwd = forward_solver(s_mat.E, p.I, tol, s_mat.perm);
0030
0031 if isfield(fwd_model,'coarse2fine');
0032 J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0033 p.vtx,p.simp, img.elem_data, v_f, p.df, ...
0034 fwd_model.coarse2fine);
0035 nparam= size(fwd_model.coarse2fine,2);
0036 else
0037 J = jacobian_3d_fields(Vfwd,s_mat.Ela,s_mat.D, p.elec, ...
0038 p.vtx,p.simp, img.elem_data, v_f, p.df);
0039 nparam= p.n_elem;
0040 end
0041
0042
0043 if p.normalize
0044 data= fwd_solve( img );
0045 J= J ./ (data.meas(:)*ones(1,nparam));
0046 end
0047