필터 지우기
필터 지우기

Problem in simulating if condition

조회 수: 2 (최근 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 CenterFile Exchange에서 Filter Banks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by