Matlab produces complex number where it cannot be produced
3 ビュー (過去 30 日間)
古いコメントを表示
I have a problem with following code: Why complex numbers are generated?
k=4/3;
P0=1.00*10^5;
Req=69.2*10^(-3);
b=0.0016;
R=0.75*10^(-3);
P_R=P0*((Req^3-b*Req^3)/(R^3-b*Req^3))^k;
P_R2=P0.*((Req^3-b*Req^3)./(R^3-b*Req^3))^k;
P_R3=P0*((Req.^3-b*Req.^3)/(R^3-b*Req.^3)).^k;
P_R4=P0.*((Req.^3-b.*Req.^3)/(R.^3-b.*Req.^3)).^k;
0 件のコメント
採用された回答
Torsten
2022 年 11 月 23 日
編集済み: Torsten
2022 年 11 月 23 日
Because
(Req.^3-b.*Req.^3)/(R.^3-b.*Req.^3)
is negative.
If you use
k1 = 4;
k2 = 1/3;
P0=1.00*10^5;
Req=69.2*10^(-3);
b=0.0016;
R=0.75*10^(-3);
P_R=P0*(((Req^3-b*Req^3)/(R^3-b*Req^3))^k1)^k2
P_R2=P0.*(((Req^3-b*Req^3)./(R^3-b*Req^3))^k1)^k2
P_R3=P0*(((Req.^3-b*Req.^3)/(R^3-b*Req.^3)).^k1)^k2
P_R4=P0.*(((Req.^3-b.*Req.^3)/(R.^3-b.*Req.^3)).^k1)^k2
the problem will vanish.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Classical Control Design についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!