## Sunday, December 23, 2012

### MATLAB code for n-channel enhancement MOSFET with early effect

Enhancement mode MOSFET is influenced by early effect that arises in short channel devices. Since we are dealing with 180nm technology the devices are prone to short channel effects. This channel length modulation introduces an additional term in the MOSFET equation. It’s represented as ‘λ’ but is different from the device parameter used for expressing sizes of transistor parts. It’s the inverse of early voltage. The implication can be understood by observing the output characteristics. The curve influence by channel length modulation will develop a slope corresponding to the early voltage in the saturation region of the output characteristic of the NMOSFET. This video gives a better explanation to the working of MOSFET and guides you through the implementation of code and interpretation of graphs.

MATLAB CODE

%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')

OUTPUT CHARACTERISTICS
In this graph, the early voltage is 200V. So the effect is higher than the case following this. The output characteristics have been highly modified with the help og graph editor in MATLAB to help viewers explore them.
In this graph the early voltage is 1000 V. Therefore, the curve is not so sloppy. This is the original appearance of the output curve without any modification. In other words, this curve obeys the code!