np_fwd_solve

PURPOSE ^

NP_FWD_SOLVE: data= np_fwd_solve( fwd_model, img)

SYNOPSIS ^

function data= np_fwd_solve( fwd_model, img)

DESCRIPTION ^

 NP_FWD_SOLVE: data= np_fwd_solve( fwd_model, img)
 Fwd solver for Nick Polydorides EIDORS3D code
 Input:
    fwd_model = forward model
    img       = image struct
 Output:
    data = measurements struct
 Options: (to return internal FEM information)
    img.fwd_solve.get_all_meas = 1 (data.volt = all FEM nodes, but not CEM)
    img.fwd_solve.get_all_nodes= 1 (data.volt = all nodes, including CEM)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function data= np_fwd_solve( fwd_model, img)
0002 % NP_FWD_SOLVE: data= np_fwd_solve( fwd_model, img)
0003 % Fwd solver for Nick Polydorides EIDORS3D code
0004 % Input:
0005 %    fwd_model = forward model
0006 %    img       = image struct
0007 % Output:
0008 %    data = measurements struct
0009 % Options: (to return internal FEM information)
0010 %    img.fwd_solve.get_all_meas = 1 (data.volt = all FEM nodes, but not CEM)
0011 %    img.fwd_solve.get_all_nodes= 1 (data.volt = all nodes, including CEM)
0012 
0013 % (C) 2005 Andy Adler. License: GPL version 2 or version 3
0014 % $Id: np_fwd_solve.html 2819 2011-09-07 16:43:11Z aadler $
0015 
0016 p= np_fwd_parameters( fwd_model );
0017 
0018 %Set the tolerance for the forward solver
0019 tol = 1e-5;
0020 
0021 s_mat= calc_system_mat( fwd_model, img );
0022 
0023 Vfwd = forward_solver(s_mat.E, p.I, tol, s_mat.perm);
0024 
0025 Velec=Vfwd( p.n_node+(1:p.n_elec),:);
0026 voltH = zeros( p.n_meas, 1 );
0027 idx=0;
0028 for i=1:p.n_stim
0029    meas_pat= fwd_model.stimulation(i).meas_pattern;
0030    n_meas  = size(meas_pat,1);
0031    voltH( idx+(1:n_meas) ) = meas_pat*Velec(:,i);
0032    idx= idx+ n_meas;
0033 end
0034 
0035 % create a data structure to return
0036 data.meas= voltH;
0037 data.time= -1; % unknown
0038 data.name= 'solved by np_fwd_solve';
0039 try; if img.fwd_solve.get_all_meas == 1
0040    data.volt = Vfwd(1:p.n_node,:); % but not on CEM nodes
0041 end; end
0042 try; if img.fwd_solve.get_all_nodes== 1
0043    data.volt = Vfwd;               % all, including CEM nodes
0044 end; end

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