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.;)

回答(1 个)

Matthias Walle
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

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by