Problem using lscurvefit - 'Initial point is a local minimum'
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am attempting to fit a complicated function using lscurvefit. The function I am attempting to fit looks like this:
xdata./(
(3*x(1)./(1.28*xdata.^0.46).^2)
+ (((4.178*(x(2)-0.418*x(1)))./(1.28*xdata.^0.46)).*(1-xdata).^(1/3))
+ (6.806 * (x(2) - 1.588 * x(1)) * (1-xdata).^(2/3))
)
where xdata is on the order of 1e-3 and the output of the function is on the order of 1e-7 to 1e-6, always increasing. The constants I am attempting to solve for, x(1) and x(2), will be between 0 and 60, so my initial vector x0 is [30 30].
The code I am using looks like this:
options = optimset('TolX',1e-6, 'TolFun',1e-6);
lb = [0 0];
ub = [99 99];
fcn = @(x,xdata) [the above function]
x0 = [30 30];
xsolve = lsqcurvefit(fcn,x0,eps,kdim,lb,ub,options);
I am told no matter what my initial guess is that my function is already at an optimum. I am assuming that there is something happening with the scaling in this problem, but I am having a hard time seeing where it is, as the solution vector does appear to be well scaled for a solution. I have tried changing TolX and TolFun to see if I could find a meaningful solution, but to no avail.
If anyone can offer some advice, it would be much appreciated.
Thank you
0 Kommentare
Antworten (1)
Torsten
am 9 Mär. 2018
Try to fit 1/kdim against the inverse of your function f.
After rearranging you'll see that 1/f takes the form
1/f = f1(eps)*x(1)+f2(eps)*x(2).
To get optimum x(1) and x(2), just do
xsol = [f1(eps) f2(eps)]\(1./kdim)
At least xsol can be used as a good starting guess for a nonlinear fit.
Best wishes
Torsten.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!