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 no_el = size(elec,1); 0019 0020 elpp = no_el/no_pl; 0021 eld2 = elpp/2; 0022 0023 0024 if protocol == '{op}' 0025 0026 d=eld2; 0027 II = []; 0028 0029 for j=1:no_pl 0030 Ib = []; 0031 0032 for i=1:d 0033 Ip = zeros(elpp,1); 0034 Ip(i)= 1; 0035 Ip(i+eld2)= -1; 0036 Ib = [Ib,Ip]; 0037 end 0038 0039 II = [II;Ib]; 0040 end 0041 0042 I = zeros(size(vtx,1),size(Ib,2)); 0043 I = [I;II]; 0044 0045 elseif protocol == '{ad}' 0046 0047 d = elpp; 0048 0049 II = []; 0050 0051 for j=1:no_pl 0052 Ib = []; 0053 0054 for i=1:d-1 0055 Ip = zeros(elpp,1); 0056 Ip(i)=1; 0057 Ip(i+1)=-1; 0058 Ib = [Ib,Ip]; 0059 end 0060 0061 lx = zeros(elpp,1); 0062 lx(end) = 1; 0063 lx(1) = -1; 0064 Ib = [Ib,lx]; 0065 0066 II = [II;Ib]; 0067 else 0068 error('protocol must be {ad} or {op}'); 0069 end 0070 0071 I = zeros(size(vtx,1),size(Ib,2)); 0072 I = [I;II]; 0073 0074 end %protocol 0075 0076 0077 Ib = I(size(vtx,1)+1:end,:); 0078 0079 0080 0081 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0082 % This is part of the EIDORS suite. 0083 % Copyright (c) N. Polydorides 2003 0084 % Copying permitted under terms of GNU GPL 0085 % See enclosed file gpl.html for details. 0086 % EIDORS 3D version 2.0 0087 % MATLAB version 5.3 R11 0088 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%