Predicting lower and upper bounds of coefficients for curve fitting tool.
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Torsten
le 3 Mai 2019
What are the initial parameters you provide for the fitting tool ? How does the curve look like for your initial parameters ?
Réponses (1)
darova
le 3 Mai 2019
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 commentaires
Voir également
Catégories
En savoir plus sur Curve Fitting Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!