Home > eeg > egis > spline > interp_3d.m

# interp_3d

## PURPOSE image = tstfit(welec,xelec,yelec,zelec,xs,ys,zs,p,q)

## SYNOPSIS function image_3d = interp_3d(welec,xelec,yelec,zelec,xs,ys,zs,p,q)

## DESCRIPTION `    image = tstfit(welec,xelec,yelec,zelec,xs,ys,zs,p,q)`

## CROSS-REFERENCE INFORMATION This function calls:
This function is called by:
• replace_trial new_trialdata = replace_trial(trialdata,good_chan,xelec,yelec,zelec)

## SOURCE CODE ```0001 function image_3d = interp_3d(welec,xelec,yelec,zelec,xs,ys,zs,p,q)
0002 %    image = tstfit(welec,xelec,yelec,zelec,xs,ys,zs,p,q)
0003 %
0004 n = size(xelec,2);
0005 ms = size(xs,1);
0006 ns = size(xs,2);
0007 image_3d = zeros(ms,ns);
0008 qm = zeros(ms,ns);
0009 qm = q(1) +q(2)*xs +q(3)*ys+q(4)*xs.^2+q(5)*xs.*ys +q(6)*ys.^2 +q(7)*zs +q(8)*zs.*xs+q(9)*zs.*ys+q(10)*zs.^2;
0010 sum = zeros(ms,ns);
0011 s = zeros(ms,ns);
0012 t = zeros(ms,ns);
0013 r=zeros(ms,ns);
0014 str = zeros(ms,ns);
0015 for i=1:n
0016     s = xs - xelec(i)*ones(ms,ns);
0017     t = ys - yelec(i)*ones(ms,ns);
0018     r = zs - zelec(i)*ones(ms,ns);
0019     str = s.^2+t.^2+r.^2;
0020     sum = sum + p(i)*((str+welec*ones(ms,ns)).^2).*log(str+welec*ones(ms,ns));
0021 end;
0022 image_3d = sum+qm;
0023```

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003