function [Er] = ref_master(E,vtx,gnd_ind,sch); Applying reference to the system. Modifying the system matrix to preserve uniqueness. E = The rank deficient by 1 system matrix Er = The full rank matrix sch = The grounding scheme: 0 for grounding node gnd_ind 1 for grounding electrode gnd_ind gnd_ind = The ground index
0001 function [Er] = ref_master(E,vtx,gnd_ind,sch); 0002 %function [Er] = ref_master(E,vtx,gnd_ind,sch); 0003 % 0004 %Applying reference to the system. Modifying the system matrix to 0005 %preserve uniqueness. 0006 % 0007 % 0008 % 0009 %E = The rank deficient by 1 system matrix 0010 %Er = The full rank matrix 0011 %sch = The grounding scheme: 0012 % 0 for grounding node gnd_ind 0013 % 1 for grounding electrode gnd_ind 0014 %gnd_ind = The ground index 0015 0016 [nv,jnk] = size(vtx); 0017 0018 if nargin < 4 0019 sch = 0; 0020 end 0021 0022 if sch == 0 %Ground a surface node 0023 0024 Er = E; 0025 0026 Er(gnd_ind,:)= 0; %zeros(1,mas_c); 0027 Er(:,gnd_ind)= 0; %zeros(mas_r,1); 0028 Er(gnd_ind,gnd_ind) = 1; 0029 0030 else %Ground one of the boundary electrodes 0031 0032 Er = E; 0033 0034 if gnd_ind > size(E,1) - nv 0035 error('Grounding electrode index out of range') 0036 end 0037 0038 0039 Er(nv+gnd_ind,:)= 0; %zeros(1,mas_c); 0040 Er(:,nv+gnd_ind)= 0; %zeros(mas_r,1); 0041 Er(nv+gnd_ind,nv+gnd_ind) = 1; 0042 0043 end 0044 0045 0046 0047 0048 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0049 % This is part of the EIDORS suite. 0050 % Copyright (c) N. Polydorides 2003 0051 % Copying permitted under terms of GNU GPL 0052 % See enclosed file gpl.html for details. 0053 % EIDORS 3D version 2.0 0054 % MATLAB version 5.3 R11 0055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%