0001 function J= np_calc_jacobian( fwd_model, img)
0002
0003
0004
0005
0006
0007
0008
0009
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;
0018
0019
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
0034 if p.normalize
0035 data= fwd_solve( img );
0036 J= J ./ (data.meas(:)*ones(1,nparam));
0037 end
0038