from __future__ import division
#given data
Icq=100 #in uA
BETAac=100 #unitless
BETAdc=100 #unitless
Ad=100 #unitless
CMRRdB=60 #in dB
#part (a)
IE=2*Icq #in UA
VT=25 #in mV
re=2*VT/IE #in ohm
RC=Ad*re #in Kohm
CMRR=10**(CMRRdB/20) #using formula CMRRdB=20log10(CMRR)
#calculate RE using formula CMRR=1+2*RE/re
RE=((CMRR-1)*re)/2 #in Kohm
print "Value of RC is",RC,"kohm and value of RE is",round(RE,1),"kohm"
#part (b)
Ri1=2*BETAac*re #in kohm
Ri2=2*BETAac*re #in kohm
print "Value of Ri1 = Ri2 =",Ri1,"kohm"
#part (c)
Ric=BETAac*(re+2*RE) #in kohm
print "Value of Ric is",Ric/1000,"Mohm."
import numpy as np
#given data
V1=50 #in uV
V2=-50 #in uV
Ad=2000 #unitless
Ac=0.5 #unitless
Vid=V1-V2 #in uV
Vc=(V1+V2)/2 #in uV
#output voltage
Vo=Ad*Vid+Ac*Vc #in uV
Vo=Vo*10**(-6) #in Volts
CMRRdB=20*np.log10(Ad/Ac)
print "Output voltage = %0.2f V" %(Vo)
print "CMRR = %0.1f dB" %CMRRdB
import numpy as np
#given data
V1=5 #in mV
V2=6 #in mV
Ad=70 #in dB
CMRR=90 #in dB
Vid=V2-V1 #in mV
Vc=(V1+V2)/2 #in mV
Ad=10**(Ad/20) #unitless
Ad=np.floor(Ad)
CMRR=10**(CMRR/20) #unitless
#output voltage
Vo=Ad*(Vid+Vc/CMRR) #in mV
Vo=round(Vo)
Vo=Vo*10**(-3) #in Volts
Vid=Vid*10**(-3) #in Volts
ErrorVotage=Vo-Ad*Vid
PercentageError=(ErrorVotage*100)/Vo
print "Output voltage = %0.3f Volts"%Vo
print "ErrorVotage = %0.3f Volts" %ErrorVotage
print "PercentageError = %0.3f %%"%PercentageError
#given data
V1=5 #in uV
V2=4 #in uV
Ad=80 #in dB
CMRR=100 #in dB
Ad=10**(Ad/20) #unitless
CMRR=10**(CMRR/20) #unitless
#differential mode output voltage
Vid=V1-V2 #in uV
Vod=Ad*Vid #in uV
Vod=Vod*10**(-3) #in mV
#common mode output voltage
Vc=(V1+V2)/2 #in uV
Ac=Ad/CMRR #unitless
Voc=Ac*Vc #in uV
print "Differential mode output voltage = %0.2f mV" %Vod
print "common mode output voltage = %0.2f uV" %Voc
#given data
Rc=2 #in kohm
VE=-5 #in volts
VT=25 #in mVolts
RE=4.3*1000 #in ohm
IE=(-0.7-VE)/RE #in mA
re=(2*VT*10**(-3))/IE #in ohm
Rc=Rc*1000 #in ohms
Ad=(Rc)/(2*re)
Ac=-(Rc/(2*RE+re))
CMRR=-Ad/Ac
#CMRR is always positive
print "Differential mode gain = %0.2f "%Ad
print "Common mode gain = %0.2f"%Ac
print "CMRR = %0.2f"%CMRR
#given data
Ad=50 #unitless
I=5 #in mA
VEE=15 #in Volts
VD=0.7 #in Volts
VT=25 #in mVolt
#desired value of emitter current is 5 mA
IE3=5 #in mA
RE=VD/(IE3*10**(-3)) #in ohm
VB3=VEE-2*VD #in volts
I2=IE3 #in mA
R2=VB3/I2 #in kohm
IE1=IE3/2 #in mA
IE2=IE1 #in mA
re=(2*VT)/IE3 #in ohm
RC=Ad*re #in ohm
print "Design values are :"
print "Value of Rc = %0.f ohm" %RC
print "Value of RE = %0.f ohm" %RE
print "Value of R2 = %0.2f kohm" %R2
#given data
Ri=600 #in kohm
Vopp=5 #in volts
VEE=15 #in volts
VT=25 #in mVolts
VD=0.7 #in Volts
BETAac=100 #unitless
BETAdc=100 #unitless
VBE=0.7 #in volts
BETAact=BETAac*BETAdc #unitless
#formula : Ri=2*BETAact*(2*re1)
re1=Ri/(4*BETAact) #in ohm
#formula : re1=VT/IE1
IE1=(VT*10**(-3))/re1 #in mA
IE3=2*IE1 #in mA
RE=VD/(IE3*10**(-3)) #in ohm
R2=(VEE-2*VD)/IE3 #in kohm
IC=IE1 #in mA
RC=1.25/(IC*10**(-3)) #in ohm
print "Thus the Design components values are :"
print "Value of Rc = %0.f ohm" %RC
print "Value of RE = %0.f ohm" %RE
print "Value of R2 = %0.2f kohm" %R2
#Answer in the book is not as much accurate as calculated by Python.
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VBE3=0.715 #in volts
VD1=0.715 #in Volts
VZ=6.2 #in Volts
VT=25 #in mVolts
IZt=41 #in mA
VCC=10 #in Volts
VEE=-10 #in Volts
RC1=2.7 #in kohm
RC=4.7 #in kohm
#Part (a)
VB3=VEE+VZ+VD1 #in volts
VE3=VB3-VBE3
IE3=(VE3-VEE)/RC1 #in mA
#ICQ1=IE1=ICQ2=IE2"
IE2=IE3/2 #in mA
ICQ1=IE2 #in mA
ICQ2=IE2 #in mA
IE1=IE2 #in mA
VCEQ=VCC+VBE3-RC*ICQ1# formula for VCEQ
print "Operating point for Q1 and Q2 are : "
print "VCEQ = %0.2f Volts" %VCEQ
print "ICQ = %0.2f mA " %ICQ1
print "and the operating point for Q3 :"
VCE3=-VBE3-VE3 #in Volts
print "VCE3 = %0.3f Volts" %VCE3
IC3=IE3 #in mA
print "IE3 = %0.2f mA "%IE3
#Part (b)
re=(2*VT)/IC3 #in ohm
Ad=(RC*1000)/re #unitless
print "Differential voltage gain = %0.2f "%Ad
#Part (c)
Ri=2*BETAac*re #in ohm
print "Input resistance = %0.2f kohm"%(Ri/1000)
#Answer in the book is not as much accurate as calculated by Python.
#given data
Io=180 #in uA
Vcc=20 #in Volts
VBE=0.7 #in Volts
BETA=120 #unitless
IR=Io*(1+2/BETA) #in uA
R=(Vcc-VBE)/(IR*10**-3) #in kohm
print "Value of IR = %0.2f uA" %IR
print "Value of R = %0.1f kohm"%R
#given data
VBE=0.7 #in Volts
BETA=120 #unitless
IR=(VCC-VBE)/(3.6) #in mA
IC=IR/2 #in mA
Iload=IC #in mA
print "Load current in the circuit = %0.2f mA"%Iload
# Note : Derivation skip
#given data
Iload=0.5 #in mA
BETA=150 #unitless
VEB=0.7 #in Volts
VCC=10 #in Volts
IR=Iload*(1+2/BETA) #in mA
R=(VCC-VEB)/IR #in kohm
print "Value of IR = %0.2f mA"%IR
print "Value of R = %0.2f kohm"%R
#given data
BETAac=110 #unitless
BETAdc=110 #unitless
VBE=0.7 #in volts
VEE=15 #in volts
VT=25 #in mvolts
R=2.7 #in kohm
Rc=3.3 #in kohm
IR=(VEE-VBE)/R #in mA
IC3=IR #in mA
IC1=IC3/2 #in mA
IC2=IC3/2 #in mA
re1=VT/IC1 #in ohm
re2=re1 #in ohm
# part (i)
Ad=(Rc*1000)/re1 #unitless
# part (ii)
Ri1=2*BETAac*re1*10**(-3) #in kohm
Ri2=2*BETAac*re2*10**(-3) #in kohm
print "Differential mode voltage gain = %0.2f"%Ad
print "Input resistances are :"
print "Ri1 = Ri2 = %0.2f kohm"%Ri1
#given data
Ad=200 #unitless
Ri=3#in kohm
BETAac=110 #unitless
BETAdc=110 #unitless
VBE=0.7 #in volts
VEE=15 #in volts
VT=25 #in mvolts
re=Ri/(2*BETAac) #in ohm
RC=Ad*re #in kohm
IC1=VT/re #in mA
IR=2*IC1 #in mA
IC3=IR #in mA
R=(VEE-VBE)/(IR*10**(-3)) #in kohm
print "Value of resistance Rc = %0.2f kohm"%RC
print "Value of resistance R = %0.2f kohm"%R
#given data
Ad=400 #unitless
Ri=3#in kohm
BETAac=110 #unitless
BETAdc=110 #unitless
VBE=0.7 #in volts
VEE=15 #in volts
VT=25 #in mvolts
#circuit bias current IR
IR=3 #in mA
R=(VEE-VBE)/(IR) #in kohm
re=(2*VT)/IR #in ohm
RC=Ad*re*10**-3 #in kohm
Ri=2*BETAac*re*10**-3 #in kohm
print "Value of resistance R = %0.2f kohm"%R
print "Value of resistance RC = %0.2f kohm"%RC
print "Value of resistance Ri = %0.2f kohm"%Ri
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VBEon=0.7 #in volts
VCC=5 #in volts
VEE=-5 #in volts
VT=25 #in mVolts
R=18.6 #in kohm
IR=(VCC-VBEon -VEE)/R #in mA
IC1=IR/2 #in mA
IC2=IC1 #in mA
re1=(2*VT)/IR #in ohm
re2=re1 #in ohm
Ri1=2*BETAac*re1*10**-3 #in kohm
Ri2=Ri1 #in kohm
print "Differential input resistances are :"
print "Ri1 = Ri2 = %0.2f kohm" %Ri1
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VBEon=0.7 #in volts
VCC=5 #in volts
VEE=-5 #in volts
VT=25 #in mVolts
R=18.6 #in kohm
Ad=200 #unitless
IR=(VCC-VBEon -VEE)/R #in mA
IC1=IR/2 #in mA
IC2=IC1 #in mA
re1=(2*VT)/IR #in ohm
re2=re1 #in ohm
RC=Ad*re1*10**-3 #in kohm
print "Rc = %0.2f kohm"%RC
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VBE=0.7 #in volts
VCC=10 #in volts
VEE=-10 #in volts
VT=25 #in mVolts
R=3.6 #in kohm
RC=2.2 #in kohm
# part (i) #
IR=(VCC-VBE-VEE)/R #in mA
ICQ=IR/2 #in mA
VE=-2*VBE #in Volts
VC=VCC-ICQ*RC #in Volts
VCEQ=VC-VE #in Volts
print "Operating point VCEQ = %0.2f Volt"%VCEQ
# part (ii) #
re=VT/ICQ #in ohm
re1=re #in ohm
re2=re #in ohm
reT=re1+re2 #in ohm
Ad=(RC*1000)/reT # unitless
print "Differential voltage gain = %0.2f" %Ad
# part (iii) #
BETAT=BETAac*BETAdc #unitless
Rid=2*BETAT*reT*10**-3 #in kohm
print "Differential input resistance = %0.f kohm"%Rid
#given data
Iload=20 #in uA
VBE=0.7 #in volts
VCC=10 #in Volts
IR=Iload #in mA
R=(VCC-2*VBE)/(IR*10**-3) #in kohm
print "R= %0.f kohm"%R
import numpy as np
#given data
Io=10 #in uA
IR=1 #in mA
VBE2=0.7 #in volts
VT=25 #in mVolts
VCC=20 #in volts
R=(VCC-VBE2)/IR #in kohm
RE=((VT*10**-3)/(Io*10**-6))*np.log((IR*10**-3)/(Io*10**-6)) #in ohm
RE=RE/1000 #in kohm
print "R = %0.2f kohm"%R
print "RE = %0.2f kohm"%RE
#note : answer in the book of RE is wrong.
import numpy as np
#given data
IR=2 #in mA
I2=10 #in uA
I3=20 #in uA
VBE1=0.7 #in volts
VT=25 #in mVolts
VCC=10 #in volts
VEE=-10 #in volts
R=(VCC-VBE1-VEE)/IR #in kohm
RE2=(VT/(I2*10**-3))*np.log(IR/(I2*10**-3)) #in kohm
RE3=(VT/(I3*10**-3))*np.log(IR/(I3*10**-3)) #in kohm
VBE2=VBE1-RE2*I2*10**-6 #in volts
VBE3=VBE1-RE3*I3*10**-6 #in volts
RE2=RE2/1000 #in kohm
RE3=RE3/1000 #in kohm
print "Value of R = %0.2f kohm"%R
print "Value of RE2 = %0.2f kohm"%RE2
print "Value of RE3 = %0.2f kohm"%RE3
print "Value of VBE2 = %0.3f Volt"%VBE2
print "Value of VBE3 = %0.3f Volt"%VBE3
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VBE=0.715 #in volts
VEE=10 #in volts
VT=25 #in mvolts
R=5.6 #in kohm
N=3 # as three transistors here
IR=(VEE-VBE)/(R) #in mA
IC1=IR/(1+(1+N)/BETAac) #in mA
IC2=IR/(1+(1+N)/BETAac) #in mA
IC3=IR/(1+(1+N)/BETAac) #in mA
IRC=3*IC1 #in mA
print "Current through resistor Rc, I_RC = %0.2f mA" %IRC
print "Collector Current for each transistor : "
print "IC1 = IC2 = IC3 = %0.2f mA" %IC1
#given data
I4=600 #in uA
I2=10 #in uA
I3=20 #in uA
VCC=10 #in volts
VEE=-10 #in volts
VBE=0.7 #in volts
VEB=0.7 #in volts
IR=I4/3 #in uA
I2=2*IR #in uA
I1=IR #in uA
I3=IR #in uA
R=(VCC-VEB-VBE-VEE)/(IR*10**(-3)) #in kohm
print "IR = %0.f uA " %IR
print "I1 = %0.f uA"%I1
print "I2 = %0.f uA " %I2
print "I3 = %0.f uA" %I3
print "R = %0.f kohm"%R
#given data
Vo=5 #in volts
BETAac=150 #unitless
BETAdc=150 #unitless
VT=25 #in mvolts
VCC=10 #in volts
VD=0.7 #in volts
R1=2.7 #in kohm
R2=1.5 #in kohm
# part (i) #
IR=(VCC-VD)/R1 #in mA
IC=(IR-VD/R2)/(1+2/BETAac) #in mA
IC1=IC #in mA
IC2=IC #in mA
RC=(VCC-Vo)/IC #in kohm
print "IC1 = %0.2f mA" %IC1
print "IC2 = %0.2f mA" %IC2
print "RC = %0.2f kohm" %RC
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VT=25 #in mvolts
VEE=15 #in volts
VCC=15 #in volts
VBE=0.7 #in volts
VEB=-0.7 #in volts
R2=2.2 #in kohm
RC1=2.5 #in kohm
RC6=1.2 #in kohm
RE8=1.2 #in kohm
I2=(VEE-VBE)/R2 #in mA
IC3=I2 #in mA
IC7=I2 #in mA
IC9=I2 #in mA
IC1=I2/2 #in mA
IC2=IC1 #in mA
IC5=IC1 #in mA
IC6=IC1 #in mA
IC8=I2 #in mA
IC9=I2 #in mA
# calculation of collector to emitter voltages
VC1=VCC-IC1*RC1 #in Volts
VC2=VC1 #in Volts
VCE1=VC1-VEB #in Volts
VCE2=VCE1 #in Volts
VE5=VC1-VBE #in Volts
VE6=VE5 #in Volts
VC6=VCC-RC6*IC6
VCE5=VCC-VE5
VCE6=VCC-VE6
VE8=VC6-VBE
VCE8=VCC-VE8
# calculation of ac emitter resistances
re1=VT/IC1 #in ohm
re2=re1 #in ohm
re5=re1 #in ohm
re6=re1 #in ohm
re8=VT/IC8 #in ohm
#input resistance of second stage is
Ri2=2*BETAac*re6*10**(-3) #in kohm
# voltage gain of first stage
Ad1=(((RC1*Ri2)/(RC1+Ri2)))/(re1*10**(-3))
#input resistance of third stage is
Ri3=BETAac*(re8+RE8) #in kohm
# voltage gain of second stage
Ad2=(((RC6*Ri3)/(RC6+Ri3)))/(2*re6*10**(-3))
Ad3=1
#Overall gain of the circuit
Ad=Ad1*Ad2*Ad3
#voltage drop across collector resistor
VRC6=IC1*RC6 #in volts
#Maximum peak to peak output voltage swing
Vopp=3.9 # in volt
## part (i)
print "The operating point for each transistor :"
print "For transistor 1:"
print "IC1 = %0.2f mA"%IC1,
print "& VCE1 = %0.3f Volt" %VCE1
print "For transistor 2:"
print "IC2 = %0.2f mA"%IC2,
print "& VCE2 = %0.3f Volt" %VCE2
print "For transistor 5:"
print "IC5 = %0.2f mA"%IC5,
print "& VCE5 = %0.3f Volt" %VCE5
print "For transistor 6:"
print "IC6 = %0.2f mA"%IC6,
print "& VCE6 = %0.3f Volt" %VCE6
print "For transistor 8:"
print "IC8 = %0.2f mA"%IC8,
print "& VCE8 = %0.2f Volt" %VCE8
## part (ii)
print "Overall voltage gain of the circuit = %0.2f "%Ad
## part (iii)
print "Maximum peak to peak output voltage swing = %0.2f "%Vopp
#note :answer in the book is not as much accurate as calculated by Python
#given data
BETAmin=80 #unitless
BETAmax=120 #unitless
IE=400 #in uA
VT=25 #in mvolts
VEE=15 #in volts
VCC=15 #in volts
VBE=0.7 #in volts
VEB=-0.7 #in vol
IE1=IE/2 #in uA
IE2=IE1 #in uA
IBmax=IE1/(1+BETAmin) #in uA
IBmin=IE1/(1+BETAmax) #in uA
Iiomax=IBmax-IBmin #in uA
print "Largest possible input bias current = %0.3f uA"%IBmax
print "smallest possible input bias current = %0.3f uA " %IBmin
print "Largest possible input offset current = %0.3f uA"%Iiomax
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VT=25 #in mvolts
VEE=10 #in volts
VCC=10 #in volts
VBE=0.7 #in volts
VEB=-0.7 #in volts
RC2=2.7 #in kohm
RC1=2.7 #in kohm
RC3=1.5 #in kohm
RC4=1.5 #in kohm
RE1=5 #in kohm
RE2=10 #in kohm
RE3=10 #in kohm
IE1=(VEE-VBE)/(2*RE1) #in mA
IC1=IE1
#as Q1 and Q2 are identical
IC2=IC1
VC1=VCC-RC1*IC1
VE1=-0.7 #in Volts
VE2=0.7 #in Volts
VCE1=VC1-VE1
VCE2=VCE1
IE3=(VCC-RC2*IC2-VBE+VEE)/(2*RE3) #in mA
IE4=IE3 #in mA
VC3=VCC-RC3*IE3 #in Volts
VC4=VC3 #in Volts
VE3=VC1-VBE #in Volts
VCE3=VC3-VE3 #in Volts
VCE4=VCE3 #in Volts
print "Operating point for Q1 & Q2 becomes : "
print "ICQ = %0.2f mA & VCEQ = %0.2f Volts "%(IC1,VCE1 )
print "And operating point for Q3 & Q4 becomes : "
print "ICQ = %0.2f mA & VCEQ = %0.2f Volts"%(IE3,VCE3)
re1=VT/IC1 #in ohm
re2=re1 #in ohm
re3=VT/IE3 #in ohm
re4=re3 #in ohm
Ri2=2*BETAac*re3 #in ohm
Ri2=Ri2*10**-3 #in kohm
Ad1=((RC1*Ri2)/(RC1+Ri2))/(re1*10**-3)
Ad2=RC4/(2*re4*10**-3)
Ad=Ad1*Ad2
print "Overall voltage gain = %0.2f" %Ad
Ri1=2*BETAac*re1 #in ohm
Ri1=Ri1/1000 #in kohm
print "Input resistance of the cascaded differential amplifier = %0.2f kohm" %Ri1
Ro2=RC4 #in kohm
print "Output resistance of the cascaded differential amplifier = %0.2f kohm " % Ro2
#given data
BETAac=100 #unitless
BETAdc=100 #unitless
VT=25 #in mvolts
VEE=10 #in volts
VCC=10 #in volts
VBE=0.7 #in volts
VD=0.7 #in volts
IE6=2 #in mA
IE1=3.25 #in mA
Ri2=1.538 #in kohm
RC1=2.5 #in kohm
re8=3.85 #in kohm
RE8=1.2 #in kohm
RC6=1.2 #in kohm
RE=VD/(IE6*10**-3) #in ohm
R=(VEE-2*VD)/IE6 #in kohm
VB5=8.74 #in Volts
VE5=VB5-VBE
R1=VE5/IE6 #in kohm
re1=VT/IE1 #in ohm
re2=re1; re5=re1; re6=re1 #in ohm
re8=VT/6.5 #in ohm
Ri2=2*BETAac*re6*10**-3 #in kohm
Ad1=(1000*(RC1*Ri2)/((RC1+Ri2)))/re1
Ri3=BETAac*(re8*10**-3+RE8) #in kohm
Ad2=(1000*(RC6*Ri3)/(RC6+Ri3))/(2*re6)
Ad=Ad1*Ad2
VRC6=RC6*IE1 #in Volts
Vopp=VRC6 #in Volts
print "Value of RE = %0.2f ohm"%RE
print "Value of R = %0.2f kohm"%R
print "Value of VE5 = %0.2f Volt"%VE5
print "Value of R1 = %0.2f kohm"% R1
print "AC emitter resistances re1 = re2 = re5 = re6 = %0.2f ohm" %re1
print "Abd re8 = %0.2f ohm"%re8
print "Input resistance of 2nd stage Ri2 = %0.3f kohm "%Ri2
print "Voltage gain of 1st stage = %0.2f"%Ad1
print "Voltage gain of 2nd stage = %0.2f"%Ad2
Ad3=1
print "Voltage gain of 3rd stage = %0.2f" %Ad3
print "Overall Voltage gain of the circuit = %0.2f" %Ad
print "Voltage drop across collector resistor = %0.2f Volt"%VRC6
print "Maximum peak to peak output voltage swing = %0.2f Volt"%Vopp