express basis spline derivative in terms of interpolation values

207 ビュー (過去 30 日間)
SA-W
SA-W 2024 年 3 月 28 日 17:36
コメント済み: Bruno Luong 2024 年 4 月 4 日 20:28
x = [1 2 3 4 5];
y = randn(size(x));
f = spapi(5,x,y);
fdd = fnder(f, 2);
If we evaluate the second derivative at a given point x* as
xeval = 3.5;
val = fnval(fdd, xeval)
is there a way to express "val" as a linear combination of the interpolation values as
val = y(1)*c1 + ... + y(5)*c5
Then, the task is to find the coefficients ci.
Can this be done with symbolic differentiation or other techniques? Or is there an easy analytical representation for that?
Thank you!

採用された回答

Bruno Luong
Bruno Luong 2024 年 3 月 28 日 18:24
x = [1 2 3 4 5];
y = randn(size(x));
k = 5;
f = spapi(k,x,y);
B = spapi(k,x,eye(length(x)));
fdd = fnder(f, 2);
Bdd = fnder(B,2);
xeval = 3.5;
val = fnval(fdd, xeval)
val = 1.5349
c = fnval(Bdd, xeval);
vcomb = y * c
vcomb = 1.5349
err = val-vcomb
err = 8.8818e-16
  34 件のコメント
SA-W
SA-W 2024 年 4 月 4 日 19:15

Honestly I dont understand what you want to achieve your code. Why do you put positive constraint on fdddd(x(end)) and not fddd(x(end))? I don't know what is your goal

Oh, you are right. To have s''(x)>0 for x>x(end), I thought the fourth derivative must be positive at x(end). But s'''(x(end)) is sufficient, right?

(I will not ask further after this and say thanks a lot for helping!! :-))

Bruno Luong
Bruno Luong 2024 年 4 月 4 日 20:28
You might need to impose both conditions of third and fourth derivative on x(end).

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpline Construction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by