calc_all_node_voltages

PURPOSE ^

CALC_ALL_NODE_VOLTAGES - calculate voltage on all nodes

SYNOPSIS ^

function node_v= calc_all_node_voltages( himg );

DESCRIPTION ^

 CALC_ALL_NODE_VOLTAGES - calculate voltage on all nodes
 node_v= calc_all_node_voltages( himg );
 img        => image object

 node_v     = n_nodes x n_stims voltage on each node

 NOTE THIS IS DEPRECATED. The recommended was is to do:
   img.fwd_solve.get_all_meas = 1; vv= fwd_solve(img);
   img will now have a data.volt structure

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function node_v= calc_all_node_voltages( himg );
0002 % CALC_ALL_NODE_VOLTAGES - calculate voltage on all nodes
0003 % node_v= calc_all_node_voltages( himg );
0004 % img        => image object
0005 %
0006 % node_v     = n_nodes x n_stims voltage on each node
0007 %
0008 % NOTE THIS IS DEPRECATED. The recommended was is to do:
0009 %   img.fwd_solve.get_all_meas = 1; vv= fwd_solve(img);
0010 %   img will now have a data.volt structure
0011 
0012 % (C) 2007 Andy Adler. License: GPL version 2 or version 3
0013 % $Id: calc_all_node_voltages.html 2819 2011-09-07 16:43:11Z aadler $
0014 
0015    % create one "measurement electrode" per node and
0016    % meas patterns to match
0017    n_nodes = size(himg.fwd_model.nodes,1);
0018    n_elecs = length(himg.fwd_model.electrode);
0019    ze= zeros(n_elecs,1);
0020    for i= 1:n_nodes
0021       himg.fwd_model.electrode(n_elecs + i).nodes= i;
0022       himg.fwd_model.electrode(n_elecs + i).z_contact= 0.01;
0023    end
0024 
0025    n_stims = length(himg.fwd_model.stimulation);
0026    zn= zeros(n_nodes,1);
0027    zs= zeros(n_stims,1);
0028    meas_pat = spdiags(zn+1, n_elecs, n_nodes, n_nodes+n_stims);
0029    for i= 1:n_stims
0030       himg.fwd_model.stimulation(i).meas_pattern= meas_pat;
0031       himg.fwd_model.stimulation(i).stim_pattern= ...
0032          [himg.fwd_model.stimulation(i).stim_pattern; zn];
0033    end
0034 
0035    node_v= fwd_solve( himg );
0036    node_v= reshape(node_v.meas,n_nodes,n_stims);

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