We initialize the data:
[X,Y] = meshgrid(1:2:10);
Z = X.*cos(Y) - Y.*sin(X);
The surface looks like the following.
Now we set the points where we want to interpolate:
[Vx,Vy] = meshgrid(1:0.25:10);
We now can perform nearest interpolation,
Vz = interp2(X,Y,Z,Vx,Vy,'nearest');
line...