Skip to content

interp1

general · scripts/general/interp1.m

: vq = interp1 (x, v, xq)
: vq = interp1 (v, xq)
: vq = interp1 (…, method)
: vq = interp1 (…, method, extrap)
: pp = interp1 (x, v, method, "pp")

One-dimensional interpolation of the samples v given at the sites x, evaluated at the query points xq.

method is one of "linear" (default), "nearest", "previous", "next", "pchip" (or "cubic"), "spline" and "makima". Points outside the data range give NaN for the first four methods and are extrapolated by the others; extrap may be the string "extrap" or a scalar value that replaces every out-of-range result. When v is a matrix, each column is interpolated separately. With "pp" the piecewise polynomial is returned instead of being evaluated.