Fitting linear log regression with fitlm function

57 ビュー (過去 30 日間)
Spirit
Spirit 2017 年 11 月 6 日
コメント済み: Star Strider 2017 年 11 月 7 日
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!

回答 (1 件)

Star Strider
Star Strider 2017 年 11 月 6 日
編集済み: Star Strider 2017 年 11 月 6 日
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 件のコメント
Star Strider
Star Strider 2017 年 11 月 7 日
I’m lost.
Good luck!

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by