#Exa 7.1
#What is Resistance between gate and source
#given data
VGS=10 #in Volt
IG=0.001 #in uA
IG=IG*10**-6 #in A
#calculation
RGS=VGS/IG #in ohm
#result
print"Resistance between gate and source is ",RGS/10**6,"ohm"
#Exa 7.2
#What is AC drain resistance of JFET
#given data
delVDS=1.5 #in Volt
delID=120 #in uA
delID=120*10**-6 #in A
#Calculation
rd=delVDS/delID #in Ohm
#Result
print"AC drain resistance of JFET in Kohm ",rd*10**-3,"kohm"
#Exa 7.3
#Determine Transconductance
import math
#given data
VP=-4.5 #in Volt
IDSS=10.0 #in mA
IDS=2.5 #in mA
#Calculation
VGS=VP*(1-math.sqrt(IDS/IDSS)) #in Volt
gm=(-2*IDSS/VP)*(1-VGS/VP) #in mA/Volt
#Result
print"Transconductance is",round(gm,2),"mA/v"
#Exa 7.4
#calculate Vgs off
#given data
gm=10 #in mS
IDSS=10 #in uA
IDSS=IDSS-10**-6 #in Ampere
#Calculation
VGS_OFF=-2*IDSS/gm
#Result
print"VGS(OFF) is =",round(VGS_OFF),"mV"
#Exa 7.5
#Determine The minimum value of VDS for pinch-OFF region is equal to VP.
#given data
VP=-4.0 #in Volt
IDSS=10.0 #in mA
IDSS=IDSS*10**-3 #in Ampere
VGS=-2.0 #in Volt
#Calculation
ID=IDSS*(1.0-VGS/VP)**2 #in mA
#result
print "Drain current=",ID*1000,"mA"
print"VDS(min) is : ",VP,"V"
#Exa 7.6
#Find the value of Id , gmo, gm
#given data
VP=-3.0 #in Volt
IDSS=8.7 #in mA
IDSS=IDSS*10**-3 #in mA
VGS=-1 #in Volt
#calculation
ID=IDSS*(1-VGS/VP)**2 #in Ampere
gmo=-2*IDSS/VP #in mS
gm=gmo*(1-VGS/VP) #in mS
#result
print"ID is ",round(ID*1000,1),"mA"
print"gmo is",round(gmo*1000,1),"mS"
print"gm is ",round(gm*1000,1),"mS"
#Exa 7.7
#Find gm
#given data
VP=-3.0 #in Volt
IDSS=8.4 #in mA
VGS=-1.5 #in Volt
#calculation
ID=IDSS*(1-VGS/VP)**2 #in mA
gmo=-2*IDSS/VP #in mS
gm=gmo*(1-VGS/VP) #in mS
#result
print"Drain current=",ID,"mA"
print"Transconductance is ",gm,"mS"
#Exa 7.8
#What is gm
#given data
VP=-4.5 #in Volt
IDSS=9 #in mA
IDSS=IDSS*10**-3 #in Ampere
IDS=3 #in mA
IDS=IDS*10**-3 #in Ampere
#calculation
import math
VGS=VP*(1-math.sqrt(IDS/IDSS)) #in Volt
gm=(-2*IDSS/VP)*(1-VGS/VP) #in mS
#result
print"IDS = 3 mA when gm is ",round(gm*1000,2),"mS"
#Exa 7.9
#given data :
Vp=-4.0 #in Volt
IDSS=10.0 #in mA
#From eq 7.1
Vgs1=0
Id1=IDSS # mA, at Vgs=0
Vgs2=1
Id2=Id1*(1-Vgs2/Vp)**2 #mA, at Vgs=1
Vgs3=-1
Id3=Id1*(1-Vgs3/Vp)**2 #mA, at Vgs=1
Vgs4=-2
Id4=Id1*(1-Vgs4/Vp)**2 #mA, at Vgs=-2
Vgs5=-4
Id5=Id1*(1-Vgs5/Vp)**2 #mA, at Vgs=-4
print "Transfer Characteristics are in mA ",Id1,Id2,Id3,Id4,Id5
#Plot
%matplotlib inline
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
Vgs=[-4,-2,-1,0,1]
Id=[0,2.5,5.625,10,15.625]
plt.xlabel("Vgs (V)")
plt.ylabel("Id (mA)")
plt.xlim((-4,2))
plt.ylim((0,18))
ax.plot([0], [10], 'o')
ax.annotate('(Idss)', xy=(0,10))
a=plt.plot(Vgs,Id)
print "Transfer Characteristics for N channel MOSFET Type"
plt.show(a)
#Exa 7.10
#Determine the drain current
#given data
ID_on=5 #in mA
VGS=6 #in Volt
VGS_on=8.0 #in Volt
VGST=4 #in Volt
#calculation
K=ID_on/(VGS_on-VGST)**2 #in mA/V**2
ID=K*(VGS-VGST)**2 #in mA
#result
print"When VGS=6V the drain current is ",ID,"mA"