How can I fit data using quartic smoothing splines?

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 件のコメント

Thomas Erdosi
Thomas Erdosi 2012 年 7 月 28 日
編集済み: Walter Roberson 2012 年 7 月 28 日
Can anyone help me with the above problem? I am currently using the cubic smoothing spline, but it's just not working well enough. The code looks like this
w = ones(size(surface1m),1);
[sp,values]=spaps(surface1m(:,5),surface1m(:,9),0.01,w,2);
The last input argument defines the order of the spline, 1 for quadratic, 2 for cubic and 3 for quintic.
Does anybody have an idea how to do this for the quartic version (4th order)? Any help would be extremely appreciated this is getting relatively urgent.. Thanks in advance!
John D'Errico
John D'Errico 2012 年 7 月 28 日
So use quintic. WTP?
Thomas Erdosi
Thomas Erdosi 2012 年 7 月 28 日
I need to exactly replicate the results of a paper that uses quartic

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

回答 (2 件)

Isabella Osetinsky-Tzidaki
Isabella Osetinsky-Tzidaki 2016 年 12 月 26 日
編集済み: Isabella Osetinsky-Tzidaki 2016 年 12 月 26 日

1 投票

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
Azzi Abdelmalek 2012 年 7 月 28 日

0 投票

%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

2 件のコメント

Thomas Erdosi
Thomas Erdosi 2012 年 7 月 28 日
Thank you for your answer. I have tried the same before using the fit function with specifying 'smoothingspline' as method but unfortunately this is more of a general smoothing solution and not the exact quartic smoothing spline I need. I have tried a few thing with fitoptions as well but without success. Does anybody know how to do this for the quartic smoothing spline? Thanks again
Thomas Erdosi
Thomas Erdosi 2012 年 7 月 30 日
Isn't there anyone who can help..? This must be possible to do in MATLAB.

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

カテゴリ

ヘルプ センター および File ExchangeSpline Postprocessing についてさらに検索

質問済み:

2012 年 7 月 25 日

編集済み:

2016 年 12 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by