Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)

returns
a vector of interpolated values `p`

= pchip(`x`

,`y`

,`xq`

)`p`

corresponding
to the query points in `xq`

. The values of `p`

are
determined by shape-preserving piecewise cubic
interpolation of `x`

and `y`

.

`spline`

constructs $$S(x)$$ in almost the same way`pchip`

constructs $$P(x)$$. However,`spline`

chooses the slopes at the $${x}_{j}$$ differently, namely to make even $${S}^{\u2033}(x)$$ continuous. This difference has several effects:`spline`

produces a smoother result, such that $${S}^{\u2033}(x)$$ 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 is not smooth.`pchip`

is less expensive to set up.The two are equally expensive to evaluate.

[1] Fritsch, F. N. and R. E. Carlson. "Monotone
Piecewise Cubic Interpolation." *SIAM Journal on Numerical
Analysis*. Vol. 17, 1980, pp.238–246.

[2] Kahaner, David, Cleve Moler, Stephen Nash. *Numerical
Methods and Software*. Upper Saddle River, NJ: Prentice
Hall, 1988.