Fitting linear log regression with fitlm function
조회 수: 17 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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.)
참고 항목
카테고리
Help Center 및 File Exchange에서 Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!