function Fl = myinterp3(x,y,z,f,Xl,Yl,Zl) % 'fast' 3-d linear interpolation. % This is essentially a matlab version of my fortran code. % It returns the same answer as interpn(...,'linear') but is % MUCH faster. % Make sure correct arguments are passed. This function % does NO error checking. Fl=repmat(NaN,size(Xl)); for il=1:length(Xl) xl=Xl(il); yl=Yl(il); zl=Zl(il); jlox=max(find(x<=xl)); jloy=max(find(y<=yl)); jloz=max(find(z<=zl)); % Use bilinear interpolation in (x,y) on the "faces" z(jloz) and z(jloz+1) if jlox