Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Interpolation for 2-D gridded data in meshgrid format

`Vq = interp2(X,Y,V,Xq,Yq)`

`Vq = interp2(V,Xq,Yq)`

`Vq = interp2(V)`

`Vq = interp2(V,k)`

`Vq = interp2(___,method)`

`Vq = interp2(___,method,extrapval)`

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.

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:

Extrapolated values for the

`'spline'`

and`'makima'`

methods`NaN`

values for other interpolation methods

`griddata`

| `griddedInterpolant`

| `interp1`

| `interp3`

| `interpn`

| `meshgrid`

| `scatteredInterpolant`