Fitting a smooth (logarithmic) curve

조회 수: 4 (최근 30일)
Marian
Marian 2017년 5월 23일
답변: John D'Errico 2017년 5월 23일
I need to fit a curve to the following equation:
u = a0 + (a1*z) + (a2*lnz)
so that I get the coefficients a1 and a2. I have arrays u(z) and z, and I believe I might need to use nlinfit, but I'm not entirely clear on how to define my own "modelfun"

답변 (1개)

John D'Errico
John D'Errico 2017년 5월 23일
This is not a nonlinear problem in the unknown coefficients. Use regress, since you have the stats toolbox. You could even use backslash, but regress gives you more information.
help slash
help regress
By the way, lnz is not how you compute the natural log. Use log.

카테고리

Help CenterFile Exchange에서 Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by