how to plot multiple curves in same figure
2 views (last 30 days)
Show older comments
I want to plot Id-vds curve for different length of Aln as it is mentioned as 'daln' in code. I have plotted for 1nm -daln, and need graph for different daln =1.2,3,4,5 nm .
This is the code for daln = 1nm
clear all;
E0=8.85e-12;
Ealgan=10.31;
talgan=23e-9;
calgan=(Ealgan/talgan);
dit=1.2e12;
q=1.6e-19;
gamma=(1/(1+dit*q/calgan));
nd=1.5e16;
daln=1e-9;
fim=(5.1*1.6e-19);
xaln=(1.9*1.6e-19);
fi0=(3.4*1.6e-19);
fis0=(gamma*(fim-xaln)-(gamma*q*nd*daln/calgan));
sigmapol=3.38e17;
sigmaaln=3.38e17;
Ealn=(10.78*E0);
detaEc=(0.343*1.6e-19);
Vt=fis0-detaEc-(sigmapol*q*daln/Ealn);
cq=3.436e15;
ceq=(calgan*cq/calgan+cq);
mu=0.09;
g=33.3;
Vds=0:0.5:6;
vgs=input('ENTER THE vgs in volts');
m=length(Vds);
for i=1:m
if vgs < Vt
current(1,i)=0;
current1(1,i)=0;
elseif Vds(i) >= (vgs - Vt)
current(1,i)=((mu*ceq/2)*(g)*(vgs-Vt)^2); %Simplified equation by approximation
elseif Vds(i) < (vgs - Vt)
current(1,i)=(mu*ceq/2)*(g)*(2*(vgs-Vt)*Vds(i)-Vds(i)^2);%Added DIBL
end
end
plot(Vds,current(1,:),'b')
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a hemt')
0 Comments
Answers (1)
Jan
on 17 Aug 2022
Create a loop:
axes('NextPlot', 'on'); % As: hold on
...
for daln = 1:5
...
end
3 Comments
Jan
on 17 Aug 2022
Try it. You cannot damage Matlab or the computer.
Set the axes() command e.g. on top of the code (after omitting the vrute clearing header "clear all", which is touzght in beginner lessons, but rarely useful in real programs).
Then replace the line
daln = 1;
by
for daln = 1:5
and insert
end
where you want to stop the loop.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!