will you please tell me why am i not getting the graph?
1 view (last 30 days)
Show older comments
if true
hfin=1;
tsi=20
W=2*hfin*tsi;
Vth=1;
Leff=180;
DIBL=1.127*(W\Leff);
vth=Vth-DIBL;
lambda=25*10^-5;
un=100;
Cox=1;
ld=0.1;
Ec=1;
vgs=2;
for vds=1:4;
Ids(vds)=(2*W*un*Cox/Leff-ld+(vds/Ec))+(lambda*2*W*Cox/(Leff-ld)^2)*((vgs-Vth)*vds-0.5*vds^2);
end
plot(Ids,vds)
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a MOSFET')
end
2 Comments
ES
on 6 Jan 2014
and the reason why your code does not give a plot is because you have used vds in the loop variable. when the loop exits, vds is = 4. so the plot is essentially (Ids,4) which is not something you want. You want plot of (Ids, 1:4).
make it this way,
if true
hfin=1;
tsi=20
W=2*hfin*tsi;
Vth=1;
Leff=180;
DIBL=1.127*(W\Leff);
vth=Vth-DIBL;
lambda=25*10^-5;
un=100;
Cox=1;
ld=0.1;
Ec=1;
vgs=2;
for vds=1:4;
Ids(vds)=(2*W*un*Cox/Leff-ld+(vds/Ec))+(lambda*2*W*Cox/(Leff-ld)^2)*((vgs-Vth)*vds-0.5*vds^2);
end
vds=1:4;%New line for making vds=[1,2,3,4] instead of vds=4;
plot(Ids,vds)
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a MOSFET')
end
Answers (2)
ES
on 6 Jan 2014
TRY THIS:
%n-channel enhancement mode MOSFET output characteristics
clear all;
%kn=un*cox = 100 microA/Volts
kn=1e-4;
%Let W/L= 2
W=360*(10^(-9));
L=180*(10^(-9));
beta=kn*W/L;
%Vth is the threshold voltage
Vth=1;
%lambda is the inverse of early voltage in voltage inverse
lambda=1/1000;
%Sweep drain to source voltge from 0 to 10V
vds=0:0.5:10;
%Ask the user to enter gate to source voltage
vgs=input('ENTER THE Vgs in volts');
%Estimate length of the array
m=length(vds);
for i=1:m
if vgs < Vth
current(1,i)=0;
current1(1,i)=0;
elseif vds(i) >= (vgs - Vth)
current(1,i)=0.5* beta * ((vgs - Vth)^2)*(1+lambda*vds(i));
current1(1,i)=0.5* beta * ((vgs - Vth)^2);
elseif vds(i) < (vgs - Vth)
current(1,i)= beta*((vgs-Vth)*vds(i) - 0.5*(vds(i)^2))*(1+lambda*vds(i));
current1(1,i)=beta*((vgs-Vth)*vds(i) - 0.5*(vds(i)^2));
end
end
plot(vds,current(1,:),'b',vds,current1(1,:),'r')
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a MOSFET')
or THIS
%n-channel enhancement mode MOSFET output characteristics
clear all;
%kn=un*cox = 100 microA/Volts
kn=1e-4;
%Let W/L= 2
W=360*(10^(-9));
L=180*(10^(-9));
beta=kn*W/L;
%Vth is the threshold voltage
Vth=1;
%Sweep drain to source voltge from 0 to 10V
vds=0:0.5:10;
%Ask the user to enter gate to source voltage
vgs=input('ENTER THE Vgs in volts');
%Estimate length of the array
m=length(vds);
for i=1:m
if vgs < Vth
current(1,i)=0;
elseif vds(i) >= (vgs - Vth)
current(1,i)=0.5* beta * (vgs - Vth)^2;
elseif vds(i) < (vgs - Vth)
current(1,i)= beta*((vgs-Vth)*vds(i) - 0.5*(vds(i)^2));
end
end
plot(vds,current(1,:),'b')
xlabel('Vds, V')
ylabel('Drain Current,A')
title('I-V Characteristics of a MOSFET')
3 Comments
ES
on 6 Jan 2014
I have modified your code at the top too.. Please have a look at it.. It is a small change anyway..
kajal sharma
on 5 Mar 2022
this program is not run it showing the error in enter the vgs value
0 Comments
See Also
Categories
Find more on Semiconductors and Converters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!