how to calculate spline of the function?

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.

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 5월 23일

0 개 추천

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)

댓글 수: 1

cupuyc a
cupuyc a 2012년 5월 23일
It work. Unfortunately, I can't understand which principle.
For the function y = x^3 I'd like to obntain the following coefficients: [1 0 0 0]
But I've obtained:
knots: [-1 -1 -1 -1 -0.3333 0.3333 1 1 1 1]
coefs: [-1 -0.3333 0.1111 -0.1111 0.3333 1]

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by