Why is Zero teh result of division?

8 ビュー (過去 30 日間)
Erkan
Erkan 2021 年 2 月 8 日
コメント済み: Alan Stevens 2021 年 2 月 9 日
Hi every body, in my program, inside the for loop, results of many division operations (twe, teg and twg) on the command window are showing the zero, but this variable values are not showing the zero in the workspace (right values are showing in workspace).
Nw(1)=0; Ne(1)=0; Ng(1)=0;
Nw(2)=-2.3930e+47; Ne(2)=2.1796e+47; Ng(2)=2.1796e+46;
B2=314.1593;
B4= 314.1593;
Ges=15.6252;
Ggs=15.6252;
Nl=5;
Nd=10e11;
Aw=1.35e+10;
Cw=5e-9;
Ae=1.5e+10;
Ce=9e-8;
ue=4;
uw=10;
ug=2;
Pwleff =2.7037e+34;
Kb*T =0.0259
Length=2.45e-1;
Width=12e-4;
Ees=0.84;
Egs=0.792;
Ewl=1.05;
loop2=2;
for d=1:loop2
Pes(d)=(Ne(d)/(ue*Nd*Width*Length*Nl*Ges))
Pgs(d)=(Ng(d)/(ug*Nd*Width*Length*Nl*Ggs))
twe(d)=1/((Aw+(Cw*Nw(d)))*(1-Pes(d))*Ges)
teg(d)=1/((Ae+(Ce*Nw(d)))*(1-Pgs(d)))
twg(d)=1/((Aw+(Cw*Nw(d)))*(1-Pgs(d))*Ggs)
tge(d)=(teg(d)*(ug/ue)*(exp((Ees-Egs)/(Kb*T))))
tew(d)=(twe(d)*((ue*Nd*Nl)/Pwleff)*(exp((Ewl-Ees)/(Kb*T))))
tgw(d)=(twg(d)*((ug*Nd*Nl)/Pwleff)*(exp((Ewl-Egs)/(Kb*T))))
end

採用された回答

Alan Stevens
Alan Stevens 2021 年 2 月 9 日
編集済み: Alan Stevens 2021 年 2 月 9 日
Type
format shorte
in the command window before running the code.
  2 件のコメント
Erkan
Erkan 2021 年 2 月 9 日
Thank you so much for answer, but the twe, teg and twg values in 3rd iteration of the loop become NaN. I don't understand what is the problem.
Alan Stevens
Alan Stevens 2021 年 2 月 9 日
3rd iteration? You just be running a different version of the code from that listed originally.

サインインしてコメントする。

その他の回答 (1 件)

Erkan
Erkan 2021 年 2 月 9 日
again hi, actually, the number of iteration must be 3000, but to find the problem i try the small iteration numbers
  1 件のコメント
Alan Stevens
Alan Stevens 2021 年 2 月 9 日
You don't say what values you are using for Nw(3), Ne(3) and Ng(3).

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by