how to select proper parameters for "opt.StartPoint" ?

조회 수: 5 (최근 30일)
vx2008
vx2008 2014년 9월 22일
댓글: vx2008 2014년 9월 22일
I want to fit some data as below code:
if true
p=fittype('a+k*b/(b+x)','independent','x');
opt=fitoptions(p);
opt.StartPoint=[1e-8,0.5,1e-8];
f=fit(x,y,p,opt)
Y=f(x);
corrcoef(y,Y)
end
when I delete the code "opt=fitoptions(p);opt.StartPoint=[1e-8,0.5,1e-8];", I get the value of "a", "b", and "k" as below:
General model:
f(x) = a+k*b/(b+x)
Coefficients:
a = 6.611e-08
b = 0.4854
k = 5.829e-08
then I add the code "opt=fitoptions(p);opt.StartPoint=[1e-8,0.5,1e-8];", and then I get the values as below:
General model:
f(x) = a+k*b/(b+x)
Coefficients:
a = 1e-08
b = 0.5
k = 1e-08
I don't know why "a","b" and "k" never change? and how shall I set "opt.StartPoint" properly?
thank you!

답변 (1개)

Matt J
Matt J 2014년 9월 22일
편집: Matt J 2014년 9월 22일
It's possible the solution is simply unstable because you have bad data. For example, if all your y-data are very close to zero (as compared to x), then clearly any solution with a and b*k close to zero will give a reasonable fit.
If it is a matter of the initial guess, though, you might be able to generate a better one by re-arranging the model equation in linear form. In other words, starting with the model equation,
y=a +b*k/(x+b)
re-arrange as,
a*x -b*y + a*b + b*k =x.*y
and re-parametrize this as
A*x + B*y + C =x.*y
Solve the linear equations for [A;B;C],
ABC = [x(:),y(:), ones(length(x),1)]\[x(:).*y(:)];
A=ABC(1);
B=ABC(2);
C=ABC(3);
a=A;
b=-B;
k=(C-a*b)/b;
Now, use this preliminary solution as a start point for the fit,
opt.StartPoint=[a,b,k];

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by