makima
statistics: yi = makima (x, y, xq)
statistics: yi = makima (y, xq)
statistics: yi = makima (…, "extrap")
Compute the 1-D Modified Akima piecewise cubic Hermite interpolant of sample data x and y.
The Modified Akima (MAKIMA) algorithm generates a shape-preserving
piecewise cubic interpolant. It differs from standard splines by avoiding
excessive local undulations and overshoots, and it connects collinear points
(flat regions) with straight lines. It is particularly well-suited for
oscillatory data where pchip might aggressively flatten local
extrema.
The sample points x must be a vector of unique values. If x is not sorted, the function will automatically sort it and rearrange y accordingly.
The sample values y can be a scalar, vector, or an N-dimensional array. If y is an N-dimensional array, the interpolation is performed along its last dimension, which must have the same length as x. Complex values for y are supported.
If query points xq are provided, the function evaluates the
interpolant and returns the interpolated values yi. By default,
makima uses the boundary polynomials to extrapolate for points
outside the range of x. The optional string argument "extrap"
is accepted for compatibility with other interpolation functions.
If only x and y are provided, the function returns a
piecewise polynomial structure pp that represents the interpolant.
This structure can be evaluated later at specific query points using
ppval.
Evaluating the interpolant at query points outside the domain of x automatically extrapolates using the boundary polynomials.
See also: interp1, pchip, spline
Source Code: makima