# Ex 2.1 - page 31¶

In [1]:
from __future__ import division
v1=7 #mV
v2=9 #mV
CMRR=90 #dB
vid=v2-v1 #mV
vcm=(v1+v2)/2 #mV
CMRR=10**(CMRR/20) #unitless
print "Output Voltage is %0.2f V" %vout

Output Voltage is 20.00 V


## Ex 2.2 - page 31¶

In [4]:
from __future__ import division
v1=50.0 #micro V
v2=55.0 #micro V
CMRR=80 #dB
vid=v2-v1 #micro V
vcm=(v1+v2)/2 #mV
CMRR=10**(CMRR/20) #unitless
print "Output Voltage is %0.3f V" %vout
print "Error Voltage is %0.3f V" %Verror
error_p=(Verror/vout)*100 #% error
print "Percentage error is %0.3f %%" %error_p
#Percentage error answer is not correct in the book.

Output Voltage is 1.001 V
Error Voltage is 0.001 V
Percentage error is 0.105 %


## Ex 2.3 - page 38¶

In [9]:
from __future__ import division
import math
IT=1.0 #mA
VCC=15 #V
RE=50 #kohm
RC=15 #kohm
Beta=120 #unitless
alfa=Beta/(Beta+1) #unitless
Vid=6 #mV
VT=26 #mV
#Part (a)
iC1=alfa*IT/(1+math.exp(-Vid/VT)) #mA
iC2=IT-iC1 #mA
print "dc Collector current through transistors is %0.3f mA" %iC2
#Part (b)
iC=IT/2 #mA(let iC1=iC2=iC)
re=VT/iC #ohm(let re1=re2=re)
Acm=-RC*1000/(re+2*RE*1000) #unitless
Acm=abs(Acm) ##unitless
print "Acm is %0.2f " %Acm
CMRR=20*math.log10(CMRR) #dB
print "CMRR is %0.1f dB" %CMRR

dc Collector current through transistors is 0.447 mA
Acm is 0.15
CMRR is 65.7 dB


## Ex 2.4 - page 44¶

In [11]:
from __future__ import division
RC=2 #kohm
RE=4.3 #kohm
VEE=5 #V
VBE=0.7 #V
IT=(VEE-VBE)/RE #mA
VT=26 #mV
re=2*VT/IT #ohm
Acm=-RC*1000/(re+2*RE*1000) #unitless
print "Acm = ",round(Acm,2)
print "CMRR = ",round(CMRR,1)

Ad =  -19.23
Acm =  -0.23
CMRR =  83.2


## Ex 2.5 - page 45¶

In [13]:
from __future__ import division
Beta=100 #unitless
VBE=0.715
VD1=0.715 #V
VZ=6.2 #V
VT=26 #mV
IZt=41 #mA
VCC=10 #V
VEE=10 #V
RE=2.7 #kohm
RC=4.7 #kohm
VB=-VEE+VZ+VD1 #V
VE=VB-VBE #V
IE3=(VE-(-VEE))/(RE) #mA
IT=IE3 #mA
ICQ=IT/2 #mA(let ICQ1=ICQ2=ICQ)
VCEQ=VCC+VBE-ICQ*RC #V
#Q=[ICQ,VCEQ] #[mA V](Q point)
print "Q point (ICQ(mA), VCEQ(V)), ICQ is ",round(ICQ,2),"mA & VCEQ is ",round(VCEQ,2),"V"
re=2*VT/IT #ohm
Rid=2*Beta*re/1000 #kohm
print "Rid is %0.2f kohm" %Rid

Q point (ICQ(mA), VCEQ(V)), ICQ is  1.15 mA & VCEQ is  5.32 V
Rid is 4.53 kohm


## Ex 2.6 - page 47¶

In [15]:
from __future__ import division
Beta=100 #unitless
VBE=0.7 #V
VCC=10 #V
VEE=10 #V
VT=26 #mV
RC=2.7 #kohm
R=2.2 #kohm
IExt=(VEE-VBE)/R #mA
IC3=IExt
IT=IExt  #mA
ICQ=IT/2 #mA
re=2*VT/IT #ohm(let re1=re2=re)
Rid=2*Beta*re/1000 #kohm(let Rid1=Rid2=Rid)
print "Differntial input resistance, Rid is %0.2f kohm" %Rid

Differntial mode gain, Ad =  -219.5
Differntial input resistance, Rid is 2.46 kohm


## Ex 2.7 - page 49¶

In [17]:
from __future__ import division
Beta=100 #unitless
VBE=0.7 #V
VD1=0.7 #V
VD2=0.7#V
VCC=15 #V
VEE=15 #V
VT=26 #mV
RE=560 #ohm
RC=6.8 #kohm
R=220 #ohm
VB=-VEE+VD1+VD2 #V
VE=VB-VBE #V
IE3=(VE-(-VEE))/RE*1000 #mA
IT=IE3 #mA
ICQ=IT/2 #mA
VCEQ=VCC+VBE-ICQ*RC #V
#Q=[ICQ VCEQ] #[mA V](Q point)
print "Q point (ICQ(mA), VCEQ(V)), ICQ is ",round(ICQ,3),"mA & VCEQ is ",round(VCEQ,2),"V"
re=2*VT/IT #ohm
#Answer in the book is wrong for Q point.

Q point (ICQ(mA), VCEQ(V)), ICQ is  0.625 mA & VCEQ is  11.45 V
Differntial mode gain, Ad =  -163.46


## Ex 2.8 - page 50¶

In [22]:
from __future__ import division
ICQ=200.0 #micro A
Beta=1000.0 #unitless
CMRR=80.0 #dB
VT=26.0 #mV
re=VT/(ICQ/1000) #ohm(Let re=re1=re2)
CMRR=10**(CMRR/20) #untless
RE=(CMRR-1)*re/2/1000 #kohm
print "Value of RC is %0.2f kohm & RE is %0.f kohm" %(RC,RE)
Rid=2*Beta*re/1000 #kohm(Let Rid=Rid1=Rid2)
print "Differntial input resistance, Rid is %0.f kohm " %Rid
Ric=(Beta+1)*(re+2*RE*1000)/10**6 #Mohm
print "Common mode input resistance, Ric is %0.f Mohm " %Ric
#Answer for last part is wrong in the textbook.

Value of RC is 23.40 kohm & RE is 650 kohm
Differntial input resistance, Rid is 260 kohm
Common mode input resistance, Ric is 1301 Mohm


## Ex 2.9 - page 51¶

In [25]:
from __future__ import division
Beta=110 #unitless
VBE=0.7 #V
VT=26 #mV
VCC=10 #V
VEE=10 #V
RC=1.8 #kohm
R=3.9 #kohm
IExt=(VCC-VBE-(-VEE))/R #mA
IT=IExt  #mA
ICQ=IT/2 #mA
V1=0
V2=0 #V
VE=-2*VBE #V
VC=VCC-ICQ*RC #V
VCEQ=VC-VE #V
# Q=[ICQ VCEQ] #[mA V](Q point)
print "Q point (ICQ(mA), VCEQ(V)), ICQ is ",round(ICQ,2),"mA & VCEQ is ",round(VCEQ,2),"V"
re=2*VT/IT #ohm(let re1=re2=re)
reD=2*re #ohm
print "Differntial input resistance, Rid is %0.1f kohm" %Rid
#Answer for Ad is wrong(+ve) in the book while it is negative.

Q point (ICQ(mA), VCEQ(V)), ICQ is  2.47 mA & VCEQ is  6.95 V
Differntial mode gain, Ad =  -85.7
Differntial input resistance, Rid is 508.6 kohm


## Ex 2.10 - page 54¶

In [27]:
from __future__ import division
Beta=100 #unitless
VBE=0.7 #V
R=18.6 #kohm
VT=26 #mV
VCC=5 #V
VEE=5 #V
IExt=(VCC-VBE-(-VEE))/R #mA
IT=IExt  #mA
re=2*VT/IT #ohm(let re1=re2=re)
Rid=2*Beta*re/1000 #kohm(let Rid1=Rid2=Rid)
print "Differntial input resistances, Rid1=Rid2 is %0.1f kohm" %Rid

Differntial input resistances, Rid1=Rid2 is 20.8 kohm


## Ex 2.11 - page 55¶

In [28]:
from __future__ import division
Beta=100 #unitless
VBE=0.7 #V
RC=2.7 #kohm
R=2.2 #kohm
VT=26 #mV
VCC=10 #V
VEE=10 #V
IExt=(VEE-VBE)/R #mA
IT=IExt  #mA
IE=IT/2 #mA(Let IE1=IE2=IE)
re=2*VT/IT
re1=re #ohm
re2=re #ohm
re3=re #ohm
re4=re #ohm
reD=re1+re2 #ohm

Differential voltage gain, Ad =  -109.75