Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)
yi = pchip(x,y,xi)
pp = pchip(x,y)
yi = pchip(x,y,xi) returns
yi containing elements corresponding to
the elements of
xi and determined by piecewise
cubic interpolation within vectors
x specifies the points at which the
y is given, so
have the same length. If
y is a matrix or array,
then the values in the last dimension,
are taken as the values to match with
x. In that
case, the last dimension of
y must be the same
yi is of size
... size(y,n-1) length(xi)]. For example, if
a matrix, then
yi is of size
pp = pchip(x,y) returns
a piecewise polynomial structure for use by
x can be a row or column vector.
a row or column vector of the same length as
or a matrix with
pchip finds values of an underlying interpolating
function at intermediate points, such
On each subinterval , is the cubic Hermite interpolant to the given values and certain slopes at the two endpoints.
interpolates y, i.e., , and the first derivative is continuous. The second derivative is probably not continuous; there may be jumps at the .
The slopes at the 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 .
Note If y is a matrix, satisfies the above for each column of y.
x = -3:3; y = [-1 -1 -1 0 1 1 1]; t = -3:.01:3; p = pchip(x,y,t); s = spline(x,y,t); plot(x,y,'o',t,p,'-',t,s,'-.') legend('data','pchip','spline','Location','SouthEast')
spline constructs in almost the same way
the slopes at the differently, namely
to make even continuous. This has the following
spline produces a smoother result,
i.e. is continuous.
spline produces a more accurate
result if the data consists of values of a smooth function.
pchip has no overshoots and less
oscillation if the data are not smooth.
pchip is less expensive to set
The two are equally expensive to evaluate.
 Fritsch, F. N. and R. E. Carlson, "Monotone Piecewise Cubic Interpolation," SIAM J. Numerical Analysis, Vol. 17, 1980, pp.238-246.
 Kahaner, David, Cleve Moler, Stephen Nash, Numerical Methods and Software, Prentice Hall, 1988.