Fitting linear log regression with fitlm function
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I would like to fit y = log(x) + k using fitlm (linear regression). How can I specify such a model? This is linear regression so would like to use fitlm function and not the fitnlm. Thanks!
0 Kommentare
Antworten (1)
Star Strider
am 6 Nov. 2017
Bearbeitet: Star Strider
am 6 Nov. 2017
Try this:
mdl = fitlm(log(x), y);
It assumes a linear model (slope and intercept), so this is all that is necessary.
NOTE — This will work providing that ‘x’ is real and positive. (I mention that for clarity.)
2 Kommentare
Siehe auch
Kategorien
Mehr zu Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!