Main Content

Interpolation for 1-D, 2-D, 3-D, and N-D gridded data in ndgrid format

returns
interpolated values of a function of `Vq`

= interpn(`X1,X2,...,Xn`

,`V`

,`Xq1,Xq2,...,Xqn`

)*n* variables
at specific query points using linear interpolation. The results always
pass through the original sampling of the function. `X1,X2,...,Xn`

contain
the coordinates of the sample points. `V`

contains
the corresponding function values at each sample point. `Xq1,Xq2,...,Xqn`

contain
the coordinates of the query points.

assumes a default grid of sample points. The default grid consists of the
points, 1,2,3,...n`Vq`

= interpn(`V`

,`Xq1,Xq2,...,Xqn`

)_{i} in each dimension. The value of
n_{i} is the length of the ith dimension in
`V`

. Use this syntax when you want to conserve memory and
are not concerned about the absolute distances between points.

also
specifies `Vq`

= interpn(___,`method`

,`extrapval`

)`extrapval`

, a scalar value that is assigned
to all queries that lie outside the domain of the sample points.

If you omit the `extrapval`

argument for queries
outside the domain of the sample points, then based on the `method`

argument `interpn`

returns
one of the following:

The extrapolated values for the

`'spline'`

and`'makima'`

methods`NaN`

values for other interpolation methods