interpgrid2xyz#
[z] = interpgrid2xyz(xgrid, ygrid, zgrid, x, y, dispout)
Description#
Interpolate 2d gridded data on given scatter point(s) using nearest neighbor method
Inputs#
- xgrid
x data as a [M*N] array
- ygrid
y data as a [M*N] array
- zgrid
z data as z(x,y) as a [M*N] array
- x
x of point that nearest point to that is desired to be found
- y
y of point that nearest point to that is desired to be found
- dispout=’no’;
Define to display outputs or not (‘yes’: display, ‘no’: not display)
Outputs#
- z
Value of interpolated data at (x,y) as z(x,y)
Examples#
[xgrid,ygrid]=meshgrid(linspace(0,10,100),linspace(0,10,100));
zgrid=ygrid.*sin(xgrid)-xgrid.*cos(ygrid);
x=10.*rand(100,1);
y=10.*rand(100,1);
[z]=interpgrid2xyz(xgrid,ygrid,zgrid,x,y,'yes');