# Chapter 2 - Metal oxide semiconductor field effect transistor(MOSFET)¶

## Exa 2.1 - page 75¶

In :
# Given data
V_S= 0 # As source is connected to ground
V_G= 1.5 # in V
V_D= 0.5 # in V
Vt= 0.7 # in V
# Part(a) V_D= 0.5 # in V
V_D= 0.5 # in V
V_DS= V_D-V_S # in V
V_GS= V_G-V_S # in V
if V_GS < Vt:
print "At V_D = 0.5 , the device is in cut off region"
elif V_DS<= (V_GS-Vt):
print "At V_D = 0.5 , the device is in triode region"
else:
print "At V_D = 0.5 , the device is in saturation region"

# Part(b) V_D= 0.9 # in V
V_D= 0.9 # in V
V_DS= V_D-V_S # in V
V_GS= V_G-V_S # in V
if V_GS < Vt:
print "At V_D = 0.9 , the device is in cut off region"
elif V_DS<= (V_GS-Vt):
print "At V_D = 0.9 , the device is in triode region"
else:
print "At V_D = 0.9 , the device is in saturation region"

# Part(c) V_D= 3 # in V
V_D= 3 # in V
V_DS= V_D-V_S # in V
V_GS= V_G-V_S # in V
if V_GS < Vt:
print "At V_D = 3 , the device is in cut off region"
elif V_DS<= (V_GS-Vt):
print "At V_D = 3 , the device is in triode region"
else:
print "At V_D = 3 , the device is in saturation region"

At V_D = 0.5 , the device is in triode region
At V_D = 0.9 , the device is in saturation region
At V_D = 3 , the device is in saturation region


## Exa 2.2 - page 77¶

In :
# Given data
unCox= 100 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
L= 1 #in µm
L= L*10**-6 # in m
W=10 # in µm
W=W*10**-6 # in m
V_GS= 1.5 # in V
Vt= 0.7 # in V
# For V_DS= 0.5 V
V_DS= 0.5 # in V
if V_DS<= (V_GS-Vt):
I_D= unCox*W/L*((V_GS-Vt)*V_DS-V_DS**2/2)
print "The device is in triode region. SO the drain current in the triode region = %0.f µA" %(I_D*10**6)
else:
I_D= unCox*W/(2*L)*(V_GS-VT)**2
print "The device is in saturation region. SO the drain current in the saturation region = %0.1f µA" %(I_D*10**6)

# For V_DS= 0.9 V
V_DS= 0.9 # in V
if V_DS<= (V_GS-Vt):
I_D= unCox*W/L*((V_GS-Vt)*V_DS-V_DS**2/2)
print "The device is in triode region. So the drain current in the triode region = %0.1f µA" %(I_D*10**6)
else:
I_D= unCox*W/(2*L)*(V_GS-Vt)**2
print "The device is in saturation region. So  drain current in the saturation region = %0.f µA" %(I_D*10**6)

The device is in triode region. SO the drain current in the triode region = 275 µA
The device is in saturation region. So  drain current in the saturation region = 320 µA


## Exa 2.3 - page 78¶

In :
# Given data
Vt= 0.7 # in V
ID = 100 # in µA
V_GS= 1.2 # in V
V_DS= 1.2 # in V

# Let assume µn*Cox*W/(2*L) = K
# For triode region
if V_DS<= (V_GS-Vt):
#triode region
K = ID*10**-6/(V_GS-Vt)**2

else:
# saturation region
K = ID*10**-6/(V_GS-Vt)**2

V_DS= 3 # inV
V_GS = 1.5 # in V
I_D= K*(V_GS-Vt)**2 # in A
I_D*=10**6 # in µA
print "Value of ID = %0.1f µA" %I_D
# Drain to source resistance
V_GS = 3.2 # in V
r_DS = 1/(2*K*(V_GS-Vt))
print "Drain to source resistance, rDS = %0.1f ohm" %r_DS

Value of ID = 256.0 µA
Drain to source resistance, rDS = 500.0 ohm


## Exa 2.4 - page 82¶

In :
from __future__ import division
from numpy import sqrt
# Given data
I_D= 0.4 # in mA
I_D=I_D*10**-3 # in A
Vt= 0.7 # in V
V_SS= -2.5 # in V
V_DD= 2.5 # in V
unCox= 100 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
W= 32 # in m
L= 1 # in m
# V_GS-Vt= V_OV
# I_D= unCox*W/(2*L)*(V_OV)**2
V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V
V_GS= V_OV+Vt # in V
print "The value of V_GS = %0.1f Volt" %V_GS
V_G= 0
# Formula V_GS= V_G-V_S
V_S= V_G-V_GS # in V
R_S= (V_S-V_SS)/I_D# in Ω
print "The value of R_S = %0.2f kΩ" %(R_S*10**-3)
V_D= 0.5 # in V
R_D= (V_DD-V_D)/I_D #in Ω
print "The value of R_D = %0.1f kΩ" %(R_D*10**-3)

The value of V_GS = 1.2 Volt
The value of R_S = 3.25 kΩ
The value of R_D = 5.0 kΩ


## Exa 2.5 - page 83¶

In :
from __future__ import division
from numpy import sqrt
# Given data
V_DD= 3 # in V
I_D= 80 # in µA
I_D=I_D*10**-6 # in A
Vt= 0.6 # in V
unCox= 200 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
L= 0.8 #in µm
L= L*10**-6 # in m
W=4 # in µm
W=W*10**-6 # in m
# V_GS-Vt= V_OV
# I_D= unCox*W/(2*L)*(V_OV)**2
V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V
V_GS= V_OV+Vt # in V
V_D= 1 # in V
V_G= V_D # in V
R= (V_DD-V_D)/I_D # in Ω
print "The value of R = %0.f kΩ" %(R*10**-3)

The value of R = 25 kΩ


## Exa 2.6 - page 84¶

In :
from __future__ import division
from numpy import sqrt
# Given data
V_DD= 10 # in V
I_D= 0.4 # in mA
I_D=I_D*10**-3 # in A
Vt= 2 # in V
unCox= 20 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
L= 10 #in µm
L= L*10**-6 # in m
W=100 # in µm
W=W*10**-6 # in m
V_S= 0 # in V as source is connected to ground
# I_D= unCox*W/(2*L)*(V_OV)**2
V_OV= sqrt(I_D/(unCox*W/(2*L))) # in V
V_GS= V_OV+Vt # in V
V_D= V_GS # in V
R= (V_DD-V_D)/I_D # in Ω
print "The value of R = %0.2f kΩ" %(R*10**-3)

The value of R = 15.00 kΩ


## Exa 2.7 - page 85¶

In :
from __future__ import division
# Given data
KnWbyL= 1 # in mA
KnWbyL=KnWbyL*10**-3 # in A
Vt= 1 # in V
V_DS= 0.1 # in V
V_D= V_DS # in V
V_GS= 5 # in V
V_DD= V_GS # in V
# Formula I_D= K'nW/L*[(V_GS-Vt)*V_DS-V_DS**2/2]
I_D= KnWbyL*((V_GS-Vt)*V_DS-V_DS**2/2) # in A
R_D= (V_DD-V_D)/I_D #in Ω
print "The required value of R_D = %0.1f kΩ" %(R_D*10**-3)

The required value of R_D = 12.4 kΩ


## Exa 2.8 - page 86¶

In :
from __future__ import division
# Given data
KnWbyL= 1 # in mA/V**2
KnWbyL=KnWbyL*10**-3 # in A/V**2
Vt= 1 # in V
V_DD= 10 # in V
R_D= 6 # in kΩ
R_D= R_D*10**3 # in Ω
R_S= 6 # in kΩ
R_S= R_S*10**3 # in Ω
R_G1= 10 # in MΩ
R_G1= R_G1*10**6 # in Ω
R_G2= 10 # in MΩ
R_G2= R_G2*10**6 # in Ω
V_G= V_DD*R_G2/(R_G1+R_G2) # in V
# V_S= R_S*I_D
# V_GS= V_G-V_S= V_G-R_S*I_D
# Formula I_D= K'nW/2*L*(V_GS-Vt)**2, Putting the value of V_GS, We get
# 18*I_D**2 -25*I_D +8= 0
# I_D= 0.89 mA or I_D= 0.5
I_D= 0.5 # in mA
I_D=I_D*10**-3 # in A
V_S= R_S*I_D # in V
V_GS= V_G-V_S # in V
V_D= V_DD-I_D*R_D # in V
print "The value of I_D = %0.2f mA" %(I_D*10**3)
print "The value of V_S = %0.2f Volt" %(V_S)
print "The value of V_GS = %0.2f Volt" %(V_GS)
print "The value of V_D = %0.2f Volt" %(V_D)

The value of I_D = 0.50 mA
The value of V_S = 3.00 Volt
The value of V_GS = 2.00 Volt
The value of V_D = 7.00 Volt


## Exa 2.9 - page 98¶

In :
from __future__ import division
# Given data
R_D= 20 # in kΩ
R_D= R_D*10**3 # in Ω
R1= 30 # in kΩ
R1= R1*10**3 # in Ω
R2= 20 # in kΩ
R2= R2*10**3 # in Ω
V_DD= 5 # in V
Vtn= 1 # in V
Kn= 0.1 # in mA/V**2
Kn=Kn*10**-3 # in A/V**2
V_GS= R2*V_DD/(R1+R2) # in V
# I_D= 1/2*µnCox*W/L*(V_GS-Vtm)**2
I_D = Kn*(V_GS-Vtn)**2   # in mA (As Kn= 1/2*µnCox*W/L)
V_DS= V_DD-I_D*R_D # in V
print "The value of V_GS  = %0.f Volt" %(V_GS)
print "The value of I_D = %0.2f mA" %(I_D*10**3)
print "The value of V_DS = %0.f Volt" %(V_DS)

The value of V_GS  = 2 Volt
The value of I_D = 0.10 mA
The value of V_DS = 3 Volt


## Exa 2.10 - page 99¶

In :
from __future__ import division
from numpy import sqrt
# Given data
V_DD= 15 # in V
Vt= 1 # in V
V_D= 10 # in V
V_S= 5 # in V
KnWbyL= 1 # in mA/V**2
KnWbyL=KnWbyL*10**-3 # in A/V**2
R_G1= 8 # in MΩ
R_G1= R_G1*10**6 # in Ω
I_D= 0.5 # in mA
I_D=I_D*10**-3 #in A
R_D= (V_DD-V_D)/I_D # in Ω
R_S= V_S/I_D # in Ω
# Formul I_D= 1/2*KnWbyL*(V_OV)**2
V_OV= sqrt(2*I_D/KnWbyL) # in V
# Formula V_OV= V_GS-Vt
V_GS= V_OV+Vt # in V
V_G= V_GS+V_S # in V
# Formul V_G= R_G2*V_DD/(R_G1+R_G2)
R_G2= R_G1*V_G/(V_DD-V_G) #in Ω
print "The value of R_D = %0.1f kΩ" %(R_D*10**-3)
print "The value of R_S = %0.1f kΩ" %(R_S*10**-3)
print "The value of V_OV = %0.1f Volt" %(V_OV)
print "The value of V_GS = %0.1f Volt" %V_GS
print "The value of R_G2 = %0.1f MΩ" %(R_G2*10**-6)

The value of R_D = 10.0 kΩ
The value of R_S = 10.0 kΩ
The value of V_OV = 1.0 Volt
The value of V_GS = 2.0 Volt
The value of R_G2 = 7.0 MΩ


## Exa 2.11 - page 110¶

In :
from __future__ import division
# Given data
V_DD= 15 # in V
KnWbyL= 0.25 # in mA/V**2
KnWbyL=KnWbyL*10**-3 # in A/V**2
Vt= 1.5 # in V
V_A= 50 # in V
R_D= 10 # in kΩ
R_D= R_D*10**3 # in Ω
R_L= 10 # in kΩ
R_L= R_L*10**3 # in Ω
R_G= 10 # in MΩ
R_G= R_G*10**6 # in Ω
# I_D= 1/2*KnWbyL*(V_D-Vt)**2 , (V_GS= V_D, as dc gate current is zero)   (i)
# V_D= V_DD- I_D*R_D           (ii)
I_D= 1.06 # in mA
I_D = I_D*10**-3 # in A
V_D= V_DD- I_D*R_D # in V
V_GS=V_D # in V
# The coordinates of operating point
V_GSQ= V_D # in V
I_DQ= I_D*10**3 # in mA
print "The coordinates of operating point(bias point) are  V_GSQ =",V_GSQ,"V and I_DQ =",I_DQ,"mA"
gm= KnWbyL*(V_GS-Vt) # in A/V
r_o= V_A/I_D #in Ω
# The gain is : Av= vo/vi = -gm*(R_D||R_L||r_o)
Av= -gm*(R_D*R_L*r_o/(R_D*R_L+R_D*r_o+R_L*r_o)) # in V/V
print "VOltage gain is %0.1f V/V" %Av
# i_i= (vi-vo)/R_G
# i_i= vi/R_G*(1-vo/vi) and Rin= vi/i_i = R_G/(1-Av)
Rin= R_G/(1-Av) # in Ω
print "The input resistance = %0.2f MΩ" %(Rin*10**-6)

The coordinates of operating point(bias point) are  V_GSQ = 4.4 V and I_DQ = 1.06 mA
VOltage gain is -3.3 V/V
The input resistance = 2.34 MΩ


## Exa 2.12 - page 143¶

In :
from __future__ import division
from numpy import sqrt
# Given data
I_D= 0.5 # in mA
I_D= I_D*10**-3 # in mA
V_D= 3 # in V
Vt= -1 # in V
KpWbyL= 1 # in mA/V**2
KpWbyL=KpWbyL*10**-3 # in A/V**2
# Formul I_D= 1/2*KpWbyL*(V_OV)**2
V_OV= sqrt(2*I_D/KpWbyL) # in V
# For PMOS
V_OV= -V_OV # in V
V_GS= V_OV+Vt # in V
R_D= V_D/I_D # in Ω
V_Dmax= V_D+abs(Vt) # in V
R_D= V_Dmax/I_D # in Ω
print """The largest value that R_D can have
while maintaining saturation-region operation is %0.2f kΩ""" %(R_D*10**-3)

The largest value that R_D can have
while maintaining saturation-region operation is 8.00 kΩ


## Exa 2.14 - page 145¶

In :
from __future__ import division
# Given data
V_GS1= 1.5 # in V
Vt= 1 # in V
r_DS1= 1 # in kΩ
r_DS1= r_DS1*10**3 # in Ω
r_DS2= 200 # in kΩ
#  r_DS1= 1/(KnWbyL*(V_GS1-Vt))            (i)
#  r_DS2= 1/(KnWbyL*(V_GS2-Vt))            (i)
# dividing equation (i) by (ii)
V_GS2= (r_DS1/r_DS2)*(V_GS1-Vt)+Vt # in V
print "To Optain rDS= 200, The value of V_GS should be %0.2f Volt" %V_GS2
# For  V_GS= 1.5  # V
# W2= 2*W1
# r_DS1/r_DS2= 2
r_DS2= r_DS1/2 # in Ω
print "For V_GS= 1.5 V , the value of r_DS2 = %0.1f Ω " %r_DS2
# For V_GS= 3.5 V
r_DS2= 200/2 # in Ω
print "For V_GS= 3.5 V , the value of r_DS2 = %0.1f Ω" %r_DS2

To Optain rDS= 200, The value of V_GS should be 3.50 Volt
For V_GS= 1.5 V , the value of r_DS2 = 500.0 Ω
For V_GS= 3.5 V , the value of r_DS2 = 100.0 Ω


## Exa 2.15 page 146¶

In :
from __future__ import division
from numpy import sqrt
# Given data
I_D= 0.2 # in mA
I_D= I_D*10**-3 # in mA
Vt= 1 # in V
KpWbyL= 0.1 # in mA/V**2
KpWbyL=KpWbyL*10**-3 # in A/V**2
# Formul I_D= 1/2*KpWbyL*(V_GS-VT)**2
V_GS= sqrt(2*I_D/KpWbyL)+Vt # in V
V_DSmin= V_GS-Vt # in V
print "Required V_GS = %0.1f Volt" %V_GS
print "The minimum required V_DS = %0.1f Volt" %V_DSmin
# For I_D= 0.8 mA
I_D = 0.8*10**-3 # in A
V_GS= sqrt(2*I_D/KpWbyL)+Vt # in V
V_DSmin= V_GS-Vt # in V
print "Required V_GS = %0.1f Volt" %V_GS
print "The minimum required V_DS = %0.1f Volt" %V_DSmin

Required V_GS = 3.0 Volt
The minimum required V_DS = 2.0 Volt
Required V_GS = 5.0 Volt
The minimum required V_DS = 4.0 Volt


## Exa 2.16 - page 147¶

In :
from __future__ import division
from numpy import sqrt
# Given data
V_SS= -5 # in V
unCox= 60 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
Vt= 1 # in V
W= 100 # in µm
L= 3 # in µm
V_G=0 # in V
V_DD= 5 # in V
V_D=0 #in V
I_D= 1*10**-3 # in A
# I_D= (V_DD-V_D)/R_D
R_D= (V_DD-V_D)/I_D # in Ω
print "The value of R_D = %0.f kΩ" %(R_D*10**-3)
# Formul I_D= 1/2*unCox*W/L*(V_GS-Vt)**2
V_GS= sqrt(2*I_D*L/(unCox*W))+Vt # in V
V_S= V_G-V_GS # in V
R_S= (V_S-V_SS)/I_D # in Ω
print "The resistance = %0.f kΩ" %(R_S*10**-3)

The value of R_D = 5 kΩ
The resistance = 3 kΩ


## Exa 2.17 - page 148¶

In :
from __future__ import division
from numpy import sqrt
# Given data
V_D= 3.5 # in V
I_D= 115*10**-6 #in A
upCox= 60 # in µA/V**2
upCox= upCox*10**-6 # in A/V**2
L= 0.8 #in µm
V_GS= -1.5 # in V
Vt= 0.7 # in V
R= V_D/I_D # in Ω
print "The value required for R = %0.1f kΩ" %(R*10**-3)
# Formul I_D= 1/2*upCox*W/L*(V_GS-Vt)**2
W= 2*I_D*L/(upCox*(V_GS-Vt)**2)
print "The value required for W = %0.1f µm" %(W)

#  Note:  Calculation of evaluating the value of W in the book is wrong , so the Answer of the book is wrong

The value required for R = 30.4 kΩ
The value required for W = 0.6 µm


## Exa 2.18 - page 149¶

In :
from __future__ import division
from numpy import sqrt
# Given data
Vt= 1 # in V
unCox= 120 # in µA/V**2
unCox= unCox*10**-6 # in A/V**2
L1=1 # in µm
L2=L1 # in µm
I_D= 120 #in µA
I_D= I_D*10**-6 #in A
V_GS1= 1.5 #in V
V_G2= 3.5 # in V
V_S2= 1.5 # in V
V_DD= 5 # in V
V_D2= 3.5 # in V
# Formul I_D= 1/2*unCox*W/L*(V_GS1-Vt)**2
W1= 2*I_D*L1/(unCox*(V_GS1-Vt)**2) # in µm
print "The value of W1 = %0.1f µm" %W1
V_GS2= V_G2-V_S2 #in V
# Formul I_D= 1/2*unCox*W/L*(V_GS1-Vt)**2
W2= 2*I_D*L2/(unCox*(V_GS2-Vt)**2) # in µm
print "The value of W2 = %0.1f µm" %W2
R= (V_DD-V_D2)/I_D # in Ω
print "Resistance = %0.1f kΩ" %(R*10**-3)

The value of W1 = 8.0 µm
The value of W2 = 2.0 µm
Resistance = 12.5 kΩ


## Exa 2.19 - page 150¶

In :
from __future__ import division
from numpy import sqrt
# Given data
Vt= 2 # in V
K1WbyL= 1 # in mA/V**2
K1WbyL= K1WbyL*10**-3 #in mA/V**2
I_D= 10 #in µA
I_D= I_D*10**-6 #in A
V_DD= 10 # in V
R_D= 4 # in kΩ
R_D= R_D*10**3 # in Ω

# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2
V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V
V1= -V_GS # in V
# Part (b)
I_D= 2 # in mA
I_D= I_D*10**-3 # in A
V2= V_DD-I_D*R_D #in V
# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2
V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V
V3= -V_GS # in V
# Part (c)
I_D= 1 # in mA
I_D= I_D*10**-3 # in A
# Formul I_D= 1/2*K1WbyL*(V_GS-Vt)**2
V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V
V4= V_GS # in V
# Part (d)
I_D= 2 # in mA
R_D= 2.5 # in kΩ
R_D= R_D*10**3 # in Ω
V_SS= 10 # in V
I_D= I_D*10**-3 # in A
V_GS= sqrt(2*I_D/K1WbyL)+Vt # in V
V5= -V_SS+I_D*R_D # in V
print "The value of V1 = %0.2f Volt" %V1
print "The value of V2 = %0.f Volt" %V2
print "The value of V3 = %0.f Volt" %V3
print "The value of V4 = %0.2f Volt" %V4
print "The value of V5 = %0.f Volt" %V5

The value of V1 = -2.14 Volt
The value of V2 = 2 Volt
The value of V3 = -4 Volt
The value of V4 = 3.41 Volt
The value of V5 = -5 Volt


## Exa 2.20 - page 152¶

In :
from __future__ import division
# Given data
unCox= 20*10**-6 #in A/V**2
upCox= unCox/2.5 # in A/V**2
V_DD= 3 #in V
Vt= 1 # in V
W= 30 # in µm
L= 10 # in µm

# V_GS1= V_GS2
# Formula V_DD= V_GS1+V_GS2
V_GS1= V_DD/2 #in V
V_GS2= V_GS1 # in V
V2= V_GS1 # inV
I1= 1/2*unCox*W/L*(V_GS1-Vt)**2 # in A
# Both transistor have V_D = V_G and therefore they are operating in saturation
#1/2*unCox*W/L*(V4-Vt)**2 = 1/2*upCox*W/L*(V_DD-V4-Vt)
V4= (V_DD-Vt+sqrt(unCox/upCox))/(1+sqrt(unCox/upCox))
I3= 1/2*unCox*W/L*(1.39-Vt)**2
print "The value of V2 = %0.1f Volt" %V2
print "The value of I1 = %0.1f µA" %(I1*10**6,)
print "The value of V4 = %0.1f Volt " %V4
print "The value of I3 = %0.1f µA" %(I3*10**6)

The value of V2 = 1.5 Volt
The value of I1 = 7.5 µA
The value of V4 = 1.4 Volt
The value of I3 = 4.6 µA


## Exa 2.22 - page 155¶

In :
from __future__ import division
from numpy import sqrt
# Given data
Vt= 0.9 # in V
V_A= 50 # in V
V_D= 2 # in V
R_L= 10 # in MΩ
R_L= R_L*10**3 # in Ω
R_G= 10 # in MΩ
R_G= R_G*10**6 # in Ω
I_D= 500 # in µA
I_D= I_D*10**-6 # in A
V_GS= V_D # in V
ro= V_A/I_D # in Ω
gm= 2*I_D/(V_GS-Vt) # in A/V
# vo= -gm*vi*(ro || R_L)
vo_by_vi = -gm*(ro*R_L/(ro+R_L)) # in V/V
print "The voltage gain = %0.1f V/V" %(vo_by_vi )
# For I= 1 mA or twice the current
I_D1= I_D # in A
I_D2= 2*I_D1 # in A
gm1= gm # in A/V
# Effect on V_D
# I_D1/I_D2 = (V_GS1-Vt)**2/(V_GS2-Vt)**2
V_GS1= V_GS
V_GS2= Vt+sqrt(2)*(V_GS1-Vt) # in V
print "The new value of V_GS = %0.1f Volt" %(V_GS2)
# Effect on gm
# gm1/gm2= sqrt(I_D1/I_D2)
gm2= sqrt(I_D2/I_D1)*gm1 # in A/V
print "The new value of gm2 = %0.1f mA/V" %(gm2*10**3)
# Effect on ro
# ro1/ro2= I_D2/I_D1
ro1= ro # in Ω
ro2= I_D1*ro1/I_D2 # in Ω
print "The new value of ro = %0.1f kΩ/V" %(ro2*10**-3)
# Effect on gain
# Av= -gm*(ro2 || R_L)
Av= -gm*(ro2*R_L/(ro2+R_L)) # in V/V
print "The new value of voltage gain = %0.1f V/V" %(Av)
#Answer wrong in the textbook because of calculation accuracy.

The voltage gain = -8.3 V/V
The new value of V_GS = 2.5 Volt
The new value of gm2 = 1.3 mA/V
The new value of ro = 50.0 kΩ/V
The new value of voltage gain = -7.6 V/V


## Exa 2.23 - page 157¶

In :
from __future__ import division
from numpy import pi
# Given data
I_D= 1 # in mA
I_D= I_D*10**-3 # in A
gm= 1 #in mA/V
gm= gm*10**-3 #in A/V
f_L= 10 # in Hz
R_S= 6 # in kΩ
R_S= R_S*10**3 # in Ω
R_D= 10 # in kΩ
R_D= R_D*10**3 # in Ω
vo_by_vi= -gm*R_D/(1+gm*R_S) # in V/V
print "Mid band gain = %0.2f V/V " %(vo_by_vi)
# Formula f_L= 1/(2*pi*(1/gm || R_S)) * CS
CS= 1/(2*pi*(1/gm*R_S/(1/gm+R_S))*f_L)  #in F
print "The value of Cs = %0.2f µF" %(CS*10**6)

Mid band gain = -1.43 V/V
The value of Cs = 18.57 µF


## Exa 2.24 - page 159¶

In :
from __future__ import division
from numpy import pi
# Given data
Rsig= 100 # in kΩ
Rsig= Rsig*10**3 # in Ω
R_G= 4.7 # in MΩ
R_G= R_G*10**6 # in Ω
R_D= 15 # in kΩ
R_D= R_D*10**3 # in Ω
R_L= R_D # in Ω
gm= 1 #in mA/V
gm= gm*10**-3 #in A/V
ro=150 # in kΩ
ro=ro*10**3 # in Ω
Cgs= 1 # in pF
Cgs=Cgs*10**-12 #in F
Cgd= 0.4 # in pF
Cgd=Cgd*10**-12 #in F
vgsBYvsig= R_G/(Rsig+R_G)
Rdesh_L= R_D*R_L/(R_D+R_L) # in Ω
voBYvgs= -gm*Rdesh_L
Av= voBYvgs/vgsBYvsig # in V/V
print "The Mid-band gain = %0.2f V/V" %(Av)
CM= Cgd*(1+gm*Rdesh_L) # in F
# f_H= 1/(2*pi*(Rsig || R_G)*(Cgs*CM))
f_H= 1/(2*pi*(Rsig * R_G/(Rsig + R_G))*(Cgs+CM)) # in Hz
print "Frequency = %0.1f kHz" %(f_H*10**-3)

The Mid-band gain = -7.66 V/V
Frequency = 369.4 kHz