1-D data interpolation (table lookup).
YI = INTERP1(X,Y,XI) returns vector YI containing elements
corresponding to the elements of XI and determined by interpolation
within vectors X and Y.
Interpolation is the same operation as "table lookup". Described in
"table lookup" terms, the "table" is [X,Y] and INTERP1 "looks-up"
the elements of XI in X, and, based upon their location, returns
values YI interpolated within the elements of Y.
INTERP1 performs multiple output table lookup if Y is a matrix.
If Y is a matrix with length(X) rows, and N columns, INTERP1
returns a length(XI)-by-N matrix YI containing the multi-output
table lookup results.
By default, INTERP1 uses linear interpolation.
YI = INTERP1(X,Y,XI,'method') specifies alternate methods.
Available methods are:
'linear' - linear interpolation
'spline' - cubic spline interpolation
'cubic' - cubic interpolation
All the interpolation methods require that X be monotonic. The
'cubic' method also requires that the points in X be equally-spaced.
For example, generate a coarse sine curve and interpolate over a
x = 0:10; y = sin(x);
xi = 0:.25:10;
yi = interp1(x,y,xi);
See also INTERPFT , INTERP2 , GRIDDATA .