フィルターのクリア

Problem in simulating if condition

1 回表示 (過去 30 日間)
SWASTIK SAHOO
SWASTIK SAHOO 2020 年 10 月 3 日
コメント済み: Alan Stevens 2020 年 10 月 3 日
When I am trying to simulate , it is only taking one codition. The other condition it is not taking.
gd=2;
Ecd=0.045;
k=8.617e-5;
ni=1e10;
T=linspace(0,600,100);
mee=0.553*9.11e-31;
meh=0.357*9.11e-31;
Nc=((2.510e19)*((0.553)^1.5).*((T/300).^1.5));
Nv=((2.510e19)*((0.357)^1.5).*((T/300).^1.5));
display(Nc)
display(Nv)
Nj=(Nc/gd).*(exp(-Ecd./(k.*T)));
display(Nj)
Nd=1e15;
Eg0=0.7437;
a=4.77e-4;
b=235;
Eg=Eg0-((a*(T.^2))./(T+b));
display(Eg)
ni=((sqrt(Nc.*Nv)).*(exp((-Eg)./(2*k.*T))));
if (T>300)
n=(Nd/2)+(sqrt(((Nd/2)^2)+(ni.^2)));
else
n=((Nj/2).*((sqrt(1+((4*Nd)./(Nj))))-1));
end
plot(T,n/Nd,'g','linewidth',2)
plot(T, ni/Nd,'--r','linewidth',2)
grid on
xlabel('Temperature in K')
ylabel('n/Nd')
title('Temp. dependence of Majority Carrier Concentration')
set(gca,'ylim',[0 3],'xlim', [0 610])
  2 件のコメント
SWASTIK SAHOO
SWASTIK SAHOO 2020 年 10 月 3 日
I am not getting the curve where it is increasing with temperature. I am only getting saturated value..
Thank you so much for your help.
gd=2;
Ecd=0.045;
k=8.617e-5;
ni=1e10;
T=linspace(0,600,100);
mee=0.553*9.11e-31;
meh=0.357*9.11e-31;
Nc=((2.510e19)*((0.553)^1.5).*((T/300).^1.5));
Nv=((2.510e19)*((0.357)^1.5).*((T/300).^1.5));
display(Nc)
display(Nv)
Nj=(Nc/gd).*(exp(-Ecd./(k.*T)));
display(Nj)
Nd=1e15;
Eg0=0.7437;
a=4.77e-4;
b=235;
Eg=Eg0-((a*(T.^2))./(T+b));
display(Eg)
ni=((sqrt(Nc.*Nv)).*(exp((-Eg)./(2*k.*T))));
if (T>300)
n=(Nd/2)+(sqrt(((Nd/2)^2)+ni.^2));
else
n=((Nj/2).*((sqrt(1+((4*Nd)./(Nj))))-1));
end
plot(T,n/Nd,'b','linewidth',2)
%plot(T,n1/Nd,'b','linewidth',2)
display(n)
display(n/Nd)
display(ni/Nd)
%plot(T,n/Nd,'b','linewidth',2)
hold on
plot(T, ni/Nd,'--r','linewidth',2)
%plot(T,n1/Nd,'b','linewidth',2)
hold off
grid on
xlabel('Temperature in K')
ylabel('n/Nd')
title('Temp. dependence of Majority Carrier Concentration')
set(gca,'ylim',[0 3],'xlim', [0 610])
legend('n/Nd', 'ni/Nd')
Alan Stevens
Alan Stevens 2020 年 10 月 3 日
編集済み: Alan Stevens 2020 年 10 月 3 日
I was too quick off the mark. You were right, your "if" functions don't work properly! See below.

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

採用された回答

Alan Stevens
Alan Stevens 2020 年 10 月 3 日
編集済み: Alan Stevens 2020 年 10 月 3 日
You can replace your if statement with
% Assuming there are 100 steps in T
nhi=(Nd/2)+(sqrt(((Nd/2)^2)+(ni(51:100).^2)));
nlo=((Nj(1:50)/2).*((sqrt(1+((4*Nd)./(Nj(1:50)))))-1));
n = [nlo, nhi];
Also replace
plot(T,n/Nd,'g','linewidth',2)
plot(T, ni/Nd,'--r','linewidth',2)
with
plot(T,n/Nd,'g','linewidth',2)
hold on
plot(T, ni/Nd,'--r','linewidth',2)
if you want both curves on the same plot.
The following is the result
  2 件のコメント
SWASTIK SAHOO
SWASTIK SAHOO 2020 年 10 月 3 日
Do I need to prespecify nhi, nlo???It is showing Unrecognized variable or function "nhi"
Alan Stevens
Alan Stevens 2020 年 10 月 3 日
Like so:
gd=2;
Ecd=0.045;
k=8.617e-5;
%
%ni=1e10;
T=linspace(0,600,100);
mee=0.553*9.11e-31;
meh=0.357*9.11e-31;
Nc=((2.510e19)*((0.553)^1.5).*((T/300).^1.5));
Nv=((2.510e19)*((0.357)^1.5).*((T/300).^1.5));
% display(Nc);
% display(Nv);
Nj=(Nc/gd).*(exp(-Ecd./(k.*T)));
% display(Nj);
Nd=1e15;
Eg0=0.7437;
a=4.77e-4;
b=235;
Eg=Eg0-((a*(T.^2))./(T+b));
% display(Eg);
ni=((sqrt(Nc.*Nv)).*(exp((-Eg)./(2*k.*T))));
% Assuming there are 100 steps in T
nhi=(Nd/2)+(sqrt(((Nd/2)^2)+(ni(51:100).^2)));
nlo=((Nj(1:50)/2).*((sqrt(1+((4*Nd)./(Nj(1:50)))))-1));
n = [nlo, nhi];
plot(T,n/Nd,'g','linewidth',2)
hold on
plot(T, ni/Nd,'--r','linewidth',2)
grid on
xlabel('Temperature in K')
ylabel('n/Nd')
title('Temp. dependence of Majority Carrier Concentration')
set(gca,'ylim',[0 3],'xlim', [0 610])

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFilter Banks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by