VGS_off=-3.0 #Gate-source cutoff voltage(V)
IDSS=6 #IDSS current(mA)
VGS1=-1 #VGS voltage(V)
VGS2=-2
VGS3=0
VGS4=1
VGS5=2
ID1=IDSS*((1-(VGS1/VGS_off))**2)
ID2=IDSS*((1-(VGS2/VGS_off))**2)
ID3=IDSS*((1-(VGS3/VGS_off))**2)
ID4=IDSS*((1-(VGS4/VGS_off))**2)
ID5=IDSS*((1-(VGS5/VGS_off))**2)
print 'Drain current ID1 = ',round(ID1,2),'mA'
print 'Drain current ID2 = ',round(ID2,2),'mA'
print 'Drain current ID3 = ',ID3,'mA'
print 'Drain current ID4 = ',round(ID4,2),'mA'
print 'Drain current ID5 = ',round(ID5,2),'mA'
VGS_off=-2.0 #Gate-source cutoff voltage(V)
IDSS=4 #IDSS current(mA)
gm0=2000*10**-6 #transconductance(S)
VGS=0 #VGS voltage(V)
VDD=15 #Drain supply voltage(V)
RD=2.0 #Drain resistance(KOhm)
RL=10.0 #Load resistance(KOhm)
Vin=20 #input voltage(mV)
VDS=VDD-(IDSS*RD) #Drain-source voltage(V)
rd=RD*RL/(RD+RL) #ac drain resistance(KOhm)
Av=gm0*rd*1000 #voltage gain
Vout=Vin*Av #output voltage (mV)
print 'Output voltage Vout = ',round(Vout,2),'mV'
VGS_on=4.5 #Gate-source voltage(V)
ID_on=75 #ID current(mA)
RDS=6 #Ohmic resistance(Ohm)
VDD=20 #Drain supply voltage(V)
RD=1.0 #Drain resistance(KOhm)
RL=10.0 #Load resistance(KOhm)
ID_sat=VDD/RD #drain saturation current(mA)
Vout1=VDD*(RDS/(RDS+(RD*1000)))#output voltage when VGS is high(V)
Vout2=VDD #output voltage when VGS is low(V)
print 'output voltage when VGS is high = ',round(Vout1,2),'V'
print 'output voltage when VGS is low = ',Vout2,'V'
ID=20 #ID current as per previous example(mA)
Vled=2 #Led drop(V)
RD=1.0 #Drain resistance(KOhm)
ID=(VDD-Vled)/RD #drain current considering LED drop
print 'drain current considering LED drop ID = ',ID,'mA'
Rrc=500.0 #Resistance of relay(V)
VDD=24 #drain supply voltage(V)
ID_sat=VDD/Rrc #drain saturation current(A)
print 'Drain saturaion current ID(sat) = ',ID_sat*1000,'mA'
VDD=20.0 #drain supply voltage (V)
RD=10*10**3 #drain resistance(Ohm)
RDS=50.0 #Ohmic resistance(Ohm)
Vout1=VDD #Output voltage when i/p is low (V)
Vout2=VDD*RDS/(RDS+RD) #Output voltage when i/p is high (V)
print 'Output voltage when input is low Vout1 = ',Vout1,'V'
print 'Output voltage when input is high Vout2 = ',round((Vout2*1000),2),'mV'
VDD=10.0 #drain supply voltage (V)
RD=2*10**3 #drain resistance(Ohm)
RDS=500.0 #Ohmic resistance(Ohm)
Vout1=VDD #Output voltage when i/p is low (V)
Vout2=VDD*RDS/(RDS+RD) #Output voltage when i/p is high (V)
print 'Output voltage when input is low Vout1 = ',Vout1,'V'
print 'Output voltage when input is high Vout2 = ',Vout2,'V'
import matplotlib.pyplot as plt
%matplotlib inline
print 'Input signal switches from 0 to 15 V at pt. A & 15 to 0 V at pt. B'
x=[1,2,3,4,5,6,7,8,9,10]
y=[0,0,0,15,15,15,15,0,0,0]
print 'approximate plotting shown in figure'
plt.plot(x,y)
plt.show()
print 'output signal shown on second plot'
z=[15,15,15,0,0,0,0,15,15,15]
plt.plot(x,z,'r')
plt.show()
VDD=30.0 #drain supply voltage (V)
RD=30 #drain resistance(Ohm)
RDS=1.95 #Ohmic resistance(Ohm)
ID_on=2 #ID for MOSFET on (A)
ID_sat=VDD/RD #drain saturation current(A)
ID=VDD/(RDS+RD) #drain current(A)
print 'current through motor winding is ID = ',round(ID,2),'A'
VDD=30.0 #drain supply voltage (V)
RD=10 #drain resistance(Ohm)
RDS=1.07 #Ohmic resistance(Ohm)
ID_on=5 #ID for MOSFET on (A)
ID_sat=VDD/RD #drain saturation current(A)
ID=VDD/(RDS+RD) #drain current(A)
print 'current through lamp is ID = ',round(ID,2),'A'
VDD=10.0 #drain supply voltage (V)
RD=10 #drain resistance(Ohm)
RDS=0.5 #Ohmic resistance(Ohm)
ID_on=5 #ID for MOSFET on (A)
ID=VDD/(RDS+RD) #drain current(A)
print 'current through water valve is ID = ',round(ID,2),'A'
VDD=30.0 #drain supply voltage (V)
RD=10 #drain resistance(Ohm)
RDS=1.07 #Ohmic resistance(Ohm)
R1=2*10**6 #Resistance1 at gate (Ohm)
R2=1*10**6 #Resistance2 at gate (Ohm)
C=10*10**-6 #Capacitance at gate(F)
RTH=R1*R2/(R1+R2) #Thevenin resistance(Ohm)
RC=RTH*C #RC Time constant(s)
ID=VDD/(RDS+RD) #drain current through lamp(A)
P=(ID**2)*RD #Lamp Power(W)
print 'RC Time constant = ',round(RC,2),'s'
print 'current through lamp is ID = ',round(ID,2),'A'
print 'Lamp power P = ',round(P,2),'W'
ID_on=0.6 #ID for MOSFET on (A)
VGS_on=4.5 #VGS for MOSFET on(V)
VGS_th=2.1 #VGS threshold(V)
VGS1=3 #Gate-source voltage1(V)
VGS2=4.5 #Gate-source voltage2(V)
k=ID_on/(VGS_on-VGS_th)**2 #constant(A/V2)
ID1=1000*k*(VGS1-VGS_th)**2 #ID for VGS=3 (mA)
ID2=1000*k*(VGS2-VGS_th)**2 #ID for VGS=4.5 (mA)
print 'ID1 (for VGS = 3V) = ',round(ID1,2),'mA'
print 'ID2 (for VGS = 4.5V) = ',ID2,'mA'
ID_on=3 #ID (On) (mA)
VDS_on=10 #VDS(On) (V)
VDD=25 #Drain supply voltage (V)
RD=(VDD-VDS_on)/ID_on #Drain resistance(KOhm)
print 'Drain resistance RD = ',RD,'KOhm'
ID_on=600 #ID (On) (mA)
VGS_th=2.1 #VGS(threshold) (V)
VDD=12 #Drain supply voltage (V)
k=104*10**-3 #constant(A/V2)
R1=1.0*10**6 #Resistance1 at gate (Ohm)
R2=350.0*10**3 #Resistance2 at gate (Ohm)
Vin=100.0*10**-3 #input voltage (V)
RD=68.0 #Drain resistance(Ohm)
RL=1.0*10**3 #Load resistance(Ohm)
VGS=VDD*R2/(R1+R2) #Gate-source voltage(V)
ID=1000*k*(VGS1-VGS_th)**2 #Drain current (mA)
gm=2*k*(VGS-VGS_th) #transconductance (S)
rd=RD*RL/(RD+RL) #ac drain resistance(Ohm)
Av=gm*rd #voltage gain
Vout=Vin*Av #Output voltage (V)
print 'Gate-source voltage VGS = ',round(VGS,2),'V'
print 'transconductance gm = ',round((gm*1000),2),'mS'
print 'Ac drain resistance rd = ',round(rd,2),'Ohm'
print 'voltage gain Av = ',round(Av,2)
print 'Output voltage Vout = ',round(Vout,2),'V'