GET_3D_MEAS: extracts multiplane voltage measurements from a calculated 3D nodal potential distribution V inside a tank with (no_pl) electrode planes. Each plane holds the same number of electrodes. Only the non-current carring electrodes at the time are involved in the measurements. [voltageH,voltageV,indH,indV,df]=get_3d_meas(elec,vtx,V,Ib,no_pl); elec = The electrodes matrix vtx = The vertices V = The calculated forward solution Ib = The current patterns without the zeroes patch no_pl = The number of planes voltage_H = Horrisontal (local plane) measurements indH = The two column matrix indicating the indices of the electrodes involved in voltage_H, e.g. indH = [2 3; 3 4; 4 5;...] implies voltage_H(1) = voltage(2) - volatge(3), etc df = Array indexing the (numbero of) measurements to their corresponding current patterns. voltage_V = Vertical interplanar measurements indV = ...
0001 function [voltageH,voltageV,indH,indV,df] = get_3d_meas(elec,vtx,V,Ib,no_pl); 0002 % GET_3D_MEAS: extracts multiplane voltage measurements from a calculated 0003 % 3D nodal potential distribution V inside a tank with (no_pl) electrode 0004 % planes. Each plane holds the same number of electrodes. Only the 0005 % non-current carring electrodes at the time are involved in the 0006 % measurements. 0007 % 0008 % [voltageH,voltageV,indH,indV,df]=get_3d_meas(elec,vtx,V,Ib,no_pl); 0009 % 0010 %elec = The electrodes matrix 0011 %vtx = The vertices 0012 %V = The calculated forward solution 0013 %Ib = The current patterns without the zeroes patch 0014 %no_pl = The number of planes 0015 % 0016 %voltage_H = Horrisontal (local plane) measurements 0017 %indH = The two column matrix indicating the indices of the electrodes 0018 % involved in voltage_H, e.g. indH = [2 3; 3 4; 4 5;...] implies 0019 % voltage_H(1) = voltage(2) - volatge(3), etc 0020 %df = Array indexing the (numbero of) measurements to their corresponding 0021 % current patterns. 0022 %voltage_V = Vertical interplanar measurements 0023 %indV = ... 0024 0025 0026 if size(V,2)~= size(Ib,2) 0027 error('Unmatched pattens') 0028 end 0029 0030 [el_no,q] = size(elec); 0031 0032 el_pp = el_no/no_pl; 0033 0034 a=1:el_no; 0035 0036 X = reshape(a,el_pp,no_pl)'; 0037 0038 0039 Vm = V(size(vtx,1)+1:size(V,1),:); %Lower chunk of forward solution (complete electrode model) 0040 0041 voltageH = []; 0042 indH = []; 0043 0044 df = []; 0045 0046 for w=1:size(Vm,2) %For each column of Vm 0047 0048 cn = 0; %RESET the count of measurements per injection 0049 0050 this_inj = Vm(:,w); %(no_of_electrodes x 1) vector 0051 0052 for vv = 1:el_pp:el_no %i.e. 1 17 33 49 for 4 planes of 16 electrodes 0053 0054 for t=vv:vv+(el_pp-1)-1 %t=1:15 0055 0056 if Ib(t,w) == 0 && Ib(t+1,w) == 0 %Electrode not in the drive pair 0057 0058 voltageH = [voltageH; (this_inj(t)-this_inj(t+1))]; 0059 indH = [indH;[t , t+1]]; 0060 cn = cn+1; 0061 end 0062 0063 if t == vv+(el_pp-1)-1 && Ib(vv,w) == 0 && Ib(t+1,w) == 0 0064 0065 voltageH = [voltageH; (this_inj(t+1))-this_inj(vv)]; %or is it vv=1; 0066 indH = [indH;[t+1, vv]]; 0067 cn = cn+1; 0068 end 0069 0070 end %for t -Measurements of the one plane 0071 0072 end %for vv -Measurements for all electrode planes 0073 0074 df = [df;cn]; 0075 0076 voltageV = []; 0077 indV = []; 0078 0079 Y = reshape(X,el_no,1); 0080 0081 0082 cn = 0; 0083 wc = w; 0084 0085 0086 this_inj = Vm(:,wc); %(no_of_electrodes x 1) vector 0087 0088 for ee = 1:no_pl:el_no 0089 0090 this_chunk = Y(ee:ee+no_pl-1); 0091 0092 for jj=1:length(this_chunk)-1 0093 0094 if Ib(this_chunk(jj),wc) == 0 && Ib(this_chunk(jj+1),wc) == 0 %Electrodes not involved in currents 0095 0096 voltageV = [voltageV; ((this_inj(this_chunk(jj)))- this_inj(this_chunk(jj+1)))]; 0097 indV = [indV;[this_chunk(jj),this_chunk(jj+1)]]; 0098 cn = cn+1; 0099 end 0100 0101 end 0102 0103 end 0104 df = [df;cn]; 0105 end 0106 0107 0108 %voltage = [voltageH;voltageV]; 0109 0110 %ind = [indH;indV]; 0111 0112 % Separate df (Horrizontal / Vertical electrode combinations per current pattern as) 0113 % dfh = df(1:2:end); 0114 % dfv = df(2:2:end); 0115 0116 0117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0118 % This is part of the EIDORS suite. 0119 % Copyright (c) N. Polydorides 2003 0120 % Copying permitted under terms of GNU GPL 0121 % See enclosed file gpl.html for details. 0122 % EIDORS 3D version 2.0 0123 % MATLAB version 5.3 R11 0124 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0125