%  This script runs an example for a load line analysis
%  with a MOSFET.  The function nmos.m is needed to run this script

%  Set Parameters
K=.2; vto = 2.1;
W=1; L=1; KP=2*K;
VDD=12;  RS=1e3; RD=1e3;
vds = [0:.05:VDD];  %  Create X-Axis
idsll = -vds/(RD+RS) + VDD/(RD+RS);  %  Generate Load Line
plot(vds,idsll,'k:')
hold on   %  hold plot to superimpose other plots 
ids50 = nmos(vds,vto+70e-3,KP,W,L,vto);  % TC for 70mV above threshold
plot(vds,ids50,'r')
ids50 = nmos(vds,vto+110e-3,KP,W,L,vto);  % TC for 110mV above threshold
plot(vds,ids50,'c')
ids50 = nmos(vds,vto+150e-3,KP,W,L,vto);  % TC for 150mV above threshold
plot(vds,ids50,'b')
xlabel('VDS in Volts')
ylabel('ID in Amps')
hold off
