MATLAB: When using interp3, do the input grids need to have evenly spaced values

interpolation

When using interp3, do the input grids need to have evenly spaced values? In other words, I need to know how to avoid the "Input grid is not a valid MESHGRID" error, despite the requirement that I use a specific set of input grids upon which I need to interpolate.

Best Answer

No. They do not need to be EVENLY spaced. So a grid spacing of [1 2 4 8 15 17 23 100] is entirely valid. Though depending on the shape of your function, it may produce good or bad interpolation results. Long stretches where the function is highly nonlinear are a problem.
You do need a grid however. Something, for example, that meshgrid would have produced. If you don't understand that, then you need to read the help for meshgrid carefully. Such a grid will be aligned with the axes of your coordinate system, though, again, they need not be purely linear and uniform along those axes.
You CANNOT have scattered data, so data where the points do not lie on a cartesian grid.
Be careful, as there is a difference between ndgrid and meshgrid. meshgrid produces the ordering you will need, and only meshgrid.