set_3d_currents

PURPOSE ^

function [I,Ib]=set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);

SYNOPSIS ^

function [I,Ib] = set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);

DESCRIPTION ^

function [I,Ib]=set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);

This function sets current patterns in a system with (no_pl) planes of 
equal number of electrodes according to "opposite" or "adjacent" protocols, 
or their 3D similar.



protocol= The selected protocol '{op}' or '{ad}'
elec    = The electrodes (only the number of electrodes is used)
vtx     = The vertices
gnd_ind = the index of the ground node
no_pl   = The number of planes
Ib      = The current patterns
I       = The RHS vectors, i.e., the current patterns padded with zeroes

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [I,Ib] = set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);
0002 %function [I,Ib]=set_3d_currents(protocol,elec,vtx,gnd_ind,no_pl);
0003 %
0004 %This function sets current patterns in a system with (no_pl) planes of
0005 %equal number of electrodes according to "opposite" or "adjacent" protocols,
0006 %or their 3D similar.
0007 %
0008 %
0009 %
0010 %protocol= The selected protocol '{op}' or '{ad}'
0011 %elec    = The electrodes (only the number of electrodes is used)
0012 %vtx     = The vertices
0013 %gnd_ind = the index of the ground node
0014 %no_pl   = The number of planes
0015 %Ib      = The current patterns
0016 %I       = The RHS vectors, i.e., the current patterns padded with zeroes
0017 
0018 
0019 warning('EIDORS:deprecated','SET_3D_CURRENTS is deprecated as of 07-Jun-2012. ');
0020 
0021 [vr,vc] = size(vtx);
0022    
0023 [el_no,q] = size(elec); 
0024 
0025 el_pp = el_no/no_pl;
0026 
0027 a=1:el_no;
0028 
0029 X = reshape(a,el_pp,no_pl)';
0030 
0031 if protocol == '{op}'
0032    
0033    Ib = [];
0034    
0035     for i=1:no_pl
0036    
0037        this_plane = X(i,:);
0038       
0039       for j=this_plane(1):this_plane(8)
0040          
0041          Ip = zeros(el_no,1);
0042          Ip(j) = 1;
0043          Ip(j+ el_pp/2) = -1;
0044          Ib = [Ib,Ip];
0045       end
0046    
0047    end 
0048    
0049     
0050    Is_supl = zeros(vr,size(Ib,2));
0051 
0052    I = [Is_supl;Ib];
0053 
0054    I(gnd_ind,:) = 0;
0055 
0056 elseif protocol == '{ad}'
0057    
0058    Ib = [];
0059    
0060    for i=1:no_pl
0061    
0062      this_plane = X(i,:); 
0063    
0064         for j=this_plane(1):this_plane(el_pp-1)
0065            
0066            Ip = zeros(el_no,1);
0067            Ip(j) = 1;
0068            Ip(j+1) = -1;
0069            Ib =[Ib,Ip];
0070            
0071            if j==this_plane(el_pp-1) %the ring pattern
0072               
0073               Ip = zeros(el_no,1);
0074               
0075               Ip(j+1) = 1;
0076               Ip(this_plane(1)) = -1;
0077               Ib = [Ib,Ip];
0078            end
0079            
0080            
0081         end
0082         
0083      end
0084      
0085     Is_supl = zeros(vr,size(Ib,2));
0086 
0087     I = [Is_supl;Ib];
0088 
0089     I(gnd_ind,:) = 0;
0090 
0091 else
0092    error(['protocol ',protocol,' is not recognized']);
0093 end %protocol
0094          
0095 
0096 
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 % This is part of the EIDORS suite.
0099 % Copyright (c) N. Polydorides 2003
0100 % Copying permitted under terms of GNU GPL
0101 % See enclosed file gpl.html for details.
0102 % EIDORS 3D version 2.0
0103 % MATLAB version 5.3 R11
0104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Generated on Wed 21-Jun-2017 09:29:07 by m2html © 2005