From: Yu Li on 14 Jul 2010 13:07 Hi, I am running into problem with fsolve this time. The exit code is mostly 2 with a few exceptions, which gives an exit code of 3. I tried the trust-region-reflective algorithm and it didn’t help. I also tried the levenberg-marquardt algorithm and about half of the time the root converges but the other half got an exitflag of -3. Below is the option I used for fsolve: options = optimset('algorithm','levenberg-marquardt','Display','iter','Jacobian','on','TolFun',... 1.0e-32,'TolX',2*eps(x(1))); Any ideas or suggestions? Thank you very much.
From: Alan Weiss on 14 Jul 2010 14:29 On 7/14/2010 1:07 PM, Yu Li wrote: > Hi, > > I am running into problem with fsolve this time. The exit code is mostly > 2 with a few exceptions, which gives an exit code of 3. I tried the > trust-region-reflective algorithm and it didn’t help. I also tried > the levenberg-marquardt algorithm and about half of the time the root > converges but the other half got an exitflag of -3. Below is the option > I used for fsolve: options = > optimset('algorithm','levenberg-marquardt','Display','iter','Jacobian','on','TolFun',... > > 1.0e-32,'TolX',2*eps(x(1))); > Any ideas or suggestions? Thank you very much. You should never set TolFun to be less than eps. You probably shouldn't set it to be less than 1e-14. Same for TolX. For more suggestions, see http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/br44iv5.html Alan Weiss MATLAB mathematical toolbox documentation
From: Yu Li on 14 Jul 2010 15:22 Hi, Thank you very much for your suggestion. I have to set the tolerance very small because there are small numbers involved, something in the order of 1e-13. I will read the link you gave me. Thanks again. Best Yu Alan Weiss <aweiss(a)mathworks.com> wrote in message <i1kvmu$5o2$1(a)fred.mathworks.com>... > On 7/14/2010 1:07 PM, Yu Li wrote: > > Hi, > > > > You should never set TolFun to be less than eps. > You probably shouldn't set it to be less than 1e-14. > Same for TolX. > > For more suggestions, see > http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/br44iv5.html > > Alan Weiss > MATLAB mathematical toolbox documentation
|
Pages: 1 Prev: Copy formatted Excel lines from Matlab prompt Next: fzero probably easy fix |