我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档
# interp2

## Syntax

## Description

## Examples

## Input Arguments

## Output Arguments

## More About

## See Also

#### Introduced before R2006a

Interpolation for 2-D gridded data in meshgrid format

In a future release, `interp2`

will not accept
mixed combinations of row and column vectors for the sample and query
grids. For more information, and recommendations for updating your
code, see Functionality being removed or changed.

returns
interpolated values of a function of two variables at specific query
points using linear interpolation. The results always pass through
the original sampling of the function. `Vq`

= interp2(`X,Y`

,`V`

,`Xq,Yq`

)`X`

and `Y`

contain
the coordinates of the sample points. `V`

contains
the corresponding function values at each sample point. `Xq`

and `Yq`

contain
the coordinates of the query points.

specifies
an optional, trailing input argument that you can pass with any of
the previous syntaxes. The `Vq`

= interp2(___,`method`

)`method`

argument can
be any of the following strings that specify alternative interpolation
methods: `'linear'`

, `'nearest'`

, `'cubic'`

,
or `'spline'`

. The default method is `'linear'`

.

also
specifies `Vq`

= interp2(___,`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 `interp2`

returns
one of the following:

The extrapolated values for the

`'spline'`

method`NaN`

values for interpolation methods other than`'spline'`

`griddata`

| `griddedInterpolant`

| `interp1`

| `interp3`

| `interpn`

| `meshgrid`

| `scatteredInterpolant`

Was this topic helpful?