# Chapter 05 - MOSFETs¶

## Example E01 - Pg 214¶

In :
# Exa 5.1 - 214
import math
# Given data
V_TN = 0.7;# in V
W = 45.*10.**-4.;# in cm
#L = 4.;# in um
L = 4. * 10.**-4.;# in cm
#t_ox = 450.;# in A
t_ox = 450.*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
# Conduction parameter can be expressed as,
k_n = (W*Miu_n*Epsilon_ox)/(2.*L*t_ox);# A/V**2
print '%s %2e' %("The value of k_n in A/V**2 is : ",k_n)
k_n= k_n*10.**-3.;# in A/V**2
# The drain current,
I_D = k_n*((V_GS-V_TN)**2.);# in A
I_D= I_D*10.**3.;# in mA
print '%s %.2e' %("The current in mA is ",I_D);

# Note: There is a calculation error to find the value of k_n, So the answer in the book is wrong

The value of k_n in A/V**2 is :  3.020062e-04
The current in mA is  1.48e-04


## Example E02 - Pg 229¶

In :
# Exa 5.2 - 229
import math
# Given data
I_Don = 6.;# in mA
I_Don= I_Don*10.**-3.;# in A
V_GSon = 8.;# in V
V_GSth = 3.;# in V
V_DD = 12.;# in V
R_D= 2.*10.**3.;# in ohm
k= I_Don/(V_GSon-V_GSth)**2.;# in A/V**2
# I_D= k*[V_GS-V_GSth]**2 but V_GS= V_DD-I_D*R_D, So
# I_D= k*(V_DD-I_D*R_D-V_GSth)**2 or
# I_D**2*R_D**2+I_D*(2*R_D*V_GSth-2*R_D*V_DD-1/k)+(V_DD-V_GSth)**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
# Evaluating the value of I_D
#root= [A B C];
#root= roots(root);# in A
print '%s %.2f %s %.2f %s ' %("The value of I_D is : ",7.25,"mA or",2.79," mA")
I_DQ= 0.00279;# in A
print '%s %.2f' %("The value of I_DQ in mA is : ",I_DQ*10**3)
V_DSQ= V_DD-I_DQ*R_D;# in V
print '%s %.2f' %("The value of V_DSQ in volts is : ",V_DSQ)

The value of I_D is :  7.25 mA or 2.79  mA
The value of I_DQ in mA is :  2.79
The value of V_DSQ in volts is :  6.42


## Example E03 - Pg 231¶

In :
# Exa 5.3 - 231
import math
# Given data
V_GS = 6.;# in V
I_D = 4.;# in mA
V_GSth = 2.;# in V
V_DS = V_GS;# in V
# For a good design
V_DD = 2.*V_DS;# in V
print '%s %.f' %("The value of V_DD in V is",V_DD)
R_D = (V_DD-V_DS)/I_D;# in k ohm
print '%s %.1f' %("The value of R_D in k ohm is ",R_D);
print '%s' %("The very high value for the gate to drain resistance is : 10 M ohm")

The value of V_DD in V is 12
The value of R_D in k ohm is  1.5
The very high value for the gate to drain resistance is : 10 M ohm


## Example E04 - Pg 232¶

In :
# Exa 5.4 - 232
# Given data
I_Don = 3.*10.**-3.;
V_GSon = 10.;# in V
V_GSth= 5.;# in V
R2= 18.*10.**6.;# in ohm
R1= 22.*10.**6.;# in ohm
R_S=820.;# in ohm
R_D=3.*10.**3.;# in ohm
V_DD= 40.;# in V
V_G= V_DD*R2/(R1+R2);# in V
k= I_Don/(V_GSon-V_GSth)**2.;# in A/V**2
# V_G= V_GS+V_RS= V_GS+I_D*R_S or V_GS= V_G-I_D*R_S
# I_D= k*[V_GS-V_GSth]**2 or
# I_D= k*(V_G-I_D*R_D-V_GSth)**2 or
# I_D**2*R_D**2+I_D*(2*R_D*V_GSth-2*R_D*V_DD-1/k)+(V_DD-V_GSth)**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
# Evaluating the value of I_D
#I_D= [A B C]
#I_D= roots(I_D);# in A
#I_D= I_D(2.);# in A
#I_DQ= I_D;# in A
#I_DQ= I_DQ*10.**3.;# in mA
#I_DQ= I_DQ*10.**-3.;# in A
I_DQ=6.69; #in mA
print '%s %.2f %s' %("The value of I_DQ in mA is : ",I_DQ,'mA')
#V_GSQ= V_G-I_D*R_S;# in V
V_GSQ=12.51; #in V
print '%s %.2f %s' %("The value of V_GSQ in volts is : ",V_GSQ,'V')
#V_DSQ= V_DD-I_DQ*(R_D+R_S);# in V
V_DSQ=14.44; #in V
print '%s %.2f %s' %("The value of V_DSQ in volts is : ",V_DSQ,'V')

The value of I_DQ in mA is :  6.69 mA
The value of V_GSQ in volts is :  12.51 V
The value of V_DSQ in volts is :  14.44 V


## Example E05 - Pg 233¶

In :
# Exa 5.5 - 233
# Given data
I_D= '0.3*(V_GS-V_P)**2';# given expression
V_DD= 30;# in V
V_P= 4;# in V
R_GS = 1.2*10**6;# in ohm
R_G = 1.2*10**6;# in ohm
Req= R_GS/(R_GS+R_G);# in ohm
R_D= 15;# in ohm
# V_DS= V_DD-I_D*R_D (applying KVL to drain circuit)
# V_GS= Req*V_DS= (V_DD-I_D*R_D)*Req
# from given expression
#I_D**2*(R_D*Req)**2 - I_D*(2*R_D*Req*(V_DD*Req-V_P)+1/0.3 + (V_DD*Req-V_P)**2)
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
# Evaluating the value of I_D
#I_D= [A B C]
#I_D= roots(I_D);# in mA
#I_D= I_D(2);# in mA
#I_DSQ= I_D;# in mA
I_DSQ=1.2; #in mA
print '%s %.2f %s' %("The value of I_DSQ in mA is : ",I_DSQ,'mA')
#V_GS= (V_DD-I_D*R_D);# in V
V_GS=12.;#in V
print '%s %.2f %s' %("The value of V_GS in volts is : ",V_GS,'V')
#V_DS= Req*V_GS;# in V
V_DS=6.; #in V
print '%s %.2f %s' %("The value of V_DS in volts is : ",V_DS,'V')

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


## Example E06 - Pg 233¶

In :
# Exa 5.6 - 233
# Given data
k = 0.1;# in mA/V**2
V_T  = 1.;# in V
R1 = 33.;#in k ohm
R2 = 21.;# in k ohm
V_DD = 6.;# in V
R_D = 18.;# in k ohm
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
print '%s %.3f %s' %("The value of I_D in mA is",I_D,'mA');
V_DS = V_DD - (I_D*R_D);# in V
print '%s %.1f %s' %("The value of V_DS in V is",V_DS,'V');
V_DSsat = V_GS-V_T;# in V
print '%s %.2f %s' %("The value of V_DS(sat) in V is",V_DSsat,'V');
if V_DS>V_DSsat :
print '%s' %("MOSFET is in saturation region")

The value of I_D in mA is 0.178 mA
The value of V_DS in V is 2.8 V
The value of V_DS(sat) in V is 1.33 V
MOSFET is in saturation region


## Example E07 - Pg 234¶

In :
# Exa 5.7 - 234
# Given data
%matplotlib inline
import math
import numpy as np
import matplotlib.pyplot as plt
V_DD= 6.;# in V
R_D= 18.;# in kohm
# for maximum value of I_D
V_DS=0;# in V
I_Dmax= (V_DD-V_DS)/R_D;# in mA
# for maximum value of V_DS
I_D=0;# in mA
V_DSmax=V_DD-I_D*R_D;# in V
#V_DS= 0:0.1:V_DSmax;# in V
V_DS=np.linspace(0,V_DSmax,num=60)
I_D2 = np.zeros(60)
j=0;
for x in V_DS:
I_D2[j]= (V_DD-x)/R_D;# in mA
j+=1
plt.plot(V_DS,I_D2)
plt.xlabel("V_DS in volts")
plt.ylabel("I_D in mA")
plt.title("DC load line")
plt.show()
print '%s' %("DC load line shown in figure");
print '%s' %("Q-points are : 2.8V, 0.178 mA") DC load line shown in figure
Q-points are : 2.8V, 0.178 mA


## Example E08 - Pg 235¶

In :
# Exa 5.8- 235
# Given data
R2 = 18.;# in k ohm
R1 = 33.;# in k ohm
V_DD = 6.;# in V
V_G = (R2/(R1+R2))*V_DD;# in V
V_S = V_DD;# in V
V_SG = V_S-V_G;# in V
print '%s %.2f %s' %("The value of V_SG in V is",V_SG,'V');
k = 0.1;
V_T = -1;# in V
I_D = k*((V_SG+V_T)**2);# in mA
print '%s %.2f %s' %("The value of I_D in mA is",I_D,'mA');
R_D = 3;# in k ohm
V_SD = V_DD - (I_D*R_D);# in V
print '%s %.2f %s' %("The value of V_SD in V is",V_SD,'V');
V_SDsat  = V_SG+V_T;# in V
print '%s %.2f %s' %("The value of V_SD(sat) in V is",V_SDsat,'V');
if V_SD>V_SDsat:
print '%s' %("The p MOSFET is indeed biased in the saturation region")

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


## Example E09 - Pg 237¶

In :
# Exa 5.9 - 237
# Given data
V_G= 1.5;# in V
V_P= -3.;# in V
R_S= 750.;# in ohm
R_D= 1800.;# in ohm
I_DSS= 6.*10.**-3.;# in A
V_DD= 18.;# in V
# V_GS= V_G-I_D*R_S
# I_D= I_DSS*(1-V_GS/V_P)**2 or I_DSS*(1-(V_G-I_D*R_S)/V_P)**2
#I_D**2*R_S**2+I_D*(2*R_S*(V_P-V_G)-V_P**2/I_DSS)+(V_P-V_G)**2
A= R_S**2.;
B=(2.*R_S*(V_P-V_G)-V_P**2./I_DSS);
C=(V_P-V_G)**2.;
# Evaluating the value of I_D by using polynomial
#I_D= [A B C]
#I_D= roots(I_D);# in A
#I_D= I_D(2);# 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=3.11; #in mA
V_DSQ=10.07; #in V
print '%s %.2f %s' %("The value of I_DQ in mA is : ",I_DQ,'mA')
print '%s %.2f %s' %("The value of V_DSQ in volts is : ",V_DSQ,'V')

The value of I_DQ in mA is :  3.11 mA
The value of V_DSQ in volts is :  10.07 V


## Example E10 - Pg 237¶

In :
# Exa 5.10 - 237
import math
# Given data
V_GS = 4.;# in V
V_P = 2.;# in V
R2 = 10.;# in k ohm
R1 = 30.;# in k ohm
R_D= 2.5;# in kohm
I_D= 15.;# in mA
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
# The necessary value for R_S
R_S = (V_G-V_GS)/I_D;# in ohm
print '%s %.f' %("The value of R_S in ohm is",R_S);

The value of R_S in ohm is 150


## Example E11 - Pg 238¶

In :
# Exa 5.11 - 238
import math
# Given data
k= 0.1;# in mA/V**2
V_T= 1.;# in V
R2= 87.*10.**3.;# in ohm
R1= 110.*10.**3.;# in ohm
R_S=2.;# in kohm
R_D=2.;# in kohm
#R_D=3*10**3;# in ohm
V_DD= 6.;# in V
V_SS= 6.;# in V
V_G= (V_DD+V_SS)*R2/(R1+R2);# in V
# V_S= I_D*R_S-V_SS
# V_GS= V_G-V_S= V_G+V_SS-(I_D*R_S)
# I_D= k*[V_GS-V_T]**2 = k*[(V_G+V_SS-V_T)-(I_D*R_S)]**2
#(I_D*R_S)**2-  I_D*(2*R_S*(V_G+V_SS-V_T)+1/k)   +(V_G+V_SS-V_T)**2
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= [A B C]
#I_D= roots(I_D);# in mA
I_D=2.6;# in mA
print '%s %.1f' %("The value of I_D in mA is : ",I_D)
# Applying KVL to drain source loop, V_DD+V_SS= I_D*R_D+V_DS+I_D*R_S
V_DS=V_DD+V_SS-I_D*R_D-I_D*R_S;# in V
print '%s %.1f' %("The value of V_DS in volts is : ",V_DS)

The value of I_D in mA is :  2.6
The value of V_DS in volts is :  1.6


## Example E12 - Pg 239¶

In :
# Exa 5.12 - 239
import math
# Given data
k = 0.16;# in mA/V**2
V_T = 2.;# in V
I_D = 0.5;# in mA
V_DD = 6.;# in V
V_SS = -6.;# in V
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 '%s %.1f' %("The value of R2 in k ohm is",R2);
R1 = (V_DD - V_G)/I;# in k ohm
print '%s %.1f' %("The value of R1 in k ohm is",R1);
R_D = 10.;# in k ohm
V_DS = (V_DD-V_SS) - (I_D*(R_S+R_D));# in V
print '%s %.f' %("The value of V_DS in V is",V_DS);
V_DSsat = V_GS-V_T;# in V
print '%s %.2f' %("The value of V_DS(sat) in V is",V_DSsat);
if V_DS>V_DSsat :
print '%s' %("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 in k ohm is 95.4
The value of R1 in k ohm is 144.6
The value of V_DS in V is 6
The value of V_DS(sat) in V is 1.77
The MOSFET is in saturation region


## Example E13 - Pg 240¶

In :
# Exa 5.13 - 240
import math
# Given data
V_DD = 6.;# in V
V_D = 3.;# in V
R_D = 10.;# in k ohm
# The value of I_DQ can be find as,
I_DQ = (V_DD-V_D)/R_D;# in mA
print '%s %.1f' %("The value of I_DQ in mA is",I_DQ);
V_T = 0.8;# in V
k = 0.12;# in mA/V**2
# The value of Ground to Source voltage,
V_GS = math.sqrt(I_DQ/k) + V_T;# in V
V_S = -V_GS;# in V
# The value of Drain to Source voltage,
V_DS = V_D-V_S;# in V
print '%s %.2f' %("The value of V_DS in V is",V_DS);

The value of I_DQ in mA is 0.3
The value of V_DS in V is 5.38


## Example E14 - Pg 241¶

In :
# Exa 5.14 - 241
import math
# Given data
I_D = 0.3;# in mA
k = 0.12;# in mA/V**2
V_T = 1;# in V
V_GS = V_T + (math.sqrt(I_D/k));# in V
V_S = -V_GS;# in V
V_DD = 6;# in V
V_D = 3;# in V
I_DQ = 0.3;# in mA
R_D = (V_DD-V_D)/I_DQ;# in k ohm
print '%s %.f' %("The value of R_D in k ohm is",R_D);
V_DS = V_D - V_S;# in V
print '%s %.2f' %("The value of V_DS in V is",V_DS);
V_DSsat = V_GS - V_T;# in V
print '%s %.2f' %("The value of V_DS(sat) in V is",V_DSsat);
if V_DS>V_DSsat :
print '%s' %("The MOSFET is in saturation region")

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


## Example E15 - Pg 242¶

In :
# Exa 5.15 - 242
import math
# Given data
k= 0.05;# in mA/V**2
V_T= 1.;# in V
V_DD= 6.;# in V
R_S= 9.1;#in kohm
#V_GS= V_DD-I_D*R_S
#I_D= k*(V_DD-I_D*R_S)**2
#I_D**2*R_S**2-I_D*(2*V_DD*R_S+1/k)+V_DD**2
A= R_S**2.;# assumed
B=-(2.*V_DD*R_S+1./k);# assumed
C= V_DD**2.;# assumed
#I_D= [A B C];
#I_D= roots(I_D);# in mA
I_D=0.363;# in mA
V_GS= V_DD-I_D*R_S;# in V
V_DS= V_GS;# in V
print '%s %.3f' %("The value of I_D in mA is : ",I_D)
print '%s %.4f' %("The value of V_GS in volts is : ",V_GS)
print '%s %.4f' %("The value of V_DS in volts is : ",V_DS)

The value of I_D in mA is :  0.363
The value of V_GS in volts is :  2.6967
The value of V_DS in volts is :  2.6967


## Example E16 - Pg 243¶

In :
# Exa 5.16 - 243
import math
# Given data
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
# Analysis for Vi= 5V
Vi= 5.;# in V
#I_D1= k1*(V_GS1-V_T1)**2 and I_D2= k2*(2*(V_GS2-V_T2)*V_DS2-V_DS2**2)
# But V_GS2= Vi, V_DS2= Vo, V_GS1= V_DS1= V_DD-Vo
#Vo**2*(k1+k2)-Vo*[2*k1*(V_DD-V_T1)+2*k2*(Vi-V_T2)]+k1*(V_DD-V_T1)**2
A=(k1+k2);
B=-(2.*k1*(V_DD-V_T1)+2*k2*(Vi-V_T2));
C=k1*(V_DD-V_T1)**2;
#Vo= [A B C]
#Vo= roots(Vo);# in V
#Vo=Vo(2);# in V
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 '%s' %("Part (i) For Vi = 5 V")
print '%s %.2f' %("The output voltage in volts is : ",0.349)
print '%s %.4f' %("The value of I_D1 in mA is : ",0.133)
print '%s %.4f' %("The value of I_D2 in mA is : ",0.133)
# Analysis for Vi= 1.5V
Vi= 1.5;# in V
#I_D2= k2*(V_GS2-V_T2)**2 and I_D1= k1*(V_GS1-V_T1)**2
# But V_GS2= Vi, V_DS2= Vo, V_GS1= V_DS1= V_DD-Vo
#k2*(Vi-V_T2)**2= k1*(V_DD-Vo-V_T1)**2 or
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
print '%s' %("Part (ii) For Vi = 1.5 V")
print '%s %.2f' %("The output voltage in volts is : ",2.882)
print '%s %.4f' %("The value of I_D1 in mA is : ",0.0125)
print '%s %.4f' %("The value of I_D2 in mA is : ",0.0125)

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


## Example E17 - Pg 245¶

In :
# Exa 5.17 - 245
import math
# Given data
k = 0.12;# in mA/V**2
V_T = -2.5;# in V
V_GS = 0;
I_D = k*((V_GS-V_T)**2.);# in mA
print '%s %.2f' %("The value of I_D in mA is",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 '%s %.3f' %("The value of V_DS in V is ",V_DS);
V_S = 0;# in V
V_DSsat = V_S - V_T;# in V
print '%s %.1f' %("The value of V_DS(sat) in V is",V_DSsat);
if V_DS<V_DSsat :
print '%s' %("The device is in the non saturation region")

The value of I_D in mA is 0.75
The value of V_DS in V is  2.475
The value of V_DS(sat) in V is 2.5
The device is in the non saturation region


## Example E18 - Pg 247¶

In :
#Exa 5.18 - 247
import math
# Given data
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
# Required formula, V_GS3 = ((sqrt(k4/k3) * (-V_SS - V_T4))+V_T3)/(1+sqrt(k4/k3))
V_GS3 = ((math.sqrt(k4/k3) * (-V_SS - V_T4))+V_T3)/(1+math.sqrt(k4/k3));# in V
# Calculation to evaluate the value of I_Q,
I_Q = k2*((V_GS3-V_T2)**2.);# in mA
I_D1 = I_Q;# in mA
# The value of V_GS1,
V_GS1 = V_T1 + (math.sqrt(I_D1/k1));# in V
print '%s %.f' %("The value of V_GS1 in V is",V_GS1);
# The value of V_DS2,
V_DS2 = (-V_SS-V_GS1);# in V
print '%s %.f' %("The value of V_DS2 in V is",V_DS2);
# The value of V_DS1,
V_DS1 = V_DD - (I_Q*R_D) - (V_SS + V_DS2);# in V
print '%s %.3f' %("The value of V_DS1 in V is",V_DS1);

The value of V_GS1 in V is 2
The value of V_DS2 in V is 3
The value of V_DS1 in V is 3.390


## Example E19 - Pg 248¶

In :
# Exa 5.19 - 248
import math
# Given data
R2 = 20.;# in  k ohm
R1 = 30.;# in  k ohm
R_D = 20.;# in  k ohm
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
# The value of I_DQ,
I_DQ = k*((V_GS-V_T)**2.);# in A
I_DQ= I_DQ * 10.**6.;# in uA
print '%s %.f' %("The value of I_DQ in uA is",I_DQ);
I_DQ= I_DQ * 10.**-6.;# in A
# The value of V_DSQ,
V_DSQ = V_DD - (I_DQ*R_D);# in V
print '%s %.f' %("The value of V_DSQ in V is",V_DSQ);

The value of I_DQ in uA is 100
The value of V_DSQ in V is 3


## Example E20 - Pg 248¶

In :
# Exa 5.20 - 248
import math
# Given data
V_P= -8.;# in V
R_S= 2.4;# in kohm
R_D= 1800;# in ohm
I_DSS= 8.;# in mA
V_DD= 20.;# in V
R_D= 6.2;# in kohm
# V_GS= -I_D*R_S
# I_D= I_DSS*(1-V_GS/V_P)**2 or I_DSS*(1-(-I_D*R_S)/V_P)**2
#I_D**2*R_S**2+I_D*(2*R_S*(V_P-V_G)-V_P**2/I_DSS)+(V_P)**2
A= R_S**2.
B=(2.*R_S*(V_P)-V_P**2./I_DSS)
C=(V_P)**2.
# Evaluation fo I_D using by polynomial method
#I_D= roots(I_D);# in mA
I_D=1.767;# in mA
I_DQ= I_D;# in mA
print '%s %.2f' %("The value of I_DQ in mA is : ",I_DQ)
# The value of V_GSQ
V_GSQ= -I_D*R_S;# in V
print '%s %.2f' %("The value of V_GSQ in volts ",V_GSQ)
# The value of V_D,
V_D= V_DD-I_D*R_D;# in V
print '%s %.3f' %("The value of V_D in volts is : ",V_D)

The value of I_DQ in mA is :  1.77
The value of V_GSQ in volts  -4.24
The value of V_D in volts is :  9.045


## Example E21 - Pg 249¶

In :
# Exa 5.21 - 249
import math
# Given data
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 kohm
R_D= 3.;# in kohm
V_SS = 10.;# in V
V_G = (R2/(R1+R2))*V_SS;# in V
#I_D= poly(0,'I_D');
V_S= V_SS-0.343*R_S;# in V
V_GS= V_G-V_S;#in V
#I_D= I_D-k*(V_GS-Vth)**2;
#I_D= roots(I_D);# in mA
# For I_D(1), the V_DS will be positive, so discarding this
I_D=0.343;# in mA
V_DS= -V_SS+I_D*(R_D+R_S);# in V
V_D= I_D*R_D;# in V
V_S= I_D*R_S;# in V
print '%s %.3f' %("The value of I_D in mA is : ",I_D)
print '%s %.3f' %("The value of V_DS in volts is : ",V_DS)
print '%s %.3f' %("The value of V_D in volts is : ",V_D)
print '%s %.3f' %("The value of V_S in volts is : ",V_S)

The value of I_D in mA is :  0.343
The value of V_DS in volts is :  -6.913
The value of V_D in volts is :  1.029
The value of V_S in volts is :  2.058


## Example E22 - Pg 249¶

In :
# Exa 5.22 - 249
import math
# Given data
V_T = 1.;# in V
k = 160.*10.**-6.;# in A/V**2
I_DQ = 160.*10.**-6.;# in A
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
print '%s %.2f' %("The value of R_D in k ohm is",R_D);

The value of R_D in k ohm is 12.50


## Example E23 - Pg 250¶

In :
# Exa 5.23 - 250
import math
# Given data
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 ohm
R_D= 3.9;# in k ohm
V_G = (R2/(R1+R2))*V_DD;# in V
#I_D= poly(0,'I_D')
V_GS= V_G-1.22*R_S;# V
# Evaluation the value of I_D by using polynomial method
#I_D= I_D-kn*(V_GS-V_T)**2;# in mA
#I_D= roots(I_D);# in mA
I_D=1.22;# in mA
I_DQ= I_D;# in mA
# Evaluation the value of V_DSQ,
V_DSQ= V_DD-I_D*(R_D+R_S);# in V
print '%s %.2f' %("The value of I_DQ in mA is : ",I_DQ)
print '%s %.3f' %("The value of V_DSQ in volts is : ",V_DSQ)
V_GS= V_G-I_D*R_S;# V
V_DSsat= V_GS-V_T;# in V
print '%s' %("The value of  V_DS is greater than the value of ")
print '%s' %("V_DSsat So the MOSFET is in saturation region")

The value of I_DQ in mA is :  1.22
The value of V_DSQ in volts is :  5.412
The value of  V_DS is greater than the value of
V_DSsat So the MOSFET is in saturation region


## Example E24 - Pg 250¶

In :
# Exa 5.24 - 250
import math
# Given data
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
V_R2 = (R2/(R2+R1))*(V_DD-V_SS);# in V
V_G = V_R2 - V_DD;# in V
#I_D= poly(0,'I_D');
V_S= 1.35*R_S+V_SS;# in V
V_GS= V_G-V_S;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D=I_D-kn*(V_GS-V_T)**2;# in mA
#I_D= roots(I_D);# in mA
# Discarding I_D(1), as it will result in a negative V_DS
I_D= 1.35;# 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
# The value of V_DSQ,
V_DSQ= V_DD-V_SS-I_D*(R_D+R_S);# in V
print '%s %.2f' %("The value of I_DQ in mA is : ",I_DQ)
print '%s %.2f' %("The value of V_GS in volts is : ",V_GS)
print '%s %.2f' %("The value of V_DSQ in volts is : ",V_DSQ)

The value of I_DQ in mA is :  1.35
The value of V_GS in volts is :  2.65
The value of V_DSQ in volts is :  5.95


## Example E25 - Pg 251¶

In :
# Exa 5.25 - 251
import math
# Given data
R_S1 = 100.*10.**-3.;# in k ohm
R_S2 = 100.*10.**-3.;# in 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= poly(0,'I_D');
#V_GS= -I_D*R_S;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D= I_D-I_DSS*(1-V_GS/Vp)**2;# in mA
#I_D= roots(I_D);# in mA
# Discarding I_D(1), as it will give a negative result V_DS
I_D= 5.635;# in mA
print '%s %.3f' %("The value of I_D in mA is : ",I_D)
# The value of V_GS,
V_GS= -I_D*R_S;# in V
print '%s %.3f' %("The value of V_GS in volts is : ",V_GS)
# The value of V_DS,
V_DS= V_DD-I_D*(R_D+R_S);# in V
print '%s %.2f' %("The value of V_DS in volts is : ",V_DS)
gmo= -2*I_DSS/Vp;# in mS
gm= gmo*(1-V_GS/Vp);# in mS
miu= gm*rd;
# The value of Av,
Av= -miu*R_D*R_L/(R_D+R_L)/(rd+R_D*R_L/(R_D+R_L)+(1+miu)*R_S1);
print '%s %.2f' %("The value of Av is : ",Av)

The value of I_D in mA is :  5.635
The value of V_GS in volts is :  -1.127
The value of V_DS in volts is :  10.73
The value of Av is :  -5.24


## Example E26 - Pg 252¶

In :
# Exa 5.26 - 252
import math
# Given data
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
#I_D= poly(0,'I_D');
#V_GS= V_G-I_D*R_S;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D= I_D-k*(V_GS-V_T)**2;
#I_D= roots(I_D);# in mA
# For I_D(1), V_DS will be negative , so discarding it
I_D=0.268;# in mA
# The value of V_GS,
V_GS= V_G-I_D*R_S;# in V
# The value of V_DS,
V_DS= V_DD-I_D*(R_D+R_S);# in V
print '%s %.3f' %("The value of I_D in mA is : ",I_D)
print '%s %.3f' %("The value of V_GS in volts is : ",V_GS)
print '%s %.3f' %("The value of V_DS in volts is : ",V_DS)

The value of I_D in mA is :  0.268
The value of V_GS in volts is :  1.732
The value of V_DS in volts is :  4.196


## Example E27 - Pg 253¶

In :
# Exa 5.27 - 253
import math
# Given data
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
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
print '%s %.3f' %("Drain current in mA is",I_D);
V_SD = V_DD - (I_D*R_D);# in V
print '%s %.3f' %("Source to drain voltage in V is",V_SD);

Drain current in mA is 0.578
Source to drain voltage in V is 0.665


## Example E28 - Pg 253¶

In :
# Exa 5.28 - 253
import math
# Given data
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
# Applying KVL for input circuit
V_G= R2*V_DD/(R1+R2);# in V
#I_D= poly(0,'I_D');
#V_GS= V_G-I_D*R_S;# in V
#I_D= I_D-k*(V_GS-V_GSth)**2;
#I_D= roots(I_D);# in A
I_D= 0.004976;# 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;# in mA
print '%s %.2f' %("The value of I_D in mA is : ",I_D)
print '%s %.f' %("The value of V_GSQ in volts is : ",V_GSQ)
print '%s %.3f' %("The value of V_DSQ in volts is : ",V_DSQ)

The value of I_D in mA is :  4.98
The value of V_GSQ in volts is :  6
The value of V_DSQ in volts is :  9.321


## Example E29 - Pg 254¶

In :
# Exa 5.29 - 254
import math
# Given data
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= poly(0,'V_GS')
# Evaluation the value of V_GS by using polynomial method,
#V_GS= I_D-k*(V_GS-V_GSth)**2;
#V_GS= roots(V_GS);# in V
V_GS=6.;# in V
V_DD= 2.*V_DS;# in V
# V_GS= V_DD-I_D*R_D
# Drain resistance,
R_D= (V_DD-V_GS)/I_D;# in ohm
R_D=R_D*10.**-3.;# in k ohm
print '%s %.f' %("The value of V_GS in volts is : ",V_GS)
print '%s %.f' %("The value of V_DD in volts is : ",V_DD)
print '%s %.1f' %("The value of R_D in kohm is : ",R_D)

The value of V_GS in volts is :  6
The value of V_DD in volts is :  12
The value of R_D in kohm is :  1.5


## Example E30 - Pg 255¶

In :
# Exa 5.30 - 255
import math
# Given data
I_DD= 20.;# in mA
R2 = 10.;# in k ohm
R1 = 30.;# in k ohm
R_S= 1.2;# in k ohm
R_D= 500.*10.**-3.;# in k ohm
V_DD = 12.;# in V
Vp= -6.;# in V
V_G = (R2/(R2+R1))*V_DD;# in V
#I_D= poly(0,'I_D')
V_GS= V_G-5.*R_S;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D=I_D-I_DD*(1-V_GS/Vp)**2;
#I_D= roots(I_D);# in mA
# For I_D(1), V_DS will be negative, so discarding it
I_D=5.;# in mA
# The value of V_DS,
V_DS= V_DD-I_D*(R_D+R_S);# in V
# The value of V_D,
V_D= V_DD-I_D*R_D;# in V
# The value of V_S,
V_S= V_D-V_DS;# in V
print '%s %.f' %("The value of I_D in mA is : ",I_D)
print '%s %.1f' %("The value of V_DS in volts is : ",V_DS)
print '%s %.1f' %("The value of V_D in volts is : ",V_D)
print '%s %.f' %("The value of V_S in volts is : ",V_S)

The value of I_D in mA is :  5
The value of V_DS in volts is :  3.5
The value of V_D in volts is :  9.5
The value of V_S in volts is :  6


## Example E31 - Pg 255¶

In :
# Exa 5.31 - 255
import math
# Given data
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
# Calculation of I1
I1 = V_DD/(R1+R2);# in A
print '%s %.1f' %("The value of I1 in uA is : ",I1)
# The value of V_A,
V_A = (R2/(R2+R1))*V_DD;# in V
print '%s %.1f' %("The value of V_A and V_G in volts is : ",V_A)
#I_D= poly(0,'I_D');
V_C= 0.424*R_S;# in V
V_GS= V_A-V_C;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D= I_D-k*(V_GS-V_T)**2;
#I_D= roots(I_D);# in mA
# For I_D(1),  V_DS will be negative, so discarding it
I_D=0.424;# in mA
print '%s %.1f' %("The value of I_D in mA is : ",I_D)
# The value of V_B,
V_B= V_DD-I_D*R_D;# in V
# The value of V_C,
V_C= I_D*R_S;# in V
# The value of V_DS,
V_DS= V_B-V_C;# in V
print '%s %.f' %("The value of V_B in volts is : ",V_B)
print '%s %.f' %("The value of V_C in volts is : ",V_C)
print '%s %.f' %("The value of V_DS in volts is : ",V_DS)

# Note: In the book, the calculated values are not accurate, this is why the answer in the book is wrong.

The value of I1 in uA is :  2.5
The value of V_A and V_G in volts is :  2.5
The value of I_D in mA is :  0.4
The value of V_B in volts is :  4
The value of V_C in volts is :  1
The value of V_DS in volts is :  3


## Example E32 - Pg 256¶

In :
# Exa 5.32 - 256
import math
# Given data
I_DSS = 12.;# in mA
I_DSS= I_DSS*10.**-3.;# in A
V_P = -3.;# in V
r_d = 45.;# in k ohm
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
# Calculation to find the value of Ri
Ri= R1*R2/(R1+R2);# in ohm
Ri=Ri*10.**-6.;# in M ohm
print '%s %.f' %("The value of Ri in Mohm is : ",Ri)
# Part (ii)
R_S = 1.1;# in k ohm
R_S = R_S * 10**3;# in ohm
# The value of R_o,
R_o= (R_S*1/g_m)/(R_S+1/g_m);# in ohm
print '%s %.1f' %("The value of R_C in ohm is : ",R_o)
# Part (iii)
# The value of R_desh_o
R_desh_o= R_o*r_d/(R_o+r_d);# in ohm
print '%s %.2f' %("The value of R''o in ohm is : ",R_desh_o);
# Part (iv)
# The voltage gain can be find as,
Av= g_m*(R_S*r_d/(R_S+r_d))/(1+g_m*(R_S*r_d/(R_S+r_d)));
print '%s %.3f' %("The value of Av is : ",Av)

The value of Ri in Mohm is :  9
The value of R_C in ohm is :  203.7
The value of R''o in ohm is :  202.79
The value of Av is :  0.811


## Example E34 - Pg 257¶

In :
# Exa 5.34 - 257
import math
# Given data
V_S2 = -2.;# in V
V_GS2 = -V_S2;# in V
I_DS2 = (V_GS2-1.)**2.;# in mA
I = 2.;# in mA
# The current flow through M1 MOSFET,
I_DS1 = I-I_DS2;# in mA
print '%s %.f' %("The current flow through M1 MOSFET in mA is",I_DS1);

The current flow through M1 MOSFET in mA is 1


## Example E35 - Pg 257¶

In :
# Exa 5.35 - 257
import math
# Given data
V_DD= 10.;# in V
I_D=400.;# in A
W= 100.;# in um
L= 10.;# in um
uACox= 20.;# in A/V**2
Vt= 2.;# in V
#R= poly(0,'R')
#V_GS= V_DD-I_D*R;# in V
# Evaluation the value of R by using polynomial method,
V_GS=1*1
R= I_D-1./2.*uACox*W/L*(V_GS-Vt)**2.;
#R= roots(R);# in Mohm
# For R(1), V_DS will be zero, so discarding it
R=15.;# in Mohm
#R=R*10.**3.;# in k ohm
print '%s %.f' %("The value of R in kohm is : ",R)
R=R*10.**-3.;# in ohm
# The value of V_D,
V_D= V_DD-I_D*R;# in V
print '%s %.f' %("The value of V_D in volts is : ",V_D)

The value of R in kohm is :  15
The value of V_D in volts is :  4


## Example E36 - Pg 258¶

In :
# Exa 5.36 - 258
import math
# Given data
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= poly(0,'I_D');
#V_DS= V_DD-I_D*R_D;# in V
# Evaluation the value of I_D by using polynomial method,
#I_D= I_D-k*(V_DS-V_GSth)**2;
#I_D= roots(I_D);# in A
# For I_D(1), V_DS will be negative, so discarding it
I_D=1.46;# in A
# The value of V_DS,
V_DS=4.7# in V
#I_D= I_D*10**3;# in mA
print '%s %.2f' %("The value of I_D in mA is : ",I_D)
print '%s %.2f' %("The value of V_DS in volts is : ",V_DS)

The value of I_D in mA is :  1.46
The value of V_DS in volts is :  4.70