will fsolve/lsqnonlin and excel solver give the same solution to non linear least squares estimation?
3 次查看(过去 30 天)
显示 更早的评论
hi, i hope someone can clear my doubt.
I have a function S(x)= a1 exp(-exp[(x/b1)^g1]) + a2 exp(-cosh[(x/b2)^g2]). There is one constraint where a1<a2. I only have x values and S(x) values. Hence i have 6 unknown parameters to solve via non linear least squares estimation, minimising [S(x)-S(x_hat)]^2. I used Excel Solver to find an answer that converge when it is less than 1E-6. But in Matlab, what is the default where the iteration produces convergence? 1E-6? 1E-8? or something else? I have different values for the estimated parameters in both Excel and Matlab.
Thanks in advance for replying.;)
0 个评论
回答(1 个)
Matthias Walle
2016-10-6
You can use optimoptions function to set the step size tolerance and other performance characteristics to fsolve
For instance, your code might change to:
opts = optimoptions('fsolve', 'TolFun', 1E-8, 'TolX', 1E-8);
[B,fval] = fsolve(@(b) myfun(b,x,y), b0, opts);
you can use this to compare your results.
Hope this helped you,
Matthias
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!