How to obtain the piecewise expressions of spline fit obtained using MATLAB's command spapi?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am working on fitting the data using B-form splines. I am using "spapi" command in MATLAB. Here is my code:
x = [0.0 0.3 0.5 0.6 1.0 1.0 0.0 0.2 0.6 0.8];
y = [1.0 0.5 0.9 0.8 0.0 1.0 0.0 0.1 0.2 0.7];
[yy,xx] = meshgrid(y,x); z = sin(xx+yy);
sp = spapi({3,5},{x,y},z)
fnplt(sp)
fnval(sp,[x;y])
I want to obtain the piece wise expressions of the splines. I tried see the documentation of spapi but they haven't mentioned any formulations for those. The function fnval only provide the value at some points, but i want to obtain the expression and calculate it derivatives further.
0 Commenti
Risposte (1)
Steven Lord
il 22 Set 2022
i want to obtain the expression and calculate it derivatives further.
Do you need the actual expression, or do you just want to be able to evaluate and differentiate it?
load census
S = spapi(2, cdate, pop);
S2 = fnder(S);
[minYear, maxYear] = bounds(cdate);
Y = minYear:5:maxYear;
plot(cdate, pop, 'o', Y, fnval(S, Y), '-+')
figure
plot(Y, fnval(S2, Y), 'x--')
1 Commento
Muhammad Adeel Ahsan Awan
il 22 Set 2022
How can i get the piecewise expressions of splines on different intervals?
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!