interp2
Two dimensional interpolation.
(zn,interploator)=interp2(x,y,z,xn,yn,option)
(zn,interploator)=interp2(x,y,z,xn,yn)
yn=interp2(interpolator,xn);
Inputs
x A real vector sepcifying the x-coordinates of points at which the function values are known.
y A real vector sepcifying the y-coordinates of points at which the function values are known.
z A real array, containing the values of the function to be interpolated at the points defined by the first two inputs.
xn A real array, containing the x-coordinates of the points at which the interpolated values of the function are needed.
yn A real array, containing the y-coordinates of the points at which the interpolated values of the function are needed.
interpolator the second output of a prior call to interp2 .
option 'nn' for nearest neigbor interpolation, 'linear' for linear interpolation, 'cubic' for piecewise cubic interpolation, and 'spline' for spline interpolation. The default value of option is 'cubic' .
Outputs
zn The interpolated values of the function at the points specified by xn .
interpolator An object that can be used subsequently to interpolate the same function at other points by using the last form of call to interp2 .


Example
>>x=[0:.25:1]'*pi;
>>z=sin(x)*cos(x')
>>xn=[0:.05:1]'*pi;
>>(xn,yn)=meshgrid(xn,xn);
>>zn=interp2(x,x,z,xn,yn);
>>subplot(2,1,1)
>>surf(x,x,z)
>>title('Coarse Grid')
>>subplot(2,1,2)
>>surf(xn,yn,zn)
>>title('Fine Grid (Interpolated)')