MATLAB: How to calculate spline of the function

spline

Hi. How can i obtain a cubic spline coefficients, if i know values and derivatives of the function? For example:
args = [-1, 0, 1];
vals = [-1, 0, 1];
derivs = [3, 0, 3];
subic_spline_coefs = ...?
I'd like obtain coefs using derivatives information.

Best Answer

X = [args;args]
Y = [vals;derivs]
P = spapi(4,X(:),Y(:))
after comment
ppp = csape([-1 1],[3 -1 1 3],[1 1])
eg
polyval(ppp.coefs,1)
Related Question