FUNCTION REFERENCE
interp1
One-dimensional interpolation.
The source help has multiple entries for this name. They are preserved below in source order, including differing compatibility notes.
Source entry 1
One-dimensional interpolation.
Syntax
vq = interp1(x, v, xq)Syntax
vq = interp1(x, v, xq, method, fill)method is 'linear' (default) or 'nearest'. Queries outside x give NaN, or the scalar fill. The output has the shape of xq.
Example
interp1([1 2 3], [10 20 30], 2.5) % 25Differences from MATLAB: Finite real vectors with distinct x. No implicit x, matrix samples, extrapolation or other methods.
Source entry 2
One-dimensional interpolation.
Syntax
vq = interp1(x, v, xq)Syntax
vq = interp1(v, xq)Syntax
vq = interp1(x, v, xq, method)Syntax
vq = interp1(x, v, xq, method, extrapolation)method is 'linear' (default), 'nearest', 'next', 'previous', 'pchip',
'cubic' (same as 'pchip'), 'spline' (not-a-knot) or 'v5cubic' (MATLAB 5
cubic convolution; 'spline' when x is not equally spaced). extrapolation is
'extrap' or a scalar fill value; outside the sample range the default is NaN,
except 'pchip', 'cubic' and 'spline', which extrapolate; 'v5cubic' never
extrapolates. If v is a matrix,
each column is interpolated and xq must be a vector.
Example
interp1([1 2 3], [4 5 7], [0 4], 'linear', 'extrap') % [3 9]Differences from MATLAB: x and xq must be real; complex v (and a complex fill
value) is interpolated part by part, as in MATLAB. With
'extrap', 'next' and 'previous' give NaN on the side that has no neighbour.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.