Documentation |
Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)
yi = pchip(x,y,xi)
pp = pchip(x,y)
yi = pchip(x,y,xi) returns vector yi containing elements corresponding to the elements of xi and determined by piecewise cubic interpolation within vectors x and y. The vector x specifies the points at which the data y is given. If y is a matrix, then the interpolation is performed for each column of y and yi is length(xi)-by-size(y,2).
pp = pchip(x,y) returns a piecewise polynomial structure for use by ppval. x can be a row or column vector. y is a row or column vector of the same length as x, or a matrix with length(x) columns.
pchip finds values of an underlying interpolating function $$P(x)$$ at intermediate points, such that:
On each subinterval $${x}_{k}\le x\le {x}_{k+1}$$, is the cubic Hermite interpolant to the given values and certain slopes at the two endpoints.
$$P(x)$$ interpolates y, i.e., $$P({x}_{j})={y}_{j}$$, and the first derivative $$\frac{dP}{dx}$$ is continuous. The second derivative $$\frac{{d}^{2}P}{d{x}^{2}}$$ is probably not continuous; there may be jumps at the $${x}_{j}$$.
The slopes at the $${x}_{j}$$ are chosen in such a way that preserves the shape of the data and respects monotonicity. This means that, on intervals where the data are monotonic, so is ; at points where the data has a local extremum, so does .