makima

Modified Akima piecewise cubic Hermite interpolation.

Category: Mathematics > Interpolation

Syntax

yi = makima(x, y, xi)

Evaluates the modified Akima interpolant of (x, y) at the points xi.

pp = makima(x, y)

Returns the piecewise polynomial structure, for use with ppval.

Description

makima builds a cubic Hermite interpolant whose slopes at the data points come from a weighted average of neighbouring secant slopes. The weights make the curve flat across flat stretches of data, so it overshoots less than spline while being smoother than pchip near changes of slope.

The result is C1 continuous. Points outside the range of x are extrapolated with the end polynomial pieces.

Input arguments

x
Vector of distinct, increasing sample points.
y
Sample values at x.
xi
Points at which to evaluate.

Output arguments

yi
Interpolated values at xi.
pp
Piecewise polynomial in the form accepted by ppval and unmkpp.

Example

Smooth curve through six points

x = 1:6;
y = [1 3 2 5 4 6];
makima(x, y, [1.5 2.5 3.5])
Output
ans = 1×3

    2.3129    2.4572    3.5000

See also

pchip spline interp1 ppval