If you pass nonuniformly spaced points and specify the 'v5cubic' method, interp1 issues
a warning. In addition, the following syntaxes will be removed or
changed in a future release:

vq = interp1(x,v,xq) returns
interpolated values of a 1-D function at specific query points using
linear interpolation. Vector 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.

vq = interp1(x,v,xq,method) specifies
a string for choosing an alternative interpolation method: 'nearest', 'next', 'previous', 'linear','spline','pchip',
or 'cubic'. The default method is 'linear'.

vq = interp1(x,v,xq,method,extrapolation) specifies
a strategy for evaluating points that lie outside the domain of x.
Set extrapolation to the string, '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.

vq = interp1(v,xq) returns
interpolated values and assumes a default set of sample point coordinates.
The default points are the sequence of numbers from 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.

vq = interp1(v,xq,method) specifies
any of the alternative interpolation methods and uses the default
sample points.

vq = interp1(v,xq,method,extrapolation) specifies
an extrapolation strategy and uses the default sample points.

pp = interp1(x,v,method,'pp')
returns the piece-wise polynomial form of v(x)
using the method algorithm.

Sample values, specified as a vector, matrix, or array of real
or complex numbers. If v is a matrix or an array,
then each column contains a separate set of 1-D values.

Example: rand(1,10)

Example: rand(10,1)

Example: rand(10,3)

Data Types: single | double Complex Number Support: Yes

Interpolation method, specified as a string from the table below.

method string

Description

Continuity

Comments

'linear'

Linear interpolation. The interpolated value at a query point
is based on linear interpolation of the values at neighboring grid
points in each respective dimension. This is the default interpolation
method.

C^{0}

Requires at least 2 points.

Requires more memory and computation time than nearest
neighbor.

'nearest'

Nearest neighbor interpolation. The interpolated value at a
query point is the value at the nearest sample grid point.

Discontinuous

Requires at least 2 points.

Modest memory requirements

Fastest computation time

'next'

Next neighbor interpolation. The interpolated value at a query
point is the value at the next sample grid point.

Discontinuous

Requires at least 2 points.

Same memory requirements and computation time as 'nearest'.

'previous'

Previous neighbor interpolation. The interpolated value at
a query point is the value at the previous sample grid point.

Discontinuous

Requires at least 2 points.

Same memory requirements and computation time as 'nearest'.

'pchip'

Shape-preserving piecewise cubic interpolation. The interpolated
value at a query point is based on a shape-preserving piecewise cubic
interpolation of the values at neighboring grid points.

C^{1}

Requires at least 4 points.

Requires more memory and computation time than linear.

'cubic'

Same as 'pchip'.

C^{1}

This method currently returns the same result as 'pchip'.
In a future release, this method will perform cubic convolution.

'v5cubic'

Cubic convolution used in MATLAB^{®} 5.

C^{1}

Points must be uniformly spaced. 'cubic' will
replace 'v5cubic' in a future release.

'spline'

Spline interpolation using not-a-knot end conditions. The interpolated
value at a query point is based on a cubic interpolation of the values
at neighboring grid points in each respective dimension.

C^{2}

Requires at least 4 points.

Requires more memory and computation time than 'pchip'.