force fsolve termination if not progressing

1 次查看(过去 30 天)
Hi.
I'm running repeated fsolves. With bad starting points, the engine goes nowhere. I can see this looking at the output when Display is set to iter: norm of step keeps shrinking and f fails to improve. Is there a way to pass the information that Display('iter') uses to the "myfun" workspace (i.e., the function that I'm trying to solve), thus allowing me to measure if I'm making no progress and then terminate? I could of course hack into fsolve but but obviously would prefer not to if I don't have to.

采纳的回答

Alan Weiss
Alan Weiss 2014-7-21
Use an output function to terminate the iterations early, if you like.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 个评论
Leo Simon
Leo Simon 2014-7-21
Wonderful, exactly what I've wanted for years... thanks very much, Alan
Leo Simon
Leo Simon 2014-7-22
It would be really nice if one could condition on exitflag in state 'done'. For example, I would like to plot the history of various fields of optimValue, but only if exitflag is <= 0. (After all, no need to try to debug if exitflag=1). But by default, at least, the output function doesn't seem to know what exitflag is in state 'done', (which seems very odd). So my question is, is there a way to pass exitflag to my output function?
Thanks! Leo

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by