Inf computed by model function, fitting cannot continue.
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have the following data:
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and y = [1, -0.2213, 0.4189, 0.2125, -0.542, 0, 0, 0, 0, 0]
I'm trying to fit an exponetial curve and even though it is not the best curve to fit, I need it to be exponential. The thing is that it has worked for every single of the other vectors that i have (even for the ones with all-negative values and much worse data) but for some reason the fitting function gives me this error only for this one:
Error using fit>iFit (line 348)
Inf computed by model function, fitting cannot continue.
Try using or tightening upper and lower bounds on coefficients.
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
This is my code:
f = fittype('exp(-x/phi)', 'independent', 'x');
myfit_uu2 = fit(x', y', f, 'StartPoint', 1);
lambda = myfit_uu2.phi;
0 commentaires
Réponses (1)
Harsha Priya Daggubati
le 17 Mar 2020
Hi,
I tried replicating running your code in MATLAB R2019b. I got the result with lamda as 0.0294. No issues as you mentioned.
x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
y = [1, -0.2213, 0.4189, 0.2125, -0.542, 0, 0, 0, 0, 0];
f = fittype('exp(-x/phi)', 'independent', 'x');
myfit_uu2 = fit(x', y', f, 'StartPoint', 1);
lambda = myfit_uu2.phi;
Can you try restarting your MATLAB and using these commands:
rehash toolbox
rehash toolboxcache
Or else try updating to the newer MATLAB versions.
Hope this helps!
1 commentaire
Ivy Gao
le 7 Août 2020
Hi, does this code work on your MATLAB?
baffledTB_x = [0
1.25
2.5
3
3.5
4
18.5];
baffledTB_y = [0.06
0.155
0.289
0.412
0.576
0.641
1.76];
x = baffledTB_x;
y = baffledTB_y;
myfittype = fittype('a + b*log(x)',...
'dependent',{'y'},'independent',{'x'},...
'coefficients',{'a','b'})
myfit=fit(x,y,myfittype,'StartPoint',[0 0.6])
Thanks!!!
Voir également
Catégories
En savoir plus sur Get Started with 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!