Why does my objective function return complex?
古いコメントを表示
I have a likelihood function that I need to minimize. I use fmincon to search for the minimum. Iterations of fmincon sometimes show "Objective function returned complex; trying a new point…" But in my code I do not take square root of any variable. Why am I then getting this error? A second question is whether there is a counterpart of
dbstop if naninf
for "complex" like the
dbstop if complex
command? Or would
dbstop if error
do?
2 件のコメント
Torsten
2022 年 2 月 28 日
log(x), x^a and sqrt(x) are the most common sources to get complex numbers.
David Goodmanson
2022 年 2 月 28 日
also asin and acos
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!