Skip to content

interp2

general · scripts/general/interp2.m

: zi = interp2 (x, y, z, xi, yi)
: zi = interp2 (z, xi, yi)
: zi = interp2 (z, n)
: zi = interp2 (z)
: zi = interp2 (…, method, extrapval)

Two-dimensional interpolation of the matrix z, whose rows follow y and whose columns follow x, at the points (xi, yi).

x and y are vectors, or grids as returned by meshgrid; they default to the column and row indices of z. xi and yi are arrays of equal size, or vectors of different orientation that define a grid. method is "linear" (default), "nearest", "cubic", "spline" or "pchip". Points outside the data get extrapval (NaN by default; the spline method extrapolates). interp2 (z, n) refines z n times.