Is there any way to exclude the complex values of the iterations with lsqnonlin ?
7 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Matt J
2014 年 9 月 16 日
編集済み: Matt J
2014 年 9 月 16 日
Just to be clear, the complex numbers are being introduced by the objective function that you have provided, not code elsewhere in lsqnonlin.
Make sure that your objective is not executing expressions like log(z) for negative z and similar things like that. If you have regions like that where the objective function is undefined, you should set the value there to NaN or Inf and you should probably use fmincon to do the optimization instead, with the sqp algorithm. The sqp algorithm has the capability of course-correcting when it strays into regions of NaNs or Infs in the objective or constraints.
4 件のコメント
その他の回答 (1 件)
Jurgen
2014 年 11 月 15 日
編集済み: Jurgen
2014 年 11 月 15 日
2 件のコメント
Matt J
2014 年 11 月 15 日
編集済み: Matt J
2014 年 11 月 15 日
I don't see how you would have tried any of those. lsqnonlin doesn't handle nonlinear inequalities while Newton Raphson doesn't support inequality constraints of any kind.
Any of the fmincon formulations, using the sqp algorithm, that we were discussing should work, so long as a solution does indeed, exist. If an exact solution doesn't exist, you will have to compromise and accept a least squares solution. In that case, you need to decide which of your equations/inequalities need to be exactly satisfied and which you can relax.
参考
カテゴリ
Help Center および File Exchange で Systems of Nonlinear Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!