How can I fit data using quartic smoothing splines?
Afficher commentaires plus anciens
Dear Community,
I am looking for something exactly like the existing function SPAPS, but for quartic splines. For some reason the only built-in options appear to be quadratic, cubic, and quintic. I have tried solutions with the FIT function but I am not getting anywhere. Please note it is important that I can set knots, specify the smoothing parameter p and retract the values of the resulting function.
Thank you very much for your help!
Thomas
3 commentaires
Thomas Erdosi
le 28 Juil 2012
Modifié(e) : Walter Roberson
le 28 Juil 2012
John D'Errico
le 28 Juil 2012
So use quintic. WTP?
Thomas Erdosi
le 28 Juil 2012
Réponses (2)
Isabella Osetinsky-Tzidaki
le 26 Déc 2016
Modifié(e) : Isabella Osetinsky-Tzidaki
le 26 Déc 2016
1 vote
Quoted from https://www.mathworks.com/help/curvefit/examples/how-to-construct-splines.html
k = 5; % order 5, i.e., we are working with quartic splines
x = 2*pi*sort([0 1 rand(1,10)]);
y = cos(x);
sp = spapi( optknt(x,k), x, y );
Azzi Abdelmalek
le 28 Juil 2012
%let us take this example:
method='smoothingspline'
t=[0:10];y=sin(t); %your signal
yfit=fit(t',y',method) %interpolation function yfit
%now choose your new time vector with 0.1 sample time
ti=0:0.1:10;yi=yfit(ti)
plot(t,y,'r') %your original signal
hold on, plot(ti,yi,'+b'); %your new signal
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!