Predicting lower and upper bounds of coefficients for curve fitting tool.

23 ビュー (過去 30 日間)
Jule
Jule 2019 年 5 月 3 日
コメント済み: Jule 2019 年 5 月 6 日
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
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 ?
Jule
Jule 2019 年 5 月 6 日
I don´t provide the initial parameters, Matlab is doing it on its own. So a = 0.9593, b = 0.5472 and s = 0.1386, resulting in f(x) = 0. This is exactly the point I am looking for, a way to predict suitable values for a, b and s, based on the data I have. Playing around with the lower and upper boundaries results in a good fit, but it is also time-consuming, which I like to avoid.
A good fit for the data provided is a = 0.05621, b = 253.6 and s = 95.74. However, the values do not make much sense to me. b describes the shift along the x axis, but what about a and s?

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

回答 (1 件)

darova
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)
img.png

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by