yq = pchip(x, y, xq)
pp = pchip(x, y)
| Parameter | Description |
|---|---|
| x | Sample points, strictly increasing. |
| y | Sample values. |
| xq | Query points. |
| Parameter | Description |
|---|---|
| yq | Interpolated values. |
| pp | Piecewise polynomial structure. |
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.
x = -3:3;
y = [-1 -1 -1 0 1 1 1];
xq = -3:0.25:3;
yq = pchip(x, y, xq)
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)
| Version | Description |
|---|---|
| 2.0.0 | initial version |