0001 function lap_trialdata = laplacian_trial(trialdata,good_chan,xelec,yelec,zelec)
0002
0003
0004
0005
0006
0007
0008
0009
0010 if nargin ~= 5
0011 error('incorrect number of input arguments')
0012 end
0013 v = zeros(1,size(good_chan,2));
0014 x = zeros(1,size(good_chan,2));
0015 y = zeros(1,size(good_chan,2));
0016 z = zeros(1,size(good_chan,2));
0017 x = xelec(good_chan);
0018 y = yelec(good_chan);
0019 z = zelec(good_chan);
0020 welec= 1;
0021 [k,kinv,a,ainv,e]= k_and_e(welec,x,y,z);
0022 for samp = 1:size(trialdata,1)
0023 w = trialdata(samp,:);
0024 v = w(good_chan);
0025 [p,q,error_check]= mateqs(welec,x,y,z,v,k,kinv,a,ainv,e);
0026 v_lap = spherical_lap(welec,x,y,z,x,y,z,p,q);
0027 lap_trialdata(samp,good_chan) = v_lap;
0028 end;