# Chapter No 9 : MOS Transistors

## Example 9.1, Page No 361¶

In :
#initialisation of variables
V_TN = 0.7            #in V
W = 45*10**-4         #in cm
L = 4.0               #in µm
L = L * 10**-4        #in cm
t_ox = 450            #in Å

#CALCULATIONS
t_ox = t_ox*10**-8           #in cm
V_GS = 1.4                   #in V
Miu_n = 700                  #in cm^2/V-s
Epsilon_ox = (8.85*10**-14)*(3.9)               #in F/cm
k_n = (W*Miu_n*Epsilon_ox)/(2*L*t_ox)               #A/V^2
I_D = k_n*((V_GS-V_TN)**2)                        #in A
k_n=k_n*10**3
I_D=I_D*10**3

#RESULTS
print('The value of k_n is : =%.2f   mA/V^2' %k_n)
print('The current  is =%.2f  mA' %I_D)
print('Approximation error')

The value of k_n is : =0.30   mA/V^2
The current  is =0.15  mA
Approximation error


## Example 9.2, Page No 376¶

In :
import math

#initialisation of variables

I_Don = 6.0                #in mA
I_Don= I_Don*10**-3        #in A
V_GSon = 8                 #in V
V_GSth = 3                 #in V
V_DD = 12.0                #in V
R_D= 2*10**3               #in Ω

#CALCULATIONS
k= I_Don/(V_GSon-V_GSth)**2             #in A/V^2
A= R_D**2                 #assumed
B= 2*R_D*V_GSth-2*R_D*V_DD-1/k              #assumed
C= (V_DD-V_GSth)**2                #assumed

I_DQ= 0.0027940                #in A
V_DSQ= V_DD-I_DQ*R_D            #in V
I_DQ=I_DQ*10**3

#RESULTS
print('The value of I_DQ is : =%.2f  mA' %I_DQ)
print('The value of V_DSQ is : =%.2f volts ' %V_DSQ)

The value of I_DQ is : =2.79  mA
The value of V_DSQ is : =6.41 volts


## Example 9.3 Page No 378¶

In :
import math

#initialisation of variables
V_GS = 6.0           #in V
I_D = 4.0            #in mA
V_GSth = 2.0         #in V

#CALCULATIONS
V_DS = V_GS          #in V
V_DD = 2*V_DS        #in V
R_D = (V_DD-V_DS)/I_D         #in k ohm

#RESULTS
print('The value of V_DD is =%.2f  V  ' %V_DD)
print('The value of R_D  is  =%.2f   k ohm' %R_D)
print('The very high value for the gate to drain resistance is : 10 MΩ ' )

The value of V_DD is =12.00  V
The value of R_D  is  =1.50   k ohm
The very high value for the gate to drain resistance is : 10 MΩ


## Example 9.4, Page No 379¶

In :
import math

#initialisation of variables
I_Don = 3*10**-3
V_GSon = 10.0          #in V
V_GSth= 5.0        #in V
R2= 18*10**6        #in Ω
R1= 22*10**6      #in Ω
R_S=820         #in Ω
R_D=3*10**3     #in Ω
V_DD= 40.0      #in V

#CALCULATIONS
V_G= V_DD*R2/(R1+R2)           #in V
k= I_Don/(V_GSon-V_GSth)**2           #in A/V**2
A= R_S**2                  #assumed
B= 2*R_S*V_GSth-2*R_S*V_G-1/k           #assumed
C= (V_G-V_GSth)**2          #assumed
I_D= 0.0067246               #in A
I_DQ= I_D                 #in A
V_GSQ= V_G-I_D*R_S      #in V
V_DSQ= V_DD-I_DQ*(R_D+R_S)         #in V
I_DQ=I_DQ*10**3

#RESULTS
print('The value of I_DQ  is =%.2f  mA' %I_DQ)
print('The value of V_GSQ is =%.2f volts ' %V_GSQ)
print('The value of V_DSQ is =%.2f volts ' %V_DSQ)

The value of I_DQ  is =6.72  mA
The value of V_GSQ is =12.49 volts
The value of V_DSQ is =14.31 volts


## Example 9.5 Page No 380¶

In :
import math

#initialisation of variables
I_D= '0.3*(V_GS-V_P)^2'                #given expression
V_DD= 30.0                           #in V
V_P= 4                               #in V
R_GS = 1.2*10**6                      #in Ω
R_G = 1.2*10**6                       #in Ω
I_D= 1.2           #in mA

#CALCULATIONS
Req= R_GS/(R_GS+R_G)                  #in Ω
R_D= 15.0                             #in Ω
A= (R_D*Req)**2                       #assumed
B= -(2*R_D*Req*(V_DD*Req-V_P)+1/0.3)      #assumed
C= (V_DD*Req-V_P)**2                  #assumed
I_DSQ= I_D             #in mA
V_GS= (V_DD-I_D*R_D)    #in V
V_DS= Req*V_GS         #in V

#RESULTS
print('The value of I_DSQ  is : =%.2f  mA' %I_DSQ)
print('The value of V_GS  is :  =%.2f volts ' %V_GS)
print('The value of V_DS  is : =%.2f volts ' %V_DS)

The value of I_DSQ  is : =1.20  mA
The value of V_GS  is :  =12.00 volts
The value of V_DS  is : =6.00 volts


## Example 9.6 Page No 380¶

In :
import math

#initialisation of variables
k = 0.1          #in mA/V^2
V_T  = 1.0            # in V
R1 = 33.0          #in k ohm
R2 = 21.0         #in k ohm
V_DD = 6.0       #in V
R_D = 18           #in k ohm

#CALCULATIONS
V_G = (R2/(R2+R1))*V_DD             #in V
V_S = 0               #in V
V_GS = V_G-V_S             #in V
I_D = k*((V_GS-V_T)**2)         #in mA
V_DS = V_DD - (I_D*R_D)       #in V
V_DSsat = V_GS-V_T            #in V

#RESULTS
print('The value of I_D  is =%.2f mA ' %I_D)
print('The value of V_DS(sat) is =%.2f  V ' %V_DS)
print('The value of V_DS(sat)  is =%.2f V ' %V_DSsat)

if V_DS > V_DSsat :
print('MOSFET is in saturation region  ')

The value of I_D  is =0.18 mA
The value of V_DS(sat) is =2.80  V
The value of V_DS(sat)  is =1.33 V
MOSFET is in saturation region


## Example 9.8, Page No 382¶

In :
import math

#initialisation of variables
R2 = 18.0       #in k ohm
R1 = 33.0       #in k ohm
V_DD = 6.0       #in V

#CALCULATIONS
V_G = (R2/(R1+R2))*V_DD              #in V
V_S = V_DD                          # in V
V_SG = V_S-V_G                      #in V
k = 0.1
V_T = -1                          #in V
I_D = k*((V_SG+V_T)**2)           #in mA
R_D = 3.0                     # in k ohm
V_SD = V_DD - (I_D*R_D)            #in V
V_SDsat  = V_SG+V_T                 #in V

#RESULTS
print('The value of V_SG is =%.2f V ' %V_SG)
print('The value of I_D  is =%.2f mA ' %I_D)
print('The value of V_SD  is =%.2f V ' %V_SD)
print('The value of V_SD(sat)  is =%.2f V ' %V_SDsat)

if V_SD > V_SDsat :
print('The p MOSFET is indeed biased in the saturation region')

The value of V_SG is =3.88 V
The value of I_D  is =0.83 mA
The value of V_SD  is =3.51 V
The value of V_SD(sat)  is =2.88 V
The p MOSFET is indeed biased in the saturation region


## Example 9.9 Page No 384¶

In :
import math

#initialisation of variables
V_G= 1.5                # in V
V_P= -3.0              # in V
R_S= 750.0               # in Ω
R_D= 1800              #in Ω
I_DSS= 6*10**-3         # in A
V_DD= 18            #in V

#CALCULATIONS
A= R_S**2
B=(2*R_S*(V_P-V_G)-V_P**2/I_DSS)
C=(V_P-V_G)**2
I_D= 0.0031170               #in A
I_DQ= I_D                 #in A
V_DS= V_DD-I_D*(R_D+R_S)        # in V
V_DSQ= V_DS                  # in V
I_DQ=I_DQ*10**3

#RESULTS
print('The value of I_DQ  is : =%.2f mA ' %I_DQ)
print('The value of V_DSQ  is : =%.2f volts ' %V_DSQ)

The value of I_DQ  is : =3.12 mA
The value of V_DSQ  is : =10.05 volts


## Example 9.10 Page No 384¶

In :
import math

#initialisation of variables
V_GS = 4.0              #in V
V_P = 2.0               #in V
R2 = 10.0             #in k ohm
R1 = 30.0           #in k ohm
R_D= 2.5           #in kohm
I_D= 15            #in mA

#CALCULATIONS
I_D= I_D*10**-3           #in A
V_DD = 25                 #in V
V_G = (V_DD/R_D)*V_DD/(R1+R2)                #in V
R_S = (V_G-V_GS)/I_D                 # in ohm

#RESULTS
print('The value of R_S  is =%.f ohm ' %R_S)

The value of R_S  is =150 ohm


## Example 9.11 Page No 385¶

In :
import math

#initialisation of variables
k= 0.1            #in mA/V^2
V_T= 1            # in V
R2= 87*10**3         #in Ω
R1= 110*10**3       # in Ω
R_S=2            #in kΩ
R_D=2            #in kΩ
V_DD= 6             #in V
V_SS= 6          #in V

#CALCULATIONS
V_G= (V_DD+V_SS)*R2/(R1+R2)              # in V
A= R_S**2              # assumed
B= -(2*R_S*(V_G+V_SS-V_T)+1/k)              # assumed
C= (V_G+V_SS-V_T)**2                    #assumed
I_D= 2.6001587           # in mA

#RESULTS
print('The value of I_D is : =%.2f mA' %I_D)
V_DS=V_DD+V_SS-I_D*R_D-I_D*R_S        #in V
print('The value of V_DS  is : =%.2f volts' %V_DS)

The value of I_D is : =2.60 mA
The value of V_DS  is : =1.60 volts


## Example No 9.12 Page No 386¶

In :
import math

#initialisation of variables

k = 0.16                      #in mA/V^2
V_T = 2.0                   #in V
I_D = 0.5                      #in mA
V_DD = 6.0                 #in V
V_SS = -6                 #in V
R_D = 10.0                     #in k ohm

#CALCULATIONS
V_GS = V_T + (math.sqrt(I_D/k))               #in V
R_S = 2                #in k ohm
V_S = (I_D*R_S) - V_DD           # in V
V_G = V_GS+V_S                     # in V
I = 0.1*I_D                 #in mA
R2 = (V_G+V_DD)/I                #in k ohm
print('The value of R2  is =%.2f k ohm' %R2)
R1 = (V_DD - V_G)/I                  #in k ohm
print('The value of R1 is =%.2f k ohm' %R1)
V_DS = (V_DD-V_SS) - (I_D*(R_S+R_D))           #in V
print('The value of V_DS is =%.2f V' %V_DS)
V_DSsat = V_GS-V_T                      # in V

#RESULTS
print('The value of V_DS(sat) is =%.2f V' %V_DSsat)
if V_DS > V_DSsat :
print('The MOSFET is in saturation region')

# Note: The value of R1 is in k ohm but in the book it is wrong.

The value of R2  is =95.36 k ohm
The value of R1 is =144.64 k ohm
The value of V_DS is =6.00 V
The value of V_DS(sat) is =1.77 V
The MOSFET is in saturation region


## Example No 9.13 Page No 387¶

In :
import math

#initialisation of variables
V_DD = 6.0              #in V
V_D = 3.0             #in V
R_D = 10.0             #in k ohm

#CALCULATIONS
I_DQ = (V_DD-V_D)/R_D           #in mA
print('The value of I_DQ is =%.2f mA ' %I_DQ)
V_T = 0.8           #in V
k = 0.12             #in mA/V^2
V_GS = math.sqrt(I_DQ/k) + V_T           #in V
V_S = -V_GS                   #in V
V_DS = V_D-V_S               #in V

#RESULTS
print('The value of V_DS is =%.2f V' %V_DS)

The value of I_DQ is =0.30 mA
The value of V_DS is =5.38 V


## Example No 9.14 Page No 388¶

In :
import math

#initialisation of variables
I_D = 0.3         # in mA
k = 0.12            #in mA/V^2
V_T = 1.0          #in V

#CALCULATIONS
V_GS = V_T + (math.sqrt(I_D/k))          #in V
V_S = -V_GS                             #in V
V_DD = 6.0                  #in V
V_D = 3.0                   # in V
I_DQ = 0.3                   #in mA
R_D = (V_DD-V_D)/I_DQ       #in k ohm

#RESULTS
print('The value of R_D  is =%.2f k ohm' %R_D)
V_DS = V_D - V_S                       #in V
print('The value of V_DS  is =%.2f V' %V_DS)
V_DSsat = V_GS - V_T                 #in V
print('The value of V_DS(sat)  is =%.2f V' %V_DSsat)
if V_DS > V_DSsat :
print('The MOSFET is in saturation region')

The value of R_D  is =10.00 k ohm
The value of V_DS  is =5.58 V
The value of V_DS(sat)  is =1.58 V
The MOSFET is in saturation region


## Example No 9.15 Page No 389¶

In :
#initialisation of variables
k= 0.05             #in mA/V^2
V_T= 1            #in V
V_DD= 6          # in V
R_S= 9.1            #in kΩ
I_D= 0.3631765    # in mA

#CALCULATIONS
A= R_S**2          # assumed
B=-(2*V_DD*R_S+1/k)         # assumed
C= V_DD**2         #assumed
V_GS= V_DD-I_D*R_S   #in V
V_DS= V_GS         # in V

#RESULTS
print('The value of I_D  is : =%.2f mA' %I_D)
print('The value of V_GS  is : =%.2f volts' %V_GS)
print('The value of V_DS  is : =%.2f volts' %V_DS)

The value of I_D  is : =0.36 mA
The value of V_GS  is : =2.70 volts
The value of V_DS  is : =2.70 volts


## Example No 9.16 Page No 390¶

In :
#initialisation of variables
k1= 0.01          #in mA/V^2
k2= 0.05      #in mA/V^2
V_DD= 5         # in V
V_T1=1           # in V
V_T2=1         # in V
Vi= 5         #in V
Vo= 0.3485163   # in V

#CALCULATIONS
A=(k1+k2)
B=-(2*k1*(V_DD-V_T1)+2*k2*(Vi-V_T2))
C=k1*(V_DD-V_T1)**2
V_GS2= Vi             # in V
V_DS2= Vo            # in V
V_GS1= V_DD-Vo         # in V
I_D1= k1*(V_GS1-V_T1)**2            #in mA
I_D2= I_D1                  # in mA
print('Part (i) For Vi = 5 V')
print('The output voltage is : =%.2f volts' %Vo)
print('The value of I_D1  is : =%.2f mA' %I_D1)
print('The value of I_D2  is : =%.2f mA' %I_D2)
# Analysis for Vi= 1.5V
Vi= 1.5         #in V
Vo= V_DD-V_T1-math.sqrt(k2/k1)*(Vi-V_T2)          # in V
I_D2= k2*(Vi-V_T2)**2               #in mA
I_D1= I_D2             #in mA

#RESULTS
print('Part (ii) For Vi = 1.5 V')
print('The output voltage  is : =%.2f volts' %Vo)
print('The value of I_D1  is : =%.2f mA' %I_D1)
print('The value of I_D2  is : =%.2f mA' %I_D2)

Part (i) For Vi = 5 V
The output voltage is : =0.35 volts
The value of I_D1  is : =0.13 mA
The value of I_D2  is : =0.13 mA
Part (ii) For Vi = 1.5 V
The output voltage  is : =2.88 volts
The value of I_D1  is : =0.01 mA
The value of I_D2  is : =0.01 mA


## Example No 9.17 Page No 392¶

In :
#initialisation of variables
k = 0.12         #in mA/V^2
V_T = -2.5        #in V
V_GS = 0

#CALCULATIONS
I_D = k*((V_GS-V_T)**2)        #in mA
print('The value of I_D is =%.2f mA' %I_D)
V_DD = 6            #in V
R_S = 4.7            #in k ohm
V_DS = V_DD -(I_D*R_S)         #in V
print('The value of V_DS  is =%.2f V' %V_DS)
V_S = 0               # in V
V_DSsat = V_S - V_T            # in V

#RESULTS
print('The value of V_DS(sat) is  =%.2f V' %V_DSsat)
if V_DS < V_DSsat :
print('The device is in the non saturation region')

The value of I_D is =0.75 mA
The value of V_DS  is =2.47 V
The value of V_DS(sat) is  =2.50 V
The device is in the non saturation region


## Example No 9.18 Page No 394¶

In :
import math

#initialisation of variables
k4 = 0.125            #in mA/V^2
k3 = k4              #in mA/V^2
k2 = k4               #in mA/V^2
k1 = 0.25             #in mA/V^2
V_T1 = 0.8            # in V
V_T2 = V_T1           # in V
V_T3 = V_T1          #in V
V_T4 = V_T1           #in V
V_SS = -5             #in V
V_DD = 5              #in V
R_D = 10              #in k ohm

#CALCULATIONS
V_GS3 = ((math.sqrt(k4/k3) * (-V_SS - V_T4))+V_T3)/(1+math.sqrt(k4/k3))          #in V
I_Q = k2*((V_GS3-V_T2)**2)          #in mA
I_D1 = I_Q                   #in mA
V_GS1 = V_T1 + (math.sqrt(I_D1/k1))                 #in V

#RESULTS
print('The value of V_GS1 is =%.2f V ' %V_GS1)
V_DS2 = (-V_SS-V_GS1)            #in V
print('The value of V_DS2 is =%.2f V ' %V_DS2)
V_DS1 = V_DD - (I_Q*R_D) - (V_SS + V_DS2)            #in V
print('The value of V_DS1 is =%.2f  V' %V_DS1)

The value of V_GS1 is =2.00 V
The value of V_DS2 is =3.00 V
The value of V_DS1 is =3.39  V


## Example No 9.19 Page No 395¶

In :
import math

#initialisation of variables
R2 = 20.0               # in  k ohm
R1 = 30.0               #in  k ohm
R_D = 20               # in  k ohm

#CALCULATIONS
R_D=R_D*10**3         #in ohm
V_DD = 5              #in V
V_G = (R2/(R1+R2))*V_DD             #in V
V_S = 0                     #in V
V_GS = V_G                   #in V
k = 100*10**-6             #in A/V^2
V_T = 1                    #in V
I_DQ = k*((V_GS-V_T)**2)       #in A

#RESULTS
V_DSQ = V_DD - (I_DQ*R_D)             #in V
print('The value of V_DSQ  is =%.f V ' %V_DSQ)
I_DQ=I_DQ*10**6
print('The value of I_DQ  is =%.f  µA' %I_DQ)

The value of V_DSQ  is =3 V
The value of I_DQ  is =100  µA


## Example No 9.20 Page No 395¶

In :
#initialisation of variables
V_P= -8            # in V
R_S= 2.4           #in kΩ
I_DSS= 8           #in mA
V_DD= 20            #in V
R_D= 6.2           #in kΩ
I_D= 1.7668305   #in mA

#CALCULATIONS
A= R_S**2
B=(2*R_S*(V_P)-V_P**2/I_DSS)
C=(V_P)**2
I_DQ= I_D             #in mA
V_GSQ= -I_D*R_S;
V_D= V_DD-I_D*R_D           #in V

#RESULTS
print('The value of I_DQ is : =%.2f  mA' %I_DQ)
print('The value of V_GSQ  : =%.2f  volts' %V_GSQ)
print('The value of V_D  is : =%.2f  volts' %V_D)

The value of I_DQ is : =1.77  mA
The value of V_GSQ  : =-4.24  volts
The value of V_D  is : =9.05  volts


## Example No 9.21 Page No 396¶

In :
#initialisation of variables
k= 75*10**-3              #in mA/V^2
Vth= -0.8                  #in V
R2 = 100                   #in k ohm
R1 = 100                   #in  k ohm
R_S= 6                     # in kΩ
R_D= 3                   # in kΩ
V_SS = 10                 # in V
V_S = 2.0602803

#CALCULATIONS
V_G = (R2/(R1+R2))*V_SS                  #in V
V_GS= V_G-V_S                          #in V
I_D= k*(V_GS-Vth)**2                           # in V
V_DS= -V_SS+I_D*(R_D+R_S)                # in V
V_D= I_D*R_D                            #in V

#RESULTS
print('The value of I_D  is : =%.2f mA ' %I_D)
print('The value of V_DS  is =%.2f volts ' %V_DS)
print('The value of V_D  is : =%.2f  volts' %V_D)
print('The value of V_S  is : =%.2f  volts' %V_S)

The value of I_D  is : =0.12 mA
The value of V_DS  is =-8.93 volts
The value of V_D  is : =0.36  volts
The value of V_S  is : =2.06  volts


## Example No 9.22 Page No 396¶

In :
import math

#initialisation of variables
V_T = 1.0                      # in V
k = 160*10**-6               # in A/V^2
I_DQ = 160*10**-6            # in A

#CALCULATIONS
V_GS = V_T + math.sqrt(I_DQ/k)         #in V
V_DD = 5              # in V
V_DSQ = 3             # in V
R_D = (V_DD - V_DSQ)/(I_DQ)            # in ohm
R_D = R_D * 10**-3                 # in k ohm

#RESULTS
print('The value of R_D  is =%.2f k ohm' %R_D)

The value of R_D  is =12.50 k ohm


## Example No 9.23 Page No 397¶

In :
#initialisation of variables
V_DD= 12          # in V
V_T= 2            # in V
kn= 0.5           # in mA/V^2
R1 = 2.2         # in M ohm
R2 = 1.8         # in M ohm
R_S= 1.5         # in kΩ
R_D= 3.9         # in kΩ
I_D= 1.2237155                   # in mA

#CALCULATIONS
V_G = (R2/(R1+R2))*V_DD         # in V
V_GS= V_G-I_D*R_S              # V
I_D= I_D-kn*(V_GS-V_T)**2      # in mA
I_DQ= I_D                     #in mA
V_DSQ= V_DD-I_D*(R_D+R_S)      # in V

#RESULTS
print('The value of I_DQ  is : =%.2f mA ' %I_DQ)
print('The value of V_DSQ  is : =%.2f  volts' %V_DSQ)
V_GS= V_G-I_D*R_S            # V
V_DSsat= V_GS-V_T          # in V
print('The value of  V_DS  %.2f  is greater than the value of ' %V_DSQ)
print('V_DSsat %.2f So the MOSFET is in saturation region ' %V_DSsat)

The value of I_DQ  is : =-0.00 mA
The value of V_DSQ  is : =12.00  volts
The value of  V_DS  12.00  is greater than the value of
V_DSsat 3.40 So the MOSFET is in saturation region


## Example 9.24 Page No 397¶

In :
#initialisation of variables
kn= 0.5           # in mA/V^2
V_T= 1          # in V
R2 = 40         # in k ohm
R1 = 60         # in k ohm
R_S= 1          # in k ohm
R_D= 2          # in k ohm
V_DD = 5        # in V
V_SS = -5       # in V

#CALCULATIONS
V_R2 = (R2/(R2+R1))*(V_DD-V_SS)            # in V
V_G = V_R2 - V_DD               # in V
V_S= I_D*R_S+V_SS              # in V
V_GS= V_G-V_S                  # in V
I_D= 1.3542487                  # in mA
I_DQ= I_D                      #in mA
V_S= I_D*R_S+V_SS            # in V
V_GS= V_G-V_S                # in V
V_DSQ= V_DD-V_SS-I_D*(R_D+R_S)         # in V

#RESULTS
print('The value of I_DQ  is :=%.2f mA ' %I_DQ)
print('The value of V_GS  is : =%.2f volts ' %V_GS)
print('The value of V_DSQ  is : =%.2f  volts' %V_DSQ)

The value of I_DQ  is :=1.35 mA
The value of V_GS  is : =-1.35 volts
The value of V_DSQ  is : =5.94  volts


## Example No 9.25 Page No 398¶

In :
#initialisation of variables
R_S1 = 100*10**-3      # in k ohm
R_S2 = 100*10**-3      # k ohm
R_S = R_S1+R_S2        #in k ohm
R_D= 1.8               # in k ohm
I_DSS= 12             # in mA
Vp= -3.5              # in V
V_DD= 22              # in V
rd= 25                # in k ohm
R_L= 47               # in k ohm
I_D= 5.573521          # in mA

#CALCULATIONS
V_GS= -I_D*R_S     # in V
I_D= I_D-I_DSS*(1-V_GS/Vp)**2   # in mA
print('The value of I_D  is : =%.2f  mA' %I_D)
V_GS= -I_D*R_S           # in V
print('The value of V_GS  is : =%.2f volts ' %V_GS)
V_DS= V_DD-I_D*(R_D+R_S)          # in V
print('The value of V_DS  is :  =%.2f volts ' %V_DS)
gmo= -2*I_DSS/Vp              # in mS
gm= gmo*(1-V_GS/Vp)           # in mS
miu= gm*rd
Av= -miu*R_D*R_L/(R_D+R_L)/(rd+R_D*R_L/(R_D+R_L)+(1+miu)*R_S1)
print('The value of Av is :  =%.2f  ' %Av)

The value of I_D  is : =-0.000000  mA
The value of V_GS  is : =0.00 volts
The value of V_DS  is :  =22.00 volts
The value of Av is :  =-6.76


## Example No 9.26 Page No 399¶

In :
#initialisation of variables
V_T = 1                # in V
k = 0.5               # in mA/V^2
R2 = 40              # in k ohm
R1 = 60             # in k ohm
R_S= 1               # in k ohm
R_D= 2              # in k ohm
V_DD = 5            # in V
V_G = (R2/(R2+R1))*V_DD         # in V
V_GS= V_G-I_D*R_S                # in V
I_D= 0.2679492                     # in mA
V_GS= V_G-I_D*R_S                 # in V
V_DS= V_DD-I_D*(R_D+R_S)          # in V

#RESULTS
print('The value of I_D in mA is : =%.2f  ' %I_D)
print('The value of V_GS in volts is :=%.2f  ' %V_GS)
print('The value of V_DS in volts is : =%.2f  ' %V_DS)

The value of I_D in mA is : =0.27
The value of V_GS in volts is :=-0.27
The value of V_DS in volts is : =4.20


## Example No 9.27 Page No 400¶

In :
#initialisation of variables
R_D = 7.5             # in k ohm
V_T = -0.8             # in V
k = 0.2              # in mA/V^2
R2 = 50                # in ohm
R1 = 50               # in  ohm
V_DD = 5             # in V
V_S = 5            # in V

#CALCULATIONS
V_G = (R2/(R2+R1))*V_DD          # in V
V_GS = V_G - V_S            # in V
I_D = k*((V_GS-V_T)**2)        # in mA

#RESULTS
print('Drain current in is =%.2f mA' %I_D)
V_SD = V_DD - (I_D*R_D)    # in V
print('Source to drain voltage  is =%.2f V' %V_SD)

Drain current in is =3.53 mA
Source to drain voltage  is =-21.46 V


## Example 9.28 Page No 400¶

In :
#initialisation of variables
I_Don = 5*10**-3            # in A
V_GSon = 6                # in V
V_GSth = 3                # in V
k = I_Don/(V_GSon-V_GSth)**2      # in A/V^2
R2 = 6.8                  #in M ohm
R1 = 10                  #in M ohm
R_S= 750                # in ohm
R_D= 2.2*10**3        # in ohm
V_DD = 24             # in V
R_S = 750           # in  ohm
V_G= R2*V_DD/(R1+R2)         # in V
V_GS= V_G-I_D*R_S           # in V
I_D= I_D-k*(V_GS-V_GSth)**2
I_D= 0.0049660              # in A
I_DQ= I_D                    # in A
V_GS= V_G-I_D*R_S           # in V
V_GSQ= V_GS                 # in V
V_DSQ= V_DD-I_DQ*(R_D+R_S)       # in V
I_D=I_D*10**3

#RESULTS
print('The value of I_D  is : =%.2f mA ' %I_D)
print('The value of V_GSQ  is : =%.2f volts ' %V_GSQ)
print('The value of V_DSQ  is : =%.2f volts ' %V_DSQ)

The value of I_D  is : =4.97 mA
The value of V_GSQ  is : =5.99 volts
The value of V_DSQ  is : =9.35 volts


## Example No 9.29 Page No 401¶

In :
#initialisation of variables
I_Don = 4*10**-3              # in A
V_GSon = 6                 # in V
V_GSth = 3                 # in V
V_DS= 6                    # in V
I_D= I_Don                 # in A
k = I_Don/((V_GSon-V_GSth)**2)        # in A/V^2
V_GS= I_D-k*(V_GS-V_GSth)**2
V_GS= 6           # in V
V_DD= 2*V_DS               # in V
R_D= (V_DD-V_GS)/I_D            # in ohm

#RESULTS
print('The value of V_GS  is : =%.f volts ' %V_GS)
print('The value of V_DD  is : =%.f volts ' %V_DD)
print('The value of R_D  is : =%.f  kΩ' %R_D)

The value of V_GS  is : =6 volts
The value of V_DD  is : =12 volts
The value of R_D  is : =1500  kΩ


## Example No 9.31 Page No 402¶

In :
#initialisation of variables
V_DD = 5               # in V
V_T= 1                  # in V
k= 1             # in mA/V^2
R1 = 1           # in M ohm
R2 = 1           # in M ohm
R_S= 2            # in k ohm
R_D= 2           # in k ohm
I1 = V_DD/(R1+R2)         # in A
print('The value of I1  is : =%.2f  µA' %I1)
V_A = (R2/(R2+R1))*V_DD              # in V
print('The value of V_A and V_G  is :  =%.2f volts ' %V_A)
I_D= 0.4243061
V_C= I_D*R_S              # in V
V_GS= V_A-V_C            # in V
print('The value of I_D  is : =%.2f  mA' %I_D)
V_B= V_DD-I_D*R_D       # in V
V_C= I_D*R_S         # in V
V_DS= V_B-V_C       # in V

#RESULTS
print('The value of V_B  is : =%.2f volts ' %V_B)
print('The value of V_C  is : =%.2f volts ' %V_C)
print('The value of V_DS  is : =%.2f  volts' %V_DS)
# Note: In the book, the calculated values are wrong, this is why the answer in the book is wrong.

The value of I1  is : =2.00  µA
The value of V_A and V_G  is :  =0.00 volts
The value of I_D  is : =0.42  mA
The value of V_B  is : =4.15 volts
The value of V_C  is : =0.85 volts
The value of V_DS  is : =3.30  volts


## Example No 9.32 Page No 403¶

In :
import math

#initialisation of variables
I_DSS = 12            # in mA
I_DSS= I_DSS*10**-3      # in A
V_P = -3              # in V
r_d = 45             # in k ohm

#CALCULATIONS
r_d= r_d*10**3           # in ohm
g_m = I_DSS/abs(V_P) # in S
#Part (i)
R1 = 91           # in M ohm
R1=R1*10**6        #in ohm
R2 = 10           # in M ohm
R2= R2*10**6      # in ohm
Ri= R1*R2/(R1+R2)      # in ohm
Ri=Ri*10**6

#RESULTS
print('The value of Ri  is :  =%.f Mohm' %(Ri/(10**12)))
#Part (ii)
R_S = 1.1      #in k ohm
R_S = R_S * 10**3       # in ohm
R_o= (R_S*1/g_m)/(R_S+1/g_m)      # in ohm
print('The value of R_C  is :  =%.2f  ohm' %R_o)

# Part (iii)
R_desh_o= R_o*r_d/(R_o+r_d)   # in ohm
print('The value of R_desh_o  is :  =%.2f ohm ' %R_desh_o)
# Part (iv)
Av= g_m*(R_S*r_d/(R_S+r_d))/(1+g_m*(R_S*r_d/(R_S+r_d)))
print('The value of Av is :  =%.2f ' %Av)

The value of Ri  is :  =9 Mohm
The value of R_C  is :  =203.70  ohm
The value of R_desh_o  is :  =202.79 ohm
The value of Av is :  =0.81


## Example No 9.34 Page No 404¶

In :
#initialisation of variables
V_S2 = -2   # in V
V_GS2 = -V_S2    # in V

#CALCULATIONS
I_DS2 = (V_GS2-1)**2        # in mA
I = 2           # in mA
I_DS1 = I-I_DS2      # in mA

#RESULTS
print('The current flow through M1 MOSFET  is =%.f mA' %I_DS1)

The current flow through M1 MOSFET  is =1 mA


## Example No 9.35 Page No 404¶

In :
#initialisation of variables
V_DD= 10         # in V
I_D= 0.4*10**3       # in A
W= 100           # in µm
L= 10           # in µm
uACox= 20         # in A/V**2
Vt= 2            # in V
R= 0.015
V_GS= V_DD-I_D*R      # in V

#RESULTS
print('The value of R  is : =%.f kΩ ' %(R*10**3))
V_D= V_DD-I_D*R           # in V
print('The value of V_D  is : =%.f volts  ' %V_D)

The value of R  is : =15 kΩ
The value of V_D  is : =4 volts


## Example No 9.36 Page No 405¶

In :
#initialisation of variables
V_GSth= 2         # in V
k= 2*10**-4       # in A/V^2
V_DD= 12          # in V
R_D= 5*10**3      # in ohm
I_D= 0.0014597

#CALCULATIONS
V_DS= V_DD-I_D*R_D         # in V

#RESULTS
print('The value of V_DS  is : =%.1f volts ' %V_DS)

The value of V_DS  is : =4.7 volts