Predicting lower and upper bounds of coefficients for curve fitting tool.
23 ビュー (過去 30 日間)
古いコメントを表示
Dear all,
I have a set of data, where X describes the time in hours and Y describes a concentration of a substance in g/l (see figure below, data is attached).
I am now looking for a curve that fits the data best. Since the data is skewed to the right I would prefer a curve that has a form of a gumbel function, slightly adjusted with a parameter s to stretch or compress the curve:
I know that I can use the curve fitting tool. However, it is kind of tedious to "play around" with the lower and upper bound for the coefficients a, b and s. So my question is if there is a way to predict the lower and upper bound for the coefficients? What possibillities do I have if I do not use the curve fitting tool at all?
I would really appreciate any help or hint!
Cheers
4 件のコメント
Torsten
2019 年 5 月 3 日
What are the initial parameters you provide for the fitting tool ? How does the curve look like for your initial parameters ?
回答 (1 件)
darova
2019 年 5 月 3 日
You can manually experiment with a,b,c
clc,clear
load X.mat
load Y.mat
func = @(a,b,c,x) a*exp( -(x-c).^2/b );
opt = fitoptions('Method','NonlinearLeastSquares',...
'Lower',[0 0 0],... % coefficient lower boundaries
'Upper',[10 100 300],... % coefficient upper boundaries
'StartPoint',[7 50 225]);
ft = fittype(func,'options',opt);
f = fit(x,y,ft)
plot(x,y,'.r')
hold on
a = f.a; % a = 7; height
b = f.b; % b = 65; width
c = f.c; % c = 255; x shift
x1 = linspace(min(x),max(x));
plot(x1,func(a,b,c,x1))
hold off
And what i got with (a=7, b=65, c=255)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!