from __future__ import division
v1=7 #mV
v2=9 #mV
Ad=80 #dB
CMRR=90 #dB
vid=v2-v1 #mV
vcm=(v1+v2)/2 #mV
Ad=10**(Ad/20) #unitless
CMRR=10**(CMRR/20) #unitless
vout=Ad*(vid+vcm/CMRR)/1000 #V
print "Output Voltage is %0.2f V" %vout
from __future__ import division
v1=50.0 #micro V
v2=55.0 #micro V
Ad=2*10**5 #unitless
CMRR=80 #dB
vid=v2-v1 #micro V
vcm=(v1+v2)/2 #mV
CMRR=10**(CMRR/20) #unitless
vout=Ad*(vid+vcm/CMRR)/10**6 #V
print "Output Voltage is %0.3f V" %vout
Verror=vout-Ad*vid/10**6 #V
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.
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)
Ad=-RC*1000/re #unitless
Acm=-RC*1000/(re+2*RE*1000) #unitless
Acm=abs(Acm) ##unitless
CMRR=abs(Ad/Acm) ##unitless
print "Ad is %0.2f" %Ad
print "Acm is %0.2f " %Acm
CMRR=20*math.log10(CMRR) #dB
print "CMRR is %0.1f dB" %CMRR
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
Ad=-RC*1000/2/re #unitless
print "Ad = ",round(Ad,2)
Acm=-RC*1000/(re+2*RE*1000) #unitless
print "Acm = ",round(Acm,2)
CMRR=abs(Ad/Acm) ##unitless
print "CMRR = ",round(CMRR,1)
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
Ad=-RC*1000/re #unitless
Rid=2*Beta*re/1000 #kohm
print "Ad = ",round(Ad)
print "Rid is %0.2f kohm" %Rid
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)
Ad=-RC*1000/re #unitless
Rid=2*Beta*re/1000 #kohm(let Rid1=Rid2=Rid)
print "Differntial mode gain, Ad = ", round(Ad,1)
print "Differntial input resistance, Rid is %0.2f kohm" %Rid
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
Ad=-RC*1000/re #unitless
print "Differntial mode gain, Ad = ",round(Ad,2)
#Answer in the book is wrong for Q point.
from __future__ import division
ICQ=200.0 #micro A
Beta=1000.0 #unitless
Ad=180.0 #unitless
CMRR=80.0 #dB
VT=26.0 #mV
re=VT/(ICQ/1000) #ohm(Let re=re1=re2)
RC=Ad*re/1000 #kohm
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.
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
Ad=-RC*1000/reD #unitless
print "Differntial mode gain, Ad = ",round(Ad,1)
BetaD=Beta**2 #unitless
Rid=2*BetaD*reD/1000 #kohm(let Rid1=Rid2=Rid)
print "Differntial input resistance, Rid is %0.1f kohm" %Rid
#Answer for Ad is wrong(+ve) in the book while it is negative.
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
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
BetaD=Beta**2 #unitless
Ad=-RC*1000/reD #unitless
print "Differential voltage gain, Ad = ",round(Ad,2)
Rid=2*BetaD*reD/1000 #kohm(let Rid1=Rid2=Rid)
print "Differntial input resistances, Rid1=Rid2 is %0.2f kohm " %Rid
#Answer in the book is not accurate.