fminsearch finds local minimum when fminunc does not?

36 views (last 30 days)
Hi everyone,
I know the difference between fminsearch and fminunc has been discussed many times, but I am facing the following problem (minimization of an error function through 1 or 2 variables) : for my problem, fminsearch finds a local minimum while fminunc does not at all (stopping with initial guess...). Of course, I compared the two behaviors by just replacing the optim function names, with exactly the same starting guess and no additional options... I would be happy with fminsearch, but then I need to be able to define constraints and then use fmincon, so if at first fminunc does not work...
I tried it on Matlab 2008 and Matlab 2013... Same behavior!
Any idea?
Thanks,
Pascal

Accepted Answer

Alan Weiss
Alan Weiss on 16 Oct 2013
Edited: Alan Weiss on 16 Oct 2013
Perhaps you are minimizing a simulation or differential equation. This section of the documentation explains why fminunc can have trouble with this kind of minimization, and gives some suggestions. In particular, you might need to take bigger finite difference steps (set DiffMinChange to 1e-3 or so).
Alan Weiss
MATLAB mathematical toolbox documentation
  1 Comment
Pascal
Pascal on 17 Oct 2013
Edited: Pascal on 17 Oct 2013
Thank you!
I changed DiffMinChange to 1e-3 and it works well!
After reading this interesting section of documentation, I will also have a look at patternsearch which I didn't know before and seems to fit my problem...

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!