custom logarithmic fit with three coefficients
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I am trying to fit a custom logarithmic function
logfit2 = fittype('a + b*log(c*x)','dependent',{'y'},'independent',{'x'}, 'coefficients',{'a','b','c'});
fitulog2=fit(urot2,z,logfit2); plot(fitulog2,'magenta');
and the data are urot2 = [5.1689; 6.2631; 7.1724; 8.1874]; and z=[20;40;60;80]; I get the error:
Error using fit>iFit
Complex value computed by model function, fitting cannot continue.
Try using or tightening upper and lower bounds on coefficients.
Did anyone use the above function for fitting? How do I set lower and upper bounds on coefficients?
Thanks, Petr.
0 Commenti
Risposta accettata
Torsten
il 6 Mar 2023
It doesn't make sense to use three fitting parameters for the function type you supply.
a + b*log(c*x) = a + b*log(c) + b*log(x)
So the fittype should be
u + v*log(x)
This way, you also circumvent the problem of a negative value for c which makes log(c*x) complex-valued (the reason for your error message).
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!