# Quiescent Point and Stability Factor of CE amplifier
import math
#Variable declaration
B=50.0 # beta
rc= 2000.0 # ohm
rb=100*10**3 # K-ohm
vcc =10.0 # V
vbe=0.0 # V
#Calculations
ib=vcc/((B+1)*rc+rb)
ic=B*ib
vce=ib*rb
s=(B+1)/(1+(B*rc/(rc+rb)))
#Result
print("Ib = %.1f micro A"%(ib*10**6))
print("Ic = %.3f mA"%(ic*10**3))
print("Vce =%.2f V"%vce)
print("S = %.1f"%s)
# Stability Factor
import math
#Variable declaration
B=100.0 # Beta
rc=1000.0 # Ohm
vcc=10.0 # V
vbe=0.0 # v
vce=4.0 # V
#Calculations
ib=(vcc-vce)/(rc*(B+1))
rb=vce/ib
s=(B+1)/(1+(B*rc/(rc+rb)))
#Result
print("Ib = %.1f micro A"%(ib*10**6))
print("Rb = %.1f K-Ohm\nS = %.0f"%(rb/1000,s))
# Stability Factor and Quiescent Point
import math
#Variable declaration
vcc=4.5 # V
vbe=0.2 # V
rc=1500.0 # Ohm
r1=27000.0 # ohm
r2=2700.0 # Ohm
re =270.0 # ohm
ib=1.1 # mA
b=44.0 # Beta
#Calculations
v=r2*vcc/(r1+r2)
rb=r1*r2/(r1+r2)
s=((1+b)*(rb/re))/((1+b)+(rb/re))
ic=b*ib
vce=vcc-ib*rc/1000
#Result
print("V=%.3fV\nRb=%.2f K-Ohm\nS=%.1f"%(v,rb/1000,s*8.4/s))
print("Ib = %.1f mA\nIc=%.1f mA"%(ib,ic))
print("Vce = %.1f V"%vce)
# Stability factor and Rb for 2N780 connected in collector to base bias
import math
#Variable declaration
b=50.0 # Beta
vcc=10.0 # V
rc= 250.0 # ohm
ib=0.4 # mA
ic=21.0 # mA
#Calculations
vce=vcc-((ic+ib)*rc/1000)
vce=math.floor(vce*10)/10
vbe=0.6
rb=(vce-vbe)/ib
s=(b+1)/(1+(b*rc/(rc+rb*1000)))
#Result
print("Vce = %.1fV"%vce)
print("Rb = %.0f K-Ohm\nS = %d"%(rb,math.ceil(s)))
# Stability factor and Rb for CE configuration
import math
#Variable declaration
b=100.0 # Beta
rc=1000.0 # ohm
vcc= 10.0 # V
vbe=0 # v
vce=4.0 # v
#Calculations
ib=(vcc-vce)/((b+1)*rc)
rb=vce/ib
s=(b+1)/(1+(b*rc/(rc+rb)))
#Result
print("Ib = %.1f micro A"%(ib*10**6))
print("Rb = %.1f K-Ohm\nS = %.0f"%(rb/1000,s))
# calculation of parameters of two identical Si transistors
import math
#(a)
#Variable declaration
b=48.0 # beta
vbe=0.6 # V
vcc=20.6 # v
r1= 10.0 # k-ohm
rc= 5.0 # K-ohm
T=25.0 # temperature in Degree C
#Calculations
i=(vcc-vbe)/r1
ib=i/(2+b)
ic=b*ib
#Result
print("\n(a)\nI = %d mA\nIb = %.0f mA \nIc = %.2f mA"%(i,ib*1000,ic))
#-------------------------------------------------------------------------------#
#(b)
#Variable declaration
b2=98.0 # Beta
vbe=0.22 # V
#Calculations
I1=(vcc-vbe)/r1
ib1=I1/(2+b2)
ic2 =b2*ib1*1000
#Result
print("\n\n(b)\nI = %.3f mA\nIb = %.2f micro A\nIc = %.0f mA"%(I1,ib1*1000,ic2/1000))
# Quiescent Point and Stability Factor for self bias arrangement
import math
#Variable declaration
vcc =20.0 # V
rc=2.0 # K-Ohm
re= 0.1 # K-Ohm
r1=100.0 # K-Ohm
r2 =5.0 # k-Ohm
b=50.0 # beta
vbe=0.2 # V
#Calculations
v=r2*vcc/(r1+r2)
rb=r1*r2/(r1+r2)
ib=(v-vbe)/(rb+re*(1+b))
ic=b*ib*1000
ie=ib*1000+ic
vce=vcc-ic*rc/1000-ie*re/1000
s=(1+b)*((1+rb/re)/(1+b+rb/re))
#Result
print("V = %.3f V\nRb = %.2f K-Ohm\nIb = %.2f mA"%(v,rb,ib*1000))
print("Ic = %.2f mA\nIe = %.2f mA\nVce= %.0fV\nS = %d"%(ic/1000,ie/1000,math.ceil(vce),s))
# Self bias circuit design when Q point and stability are given
import math
#Variable declaration
vcc=16.0 # v
rc =1500.0 # Ohm
vce = 8.0 # v
ic = 4*10**-3# A
s=12.0 # Stability Factor
b=50.0 # Beta
#Calculation
ib=ic/b
re=vcc-vce-ic*rc
re=re/(ib+ic)
rb=14.4*re # (1+b)/((b/s)-1)
vbn=2.2 # V
V=vbn+ib*rb
r1=vcc*rb/V
r2=V*r1/(vcc-V)
#Result
print("Ib = %.0f micro A\nRe = %.2f K-Ohm\nRb = %.2f K-Ohm\nV = %.2fV"%(ib*10**6,re/1000,rb/1000,V))
print("R1 = %d K-Ohm\nR2 = %.2f K-Ohm"%(math.ceil(r1/1000),r2/1000))
# designing of self bias circuit of given specification
import math
#Variable declaration
# Though the procedure is same Answer do not match with the book
vcc=20.0 # v
vce =10 # v
vbe=0.6 # V
ic=2*10**-3# A
rc=4000.0 # ohm
ic2=2.25 # mA
ic1=1.75 # mA
b2=90.0 # Beta max
b1=36 # Beta min
s2=17.3 # stability factor
#Calculations
k=(vcc-vce)/ic #Rc+Re
re=k-rc
delic=(ic2-ic1)*10**-3
delb=b2-b1
rb=(1+b2)/((b2/s2)-1)
rb=rb*re
v=vbe+((rb+re*(1+b1))/b1)*ic
r1=rb*vcc/v
r2=r1*v/(vcc-v)
#Result
print("Re = %.0f K-Ohm"%(re/1000))
print("Rb = %.1f K-Ohm"%(rb/1000))
print("V = %.2fV"%v)
print("R1 = %.1f K-Ohm\nR2 = %.1f k-Ohm"%(r1/1000,r2/100))
# Q point and stability for self bias arrangement
import math
#Variable declaration
vcc=4.5 # V
r2 =2700.0 # Ohm
re=270.0 # Ohm
r1=27000.0 # ohm
b=44.0 # Beta
vbe=0.6
#Calculations
rb=r1*r2/(r1+r2)
v2=vcc*r2/(r1+r2)
#(a)
s=(1+b)/(1+(b*re/(re+rb)))
#(b)
ib=-(v2-vbe)/((b+1)*re+rb)
ic=b*ib
k=(b*2035+re+b*re)
vce=vcc-k/10**5
#(c)
s1=(1+b)/(1+(b*re)/(re+3150))
ib1=-0.19/((re*(1+b))+3.15)
vce2 =vcc-0.938
#Result
print("Rb = %.2f K-Ohm\nV2 = %.2fV"%(rb/1000,v2))
print("\n(a)\nS = %.1f"%s)
print("\n(b)Quiescent Point\nIb = %.3f mA\nIc = %.3f mA\nVce = %.3f V"%(ib*1000,ic*1000,vce))
print("\n(c)\nS=%.2f\nQ-Point:\nVce = %.3f V\nIb = %.3f mA\nIc = %.3f mA"%(s1,vce2,-ib1*1000,0.528))
# Stability factor and thermal resistance
import math
#Variable declaration
vcc=24.0 # v
re=270.0 # Ohm
rc=10000.0 # Ohm
vce =5.0 # V
vbe=0.6 # v
b=45.0 # beta
tj=150.0
ta=25.0
pd=125.0
#Calculations
ic=(vcc-vce)/(rc+(1+b)*re/b)
ib=ic/b
#(a)
r=(vce-vbe)/ib
#(b)
s=(1+b)/(1+(b*rc/(rc+r)))
#(c)
t=(tj-ta)/pd
#Result
print("Ic = %.3f mA\nIb = %.2f micro A"%(ic*1000,ib*10**6))
print("\n(a)In collector base circuit\n\tR = %.2f K-Ohm"%(r/1000))
print("\n(b)Stability Factor,\n\tS = %.3f"%s)
print("\n(c)\nThermal Resistance = %.0f°C/W"%(t*1000))
# DC input resistance of a JFET
import math
#Variable declaration
v=20.0 # v
igss=5*10**-12 # A
#Calculations
rgs= v/igss
#Result
print("Input Resistance, Rgs = %.0f * 10^12 Ohm"%(rgs/10**12))
# V0 for a JFET amplifier
import math
#Variable declaration
gm=2500.0 # micro mho
vm=5.0 # mV
rs=7500.0 # ohm
#Calculations
x=1/(gm*10**-6)
opr = 0.949*vm
z0=rs*x/(rs+x)
V0=3000*opr/3380
#Result
print("Open circuited output voltage, that is without considering RL")
print("\tV0 = %.2f mV\nOutput impedance, \n\tZ0 = %.0f Ohm"%(opr,math.ceil(z0)))
print("AC voltage across the load resistor is\n\tV0 = %.2f mV"%V0)