Can someone explain to me how interp2(X,Y,V,Xq,Yq) works? I've read the matlab docs, but they aren't very clear. Can anyone explain how it works more plainly?
Best Answer
Interp2 is a tool that allows you to interpolate on a gridded domain. So a grid based on meshgrid, in the (x,y) plane. The presumption is you have some array V, that defines V(x,y).
Xq and Yq are now a list of points to interpolate over that grid.
Interp2 is NOT there to interpolate over scattered data points, thus a point cloud in the (x,y) plane. That purpose is served by tools like griddata and scatteredInterpolant.
As you can see in the interp2 function it has the original X,Y,Z (or in this case V) and then the user defines the Xq and Yq points that are not on the original grid. the Xq and Yq can be a single XY pair to get the interpolated Z value.
Best Answer