function [I,Ib] = set_multi_currents(protocol,elec,vtx,gnd_ind,no_pl); This functions applies opposite or adjacent current patterns to each of the planes of the system simultaneously. protocol= The selected protocol '{op}' or '{ad}' elec = The electrodes 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 for the forward calculations
0001 function [I,Ib] = set_multi_currents(protocol,elec,vtx,gnd_ind,no_pl); 0002 %function [I,Ib] = set_multi_currents(protocol,elec,vtx,gnd_ind,no_pl); 0003 % 0004 %This functions applies opposite or adjacent current patterns to each of 0005 %the planes of the system simultaneously. 0006 % 0007 % 0008 % 0009 %protocol= The selected protocol '{op}' or '{ad}' 0010 %elec = The electrodes 0011 %vtx = The vertices 0012 %gnd_ind = the index of the ground node 0013 %no_pl = The number of planes 0014 %Ib = The current patterns 0015 %I = The RHS vectors, i.e., the current patterns padded with zeroes 0016 % for the forward calculations 0017 0018 warning('EIDORS:deprecated','SET_MULTI_CURRENTS is deprecated as of 07-Jun-2012. '); 0019 0020 no_el = size(elec,1); 0021 0022 elpp = no_el/no_pl; 0023 eld2 = elpp/2; 0024 0025 0026 if protocol == '{op}' 0027 0028 d=eld2; 0029 II = []; 0030 0031 for j=1:no_pl 0032 Ib = []; 0033 0034 for i=1:d 0035 Ip = zeros(elpp,1); 0036 Ip(i)= 1; 0037 Ip(i+eld2)= -1; 0038 Ib = [Ib,Ip]; 0039 end 0040 0041 II = [II;Ib]; 0042 end 0043 0044 I = zeros(size(vtx,1),size(Ib,2)); 0045 I = [I;II]; 0046 0047 elseif protocol == '{ad}' 0048 0049 d = elpp; 0050 0051 II = []; 0052 0053 for j=1:no_pl 0054 Ib = []; 0055 0056 for i=1:d-1 0057 Ip = zeros(elpp,1); 0058 Ip(i)=1; 0059 Ip(i+1)=-1; 0060 Ib = [Ib,Ip]; 0061 end 0062 0063 lx = zeros(elpp,1); 0064 lx(end) = 1; 0065 lx(1) = -1; 0066 Ib = [Ib,lx]; 0067 0068 II = [II;Ib]; 0069 else 0070 error('protocol must be {ad} or {op}'); 0071 end 0072 0073 I = zeros(size(vtx,1),size(Ib,2)); 0074 I = [I;II]; 0075 0076 end %protocol 0077 0078 0079 Ib = I(size(vtx,1)+1:end,:); 0080 0081 0082 0083 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0084 % This is part of the EIDORS suite. 0085 % Copyright (c) N. Polydorides 2003 0086 % Copying permitted under terms of GNU GPL 0087 % See enclosed file gpl.html for details. 0088 % EIDORS 3D version 2.0 0089 % MATLAB version 5.3 R11 0090 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%