0001 function transfimp = calc_transferimpedance( img)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 copt.cache_obj = {img.fwd_model, img.elem_data};
0022 copt.fstr = 'calc_transferimpedance';
0023 transfimp = eidors_cache(@calc_T, img, copt);
0024
0025
0026 function transfimp = calc_T( img);
0027 n_elecs= length( img.fwd_model.electrode );
0028
0029
0030
0031
0032 [stim_pat, meas_pat]= monopolar_even( n_elecs );
0033 img.fwd_model.stimulation = stim_pat;
0034
0035 imeas_pat= pinv(meas_pat);
0036
0037 data = fwd_solve(img);
0038
0039 sz= length(img.fwd_model.stimulation);
0040 transfimp = reshape( data.meas, sz, sz);
0041 transfimp = imeas_pat * transfimp * imeas_pat';
0042
0043 function [stim_pat, meas_pat] = trigonometric( n_elecs )
0044 stim_pat = struct;
0045 idx= linspace(0,2*pi,n_elecs+1)'; idx(end)= [];
0046 omega= idx*[1:n_elecs/2];
0047 meas_pat= [cos(omega), sin(omega) ]';
0048 for i=1:n_elecs
0049 stim_pat(i).stimulation='Amp';
0050 stim_pat(i).stim_pattern= meas_pat(i,:)';
0051 stim_pat(i).meas_pattern= meas_pat;
0052 end
0053
0054 function [stim_pat, meas_pat] = electrode_wise( n_elecs)
0055 stim_pat = struct;
0056 meas_pat= [-ones(n_elecs-1,1), speye(n_elecs-1)];
0057 for i=2:n_elecs
0058 stim_pat(i-1).stimulation='Amp';
0059 stim_pat(i-1).stim_pattern= sparse([1,i],1,[-1,1],n_elecs,1);
0060 stim_pat(i-1).meas_pattern= meas_pat;
0061 end
0062
0063 function [stim_pat, meas_pat] = monopolar( n_elecs)
0064 stim_pat = struct;
0065 meas_pat= speye(n_elecs);
0066 for i=1:n_elecs
0067 stim_pat(i).stimulation='Amp';
0068 stim_pat(i).stim_pattern= sparse(i,1,1,n_elecs,1);
0069 stim_pat(i).meas_pattern= meas_pat;
0070 end
0071
0072 function [stim_pat, meas_pat] = monopolar_even( n_elecs)
0073 stim_pat = struct;
0074 meas_pat= eye(n_elecs) - ones(n_elecs)/n_elecs;
0075 for i=1:n_elecs
0076 stim_pat(i).stimulation='Amp';
0077 stim_pat(i).stim_pattern= meas_pat(i,:)';
0078 stim_pat(i).meas_pattern= meas_pat;
0079 end