In spite of being real, I get the error: Warning: Imaginary parts of complex X and/or Y arguments ignored.
3 ビュー (過去 30 日間)
古いコメントを表示
Hi every one. I have a system of ODE. My solution is real (isreal (A_ODE)=1), but I get this error: Warning: Imaginary parts of complex X and/or Y arguments ignored. Actually I expected the steady- state soIution but I got unstable system. I dont know, is this error massage affected on the answer or not I attached the code and really appreciate any help.
thanks in advance
LaserODE
0 件のコメント
回答 (1 件)
Walter Roberson
2022 年 5 月 6 日
dNis = Nis - Nth;
Ais = sqrt((AInj^2 - gammaN/gammaP*dNis)/(1 + g*dNis/gammaP));
dNis is negative.
That makes the numerator for the next line a value minus a negative value, which is positive, so the numerator is okay.
But with dNis being sufficiently negative, the denominator is negative, so overall you are taking square root of a negative value.
phi_Tr = zeros(size(A_Tr));
You do not assign any other value to phi_Tr, so phi_Tr is all zero at the time you semilogy(), which means you are trying to plot the log of 0.
3 件のコメント
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!