FUNCTION REFERENCE

interpn

Interpolation on a grid in ndgrid layout.

Interpolation on a grid in ndgrid layout.

Syntax

Vq = interpn(X, V, Xq)

Syntax

Vq = interpn(X1, X2, V, Y1, Y2)

Syntax

Vq = interpn(V, Y1, Y2)

Syntax

Vq = interpn(X1, ..., Xn, V, Y1, ..., Yn)

Syntax

Vq = interpn(V, ntimes)

Syntax

Vq = interpn(..., method, extrapval)

method is 'linear' (default), 'nearest', 'cubic', 'spline' or 'pchip'; N-D data supports linear and nearest, optionally prefixed by '*'. Points outside the grid get extrapval (NaN by default). interpn(V, ntimes) refines the grid ntimes times between the points (once when ntimes is omitted). Query arrays of different shapes that are vectors are expanded as grid vectors.

Example

interpn([1 2 3], [10 20 30], 2.5)   % 25

Example

interpn(magic(3), 1.5, 2.5)   % 4.7500

Differences from MATLAB: N-D refinement and N-D cubic, spline, and pchip are not supported. 'cubic' on a non-uniform grid uses 'spline' (not checked against MATLAB).

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.