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
any of five strings for choosing an alternative interpolation method: 'nearest', '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 five 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 points, specified as a row or column vector of real numbers.
The values in x must be strictly monotonic and increasing.
Furthermore, the length of x must conform to one
of the following requirements:

If v is a vector, then length(x) must
equal length(v).

If v is an array, then length(x) must
equal size(v,1).

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 a minimum of 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 a minimum of 2 points.

Modest memory requirements

Fastest computation time

'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'.

A set of values that are always increasing
or decreasing, without reversals. For example, the sequence, a
= [2 4 6 8] is strictly monotonic and increasing. The sequence, b
= [2 4 4 6 8] is not strictly monotonic because there is
no change in value between b(2) and b(3).
The sequence, c = [2 4 6 8 6] contains a reversal
between c(4) and c(5), so it
is not monotonic at all.