필터 지우기
필터 지우기

fmincon - How to suppress warnings during gradient estimation?

조회 수: 10 (최근 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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver 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