フィルターのクリア

fmincon - How to suppress warnings during gradient estimation?

9 ビュー (過去 30 日間)
Rosi Marungu
Rosi Marungu 2018 年 8 月 23 日
コメント済み: Rosi Marungu 2018 年 8 月 24 日
Fmincon estimates the gradient numerically. While doing so it sometimes gets close to the parameter bounds which causes my objective function to invert a lot of nearly singular matrices (and produce the respective warning).
How can I suppress warnings during numerical compuation of the gradient with the fmincon solver?

回答 (1 件)

Adam Danz
Adam Danz 2018 年 8 月 23 日
編集済み: Adam Danz 2018 年 8 月 23 日
To suppress warnings you first need the warning ID. To get the ID, run these two lines right after receiving the warning.
w = warning('query','last')
id = w.identifier;
Then you can turn it off, run the code, and turn it back on.
warning('off',id)
% code
warning('on',id)
Note that if your code is stopped prior to tuning it back on, obviously it won't be turned back on. Some people use try/catch to get around that.
More info
  3 件のコメント
Walter Roberson
Walter Roberson 2018 年 8 月 23 日
That does not exist.
Rosi Marungu
Rosi Marungu 2018 年 8 月 24 日
Thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by