how to fit a curve in the form of A = (L^x)(D^y)
조회 수: 1 (최근 30일)
이전 댓글 표시
hi, i have some response data as vector A where the variables are L and D.
I just want to find the coefficients for L and D which will fit my data in the form mentioned in the title.
I want to fit a curved line, and not a surface.
I feel it should be fairly simple, but reading a few old answers also didn't help my case.
Is there some easy way to do this?
In case u want to see the data, here it is:
A = [0 0.06 0.12 0.44 0.56 0.94 1 1 0 0.04 0.58 0.74 0.86 1 1]
L = [100 100 100 100 100 100 100 100 43.7 49.7 56 61.5 65 77 93.8]
D = [11.3 10.1 8.9 8.5 8.1 7.7 6.5 5.3 5 5 5 5 5 5 5]
Thanks a lot.
More info:
I wrote the above equation as logA = xlogL + ylogD, and tried to use
X = [ones(size(logL)) logL logD];
b = regress(logA,X);
but Matlab didn't return any coefficients, it just gave b = NaN NaN NaN
댓글 수: 4
채택된 답변
Jos (10584)
2016년 2월 22일
nlm = fitnlm([L(:) D(:)], A, 'y~(x1^b1)*(x2^b2)',[0 0])
댓글 수: 2
Jos (10584)
2016년 2월 23일
I had the same outcome, so that's good. If you think you can come up with a better model you can fit that as well, of course. By the way, always plot your data, your fit and your residuals (fittedY - Y) to see how your model is doing.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!