How to obtain the piecewise expressions of spline fit obtained using MATLAB's command spapi?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Steven Lord
am 22 Sep. 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 Kommentar
Muhammad Adeel Ahsan Awan
am 22 Sep. 2022
How can i get the piecewise expressions of splines on different intervals?
Siehe auch
Kategorien
Mehr zu Spline Postprocessing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!