Grid-based Interpolation
This example shows how to create a gridded interpolant and how to use it effectively to perform grid-based interpolation.
A grid is a common and useful way to organize data. This data format represents values or intensities at discrete grid point locations. Grid-based data also fits naturally within the array-based environment MATLAB provides.
When we work with gridded data, we often need to know the values at locations other than at the grid points. Typically, we may need to refine the grid to improve resolution or de-refine the grid if it contains more detail than we practically need. Grid-based interpolation provides the functionality needed to carry out these tasks.
MATLAB provides the INTERP family of functions to support interpolation on grids that are in NDGRID or MESHGRID format. The griddedinterpolant class provides similar capabilities. It is designed to support the interpolation of grids in NDGRID format and leverage memory and performance advantages where possible. These improvements are readily apparent when interpolating the same grid in a repeated manner. In this scenario, the overhead is cumulative. The griddedinterpolant can generally outperform the INTERP1/2/3/N functions as it is able to cache and reuse the same interpolating function.
Use y data: in nm; edges 140, 135, 132; center 120, 123, 122, 124; middle 130, 129, 127, 133; spread over the range.
Show all MATLAB code and graphs. Upload to Dropbox.