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.

1-D data interpolation (table lookup)

`vq = interp1(x,v,xq)`

`vq = interp1(x,v,xq,method)`

`vq = interp1(x,v,xq,method,extrapolation)`

`vq = interp1(v,xq)`

`vq = interp1(v,xq,method)`

`vq = interp1(v,xq,method,extrapolation)`

`pp = interp1(x,v,method,'pp')`

returns
interpolated values of a 1-D function at specific query points using
linear interpolation. Vector `vq`

= interp1(`x`

,`v`

,`xq`

)`x`

contains the sample
points, and `v`

contains the corresponding values, *v*(*x*).
Vector `xq`

contains the coordinates of the query
points.

If you have multiple sets of data that are sampled at the same
point coordinates, then you can pass `v`

as an array.
Each column of array `v`

contains a different set
of 1-D sample values.

specifies
a strategy for evaluating points that lie outside the domain of `vq`

= interp1(`x`

,`v`

,`xq`

,`method`

,`extrapolation`

)`x`

.
Set `extrapolation`

to `'extrap'`

when
you want to use the `method`

algorithm for extrapolation.
Alternatively, you can specify a scalar value, in which case, `interp1`

returns
that value for all points outside the domain of `x`

.

returns
interpolated values and assumes a default set of sample point coordinates.
The default points are the sequence of numbers from `vq`

= interp1(`v`

,`xq`

)`1`

to `n`

,
where `n`

depends on the shape of `v`

:

When v is a vector, the default points are

`1:length(v)`

.When v is an array, the default points are

`1:size(v,1)`

.

Use this syntax when you are not concerned about the absolute distances between points.

specifies
an extrapolation strategy and uses the default sample points.`vq`

= interp1(`v`

,`xq`

,`method`

,`extrapolation`

)

returns the piece-wise polynomial form of `pp`

= interp1(`x`

,`v`

,`method`

,'pp')*v*(*x*)
using the `method`

algorithm.

This syntax is not recommended. Use `griddedInterpolant`

instead.