pchip
Piecewise Cubic Hermite Interpolating Polynomial (PCHIP).
📝Syntax
yq = pchip(x, y, xq)
pp = pchip(x, y)
📥Input Arguments
Parameter Description
x Sample points, strictly increasing.
y Sample values.
xq Query points.
📤Output Arguments
Parameter Description
yq Interpolated values.
pp Piecewise polynomial structure.
📄Description

pchip is a convenience function for one-dimensional shape-preserving piecewise cubic Hermite interpolation: the interpolant preserves the monotonicity of the data and does not overshoot.

With three inputs, pchip(x, y, xq) is equivalent to interp1(x, y, xq, 'pchip').

With two inputs, it returns a piecewise polynomial structure evaluable with ppval.

💡Examples
x = -3:3;
y = [-1 -1 -1 0 1 1 1];
xq = -3:0.25:3;
yq = pchip(x, y, xq)
Piecewise polynomial form
x = [0 1 2.5 3.6 5 7 8.1 10];
y = cos(x);
pp = pchip(x, y);
yq = ppval(pp, 0:0.25:10)
🔗See Also
interp1makimappval
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub