Best fitting curve for variable data
4 ビュー (過去 30 日間)
古いコメントを表示
Hello
I was trying fitting to fit the following data
x = 1.0779 1.2727 1.4700 1.5766 1.6471 1.7396 1.7828 1.8208 1.8370
y = 7.9511 9.8400 12.8838 15.1925 31.0055 36.0292 62.5528 87.9648 176.4142
for the equation:
y = a exp(b*(1/x)^c)
where a ba nd c are fitting paramters.
I triesd the fiting but unfortinately i was not able to magae it. It will be really helpful experties can guide me in this context.
Thanks in advance!
0 件のコメント
採用された回答
Matt J
2022 年 4 月 23 日
編集済み: Matt J
2022 年 4 月 23 日
Using fminspleas from the File Exchange
% data
x = [1.0779 1.2727 1.4700 1.5766 1.6471 1.7396 1.7828 1.8208 1.8370]' ;
y = [7.9511 9.8400 12.8838 15.1925 31.0055 36.0292 62.5528 87.9648 176.4142]' ; ;
funlist={1,@(c,xx) (1./xx).^c};
[c,ab]= fminspleas(funlist,-3,x,log(y),-inf,0);
a=exp(ab(1));
b=ab(2);
a,b,c
xx=linspace(min(x),max(x),100);
fun=@(x)a*exp(b*(1./x).^c);
plot(x,y,'o',xx,fun(xx))
ylim([0,max(y)])
0 件のコメント
その他の回答 (1 件)
KSSV
2022 年 4 月 23 日
編集済み: KSSV
2022 年 4 月 23 日
% data
x = [1.0779 1.2727 1.4700 1.5766 1.6471 1.7396 1.7828 1.8208 1.8370]' ;
y = [7.9511 9.8400 12.8838 15.1925 31.0055 36.0292 62.5528 87.9648 176.4142]' ; ;
eqn = @(a,b,c,x) a*exp(b*(1./x).^c) ; % equation to fit
% Define Start points
x0 = [1 1 1];
% fit-function
fitfun = fittype(eqn);
% fit curve
[fitted_curve,gof] = fit(x,y,fitfun,'StartPoint',x0)
% Save the coeffiecient values for a,b,c
coeffvals = coeffvalues(fitted_curve);
% Plot results
scatter(x, y, 'bs')
hold on
plot(x,fitted_curve(x),'r')
legend('data','fitted curve')
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!