Clear Filters
Clear Filters

fminunc not to stop even if it does not converge in one or more of 1000 replications of a simulation

1 view (last 30 days)
Hi, I have a simulation of 1000 replications including two optimizations each using fminunc. In some of the cases, one of the optimizations does not converge and the code stops. I want to modify the code so that it continues even if it does not converge for some replications. How can I do this?

Accepted Answer

Alan Weiss
Alan Weiss on 3 Jul 2013
I am not sure what you are asking. Do you want fminunc to continue to iterate even if it stopped without converging? If so, please let us see the exit message so we can understand why fminunc stopped. Also, you might get better advice if you show us your options and the call to fminunc.
If, however, you are looking for programming advice on how to handle conditions when a subroutine fails, then I think you simply need to unedrstand try/catch or other exception handling.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!