multi Exponential regression method

조회 수: 10 (최근 30일)
minsung park
minsung park 2017년 4월 7일
편집: John D'Errico 2017년 4월 7일
I work regression about a number of data. so I use matlab fuction : fit(x,y,exp2) but, I wonder that How do get a, b, c, d of f(x)=a*exp(bx)+c*exp(dx).

답변 (2개)

Torsten
Torsten 2017년 4월 7일
If you use
f=fit(x,y,exp2)
f is automatically shown after execution.
Best wishes
Torsten.

John D'Errico
John D'Errico 2017년 4월 7일
편집: John D'Errico 2017년 4월 7일
For example:
mdl = fit(rand(100,1),rand(100,1),'exp2')
mdl =
General model Exp2:
mdl(x) = a*exp(b*x) + c*exp(d*x)
Coefficients (with 95% confidence bounds):
a = -1101 (-9.55e+11, 9.55e+11)
b = 0.9633 (-1.213e+05, 1.213e+05)
c = 1102 (-9.55e+11, 9.55e+11)
d = 0.963 (-1.213e+05, 1.213e+05)
The coefficients themselves in this case are total garbage, because my data was just random numbers. The massively wide confidence bounds reflect that fact.
Regardless, you can see the values there. But they are printed only to a few significant digits. NEVER just take those numbers as is and try to use them. You need the full values of the coefficients, if you will use them. So, how do you extract the values themselves as numbers?
When you have no idea what applies to a class, then look at methods. It will tell you. First, we can see that mdl is an object of class cfit.
whos mdl
Name Size Bytes Class Attributes
mdl 1x1 1198 cfit
What methods apply to that class?
methods(mdl)
Methods for class cfit:
argnames coeffnames dependnames fitoptions integrate numcoeffs probnames type
category coeffvalues differentiate formula islinear plot probvalues
cfit confint feval indepnames numargs predint setoptions
So, clearly coeffvalues will be of use here. If you are not sure, then use the help:
help cfit/coeffvalues
coeffvalues Coefficient values.
coeffvalues(FUN) returns the values of the coefficients of the
CFIT object FUN as a row vector.
See also cfit/probvalues, fittype/formula.
YEP. coeffvalues is what you need.
format long g
coeffvalues(mdl)
ans =
-1101.27586379757 0.963250512625987 1101.7626267532 0.96297061650439
When you have a problem, the help is there to serve your needs. Use it.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by