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

조회 수: 12 (최근 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 CenterFile Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by