pchip - Piecewise Cubic Hermite Interpolating Polynomial (PCHIP)

Syntax

yi = pchip(x,y,xi)
pp = pchip(x,y)

Description

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 at intermediate points, such that:

Remarks

spline constructs in almost the same way pchip constructs . However, spline chooses the slopes at the differently, namely to make even continuous. This has the following effects:

Examples

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',4)

See Also

interp1, spline, ppval

References

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

[2] Kahaner, David, Cleve Moler, Stephen Nash, Numerical Methods and Software, Prentice Hall, 1988.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS