from __future__ import division
Iout=8 #micro A
VBE=0.7 #V
Beta=80 #unitless
VCC=20 #V
IREF=Iout*(1+2/Beta) #micro A
R=(VCC-VBE)/IREF #Mohm
print "Reference current is %0.2f uA" %IREF
print "Resistance required is %0.2f Mohm" %R
from __future__ import division
Iout=1 #mA
VBE=0.7 #V
Beta=100 #unitless
VCC=30 #V
IREF=Iout*(1+2/Beta) #mA
R=(VCC-VBE)/IREF #kohm
print "Reference current is %0.2f mA" %IREF
print "Resistance required is %0.1f kohm" %R
from __future__ import division
Iout=0.5 #mA
Beta=50 #unitless
VEB=0.7 #V
VCC=5 #V
IREF=Iout*(1+2/Beta) #mA
R=(VCC-VEB)/IREF #kohm
print "Reference current is %0.2f mA" %IREF
print "Resistance required is %0.2f kohm" %R
from __future__ import division
Iout=8 #micro A
Beta=100 #unitless
VBE=0.7 #V
VCC=20 #V
IREF=Iout/(1+2/Beta/(1+Beta)) #micro A
R=(VCC-2*VBE)/IREF #Mohm
print "Reference current is %0.2f micro A" %IREF
print "Resistance required is %0.2f Mohm" %R
from __future__ import division
Iout=60 #micro A
VBE=0.7 #V
Beta=150 #unitless
VCC=30 #V
IREF=Iout*(1+2/Beta/(1+Beta)) #micro A
R=(VCC-2*VBE)/IREF #Mohm
R*=10**3 #kohm
print "Reference current is %0.3f mA" %IREF
print "Resistance required is %0.1f kohm" %R
from __future__ import division
VBE=0.7 #V
Beta=120 #unitless
VCC=10 #V
R=5.6 #kohm
#KCL at node x : IREF=IC1+I1 #as Beta>>1
#KCL at node y : I1=IC2+IB3 #as Beta>>1
IREF=(VCC-VBE)/R #mA
#as IREF=2*IC+IB3=IC*(2+1/Beta)=2*IC #as Beta>>1
IC=IREF/2 #mA
Iout=IC #mA
print "Output current is %0.2f mA" %Iout
from __future__ import division
import math
Iout=6 #micro A
IREF=1.2 #mA
VBE2=0.7 #V
VT=26 #mV
Beta=120 #unitless
VCC=20 #V
R=(VCC-VBE2)/IREF #kohm
print "Value of resistance R is %0.f kohm " %R
IC1=Iout #micro A
IC2=(IREF-IC1*10**-3/Beta)/(1+1/Beta) #mA
RS=1/(IC1*10**-6)*VT*10**-3*math.log(IC2*1000/IC1) #ohm
RS/=10**3 #kohm
print "Value of resistance RS is %0.1f kohm" %RS
from __future__ import division
IREF=1 #mA
Io2=20 #micro A
Io3=40 #micro A
VBE1=0.7 #V
VT=26 #mV
VCC=10 #V
VEE=-10 #V
R=(VCC-VBE1-VEE)/IREF #kohm
print "Value of resistance R is %0.2f kohm " %R
RE2=VT/Io2*math.log(IREF*1000/Io2) #kohm
print "Value of resistance RE2 is %0.2f kohm" %RE2
RE3=VT/Io3*math.log(IREF*1000/Io3) #kohm
print "Value of resistance RE3 is %0.2f kohm " %RE3
VBE2=VBE1-RE2*Io2/1000 #V
print "Value of Base emitter voltage of transistor Q2 is %0.4f V" %VBE2
VBE3=VBE1-RE3*Io3/1000 #V
print "Value of Base emitter voltage of transistor Q3 is %0.4f V" %VBE3
from __future__ import division
Beta=100 #unitless
VBE=0.715 #V
R=5.6 #kohm
RC=1 #kohm
VCC=10 #V
VCB1=0 #V(Q1 will act as diode)
IREF=(VCC-VBE)/R #mA
#KCL at node x : IREF=IC1+2*IB
#KCL at node y : I1=IC2+IB3 #as Beta>>1
IREF=(VCC-VBE)/R #mA
#as IREF=2*IC1/Beta+IC1
IC1=IREF/(1+2/Beta) #mA
IC2=IC1 #mA
IC3=IC1 #mA
print "Collector current in each transistor, IC1=IC2=IC3 is %0.2f mA" %IC1
IRC=IC1+IC2+IC3 #mA
print "Current through RC is %0.2f mA" %IRC
#Answer wrong in the textbook.
from __future__ import division
Vout=5 #V
Beta=180 #unitless
R=22 #kohm
VCC=10 #V
VBE=0.7 #V
IREF=(VCC-VBE)/R #mA
IC=(IREF-VBE/R)/(1+2/Beta) #mA
RC=(VCC-Vout)/IC #kohm
print "IC1 & IC2 are %0.2f mA" %IC
print "RC is %0.2f kohm" %RC
#Answer in the book is wrong.