File Exchange

image thumbnail

Hermite cubic interpolating polynomial with specified derivatives

version 1.0 (2.99 KB) by

Computes piecewise cubic polynomial which interpolates function values and first derivatives.

10 Downloads

Updated

View License

PP = PCHIPD(X,Y,D) provides the piecewise cubic polynomial which interpolates values Y and derivatives D at the sites X. This is meant to augment the built-in Matlab function PCHIP, which does not allow the user to specify derivatives.

X must be a vector.

If Y and D are vectors, then Y(i) and D(i) are the value and derivative to be matched at X(i).

If Y and D are matrices, then size(Y,2) == size(D,2) == length(X). Also, size(Y,1) == size(D,1). Use this for interpolating vector valued functions.

YY = PCHIPD(X,Y,D,XX) is the same as YY = PPVAL(PCHIPD(X,Y,D),XX), thus providing, in YY, the values of the interpolant at XX.

Comments and Ratings (4)

That is a good question. The matlab documentation for PCHIP says:

"The slopes at the xj are chosen in such a way that P(x) preserves the shape of the data and respects monotonicity."

This submission asks the user to specify the derivatives. Thus, the user could specify derivative values that preserve monotonicity, however this would have to be done explicitly.

Jacco

Jacco (view profile)

Great submission. The regular pchip "respects" monotonicity, while this solution doesn't. Is there anyway I could go about achieving this? Thanks!

M I

M I (view profile)

Max Radin

Max Radin (view profile)

MATLAB Release
MATLAB 7.9 (R2009b)
Acknowledgements

Inspired: VASPLAB

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video