# voltage
import math
#Variable declaration
Rc=4.7 # in ohm
Vcc=24.0 # in V
Ic1=0 # in A
Ic=1.5 # in mA
#this is given as 15 mA in textbook which is wrong
#Calculations
Vce=Vcc-(Ic*Rc*10**-3*10**3)
Vce1=Vcc-Ic1*Rc
#Result
print("(i) Collector to emitter voltage,Vce(V) = %.2f"%Vce)
print("(ii) Collector to emitter voltage,Vce(V) = %.f"%Vce1)
# vce
import math
#Variable declaration
Beta=100.0
Rb=200*10**3 # in ohm
Rc=1*10**3 # in ohm
Vcc=10.0 # in V
#Calculations
Ib=Vcc/Rb # in A
Ic=Beta*Ib # in A
Vce=Vcc-(Ic*Rc)
#Result
print("Collector to emitter voltage,Vce(V) = %.f"%Vce)
# base resistance
import math
#Variable declaration
Vcc=20.0 # in V
Vbe=0.73 # in V
Rc=2.0 # in kilo-ohm
Icsat= Vcc/Rc #in mA
Beta=200.0
#RCalculatons
Ib=(Icsat/Beta)*10**3 # in micro-A
Rb=((Vcc-Vbe)/(Ib))*10**3 # in kilo-ohm
#Result
print("Rb < %.f kilo-ohm"%(math.ceil(Rb)))
# operating point
import math
#Variable declaration
Vcc=15.0 # in V
Rb=200.0 # in k-ohm
Rc=2.0 # in k-ohm
Beta=50.0
#Calculations
Ib=(Vcc/(Rb*10**3+(Beta*Rc*10**3)))*10**6
Ic=Beta*Ib*10**-3
Vce=Vcc-(Ic*10**-3*(Rc*10**3))
#Result
print("collector current,Ic(mA) = %.1f"%Ic)
print("Collector to emitter voltage,Vce(V) = %.f"%Vce)
# resistor
import math
#Variable declaration
Vcc=15.0 # in V
Vce=6.0 # in V
Rc=3*10**3 # in ohm
Beta=50.0
#Calculations
Ic=(Vcc-Vce)/Rc
Ib=Ic/Beta;
Rb=((Vcc/Ib)-(Beta*Rc))*10**-3
#Result
print("The value of resistoe,Rb(k-ohm) = %.f"%Rb)
# operating point
import math
#Variable declaration
Vcc=12.0 # in V
Rb1=70.0 # in k-ohm
Rb2=70.0 # in k-ohm
Beta=50.0
Rc=2.0 # in k-ohm
#Calculations
Ib=Vcc/((Rb1+Rb2+(Beta*Rc))*10**3)
Ic=Beta*Ib*10**3
Vce=Vcc-(Ic*Rc)
#Result
print("Collector current,Ic(mA) = %.1f"%Ic)
print("Collector to emitter voltage,Vce(V) = %.f"%Vce)
# operating point
import math
#Variable declaration
Vcc=9.0 # in V
Rb=50.0 # in k-ohm
Rc=250.0 # in ohm
Re=500.0 # in ohm
Beta=80.0
#Calculations
Ib=Vcc/(Rb*10**3+(Beta*Re))
Ic=Beta*Ib*10**3
Vce=Vcc-(Ic*10**-3*(Rc+Re));
#Result
print("collector current,Ic(mA) = %.f"%Ic)
print("Collector to emitter voltage,Vce(V) = %.f"%Vce)
# operating point
import math
#Variable declaration
R2=4.0 # in k-ohm
R1=40.0 # in k-ohm
Vcc=22.0 # in V
Rc=10.0 # in k-ohm
Re=1.5 # in k-ohm
Vbe=0.5 # in V
#Calculations
Voc=R2*10**3*Vcc/((R1+R2)*10**3)
Ic=(Voc-Vbe)/(Re*10**3)
Vce=Vcc-(Rc+Re)*Ic*10**3
#Result
print("Collector to emitter voltage,Vce(V) = %.1f"%Vce)
# maximum collector current
import math
#Variable declaration
Bv=12.0 # battery voltage in V
Cl=6.0 # collector load in k-ohm
#Calculations
CC=Bv/Cl
#Result
print("Collector current,(mA) = %.f"%CC)
# maximum collector current
import math
#Variable declaration
Bv=12.0 # battery voltage in V
P=2.0 # power in Watt
#Calculations
Ic=(P/Bv)*10**3
#Result
print("The maximum collector current,Ic(mA) = %.1f"%Ic)
# gain
import math
#Variable declaration
del_ic=1.0 # in mA
del_ib=10.0 # in micro-A
del_Vbe=0.02 # in V
del_ib=10*10**-6 # in A
Rc=2.0 # in k-ohm
Rl=10.0 # in k-ohm
#Calculations
Beta=del_ic/(del_ib*10**3)
Ri=(del_Vbe/del_ib)*10**-3
Rac=Rc*Rl/(Rc+Rl);
Av=round(Beta*Rac/Ri);
Ap=Beta*Av;
#Result
print("Current gain,Beta = %.f"%Beta)
print("Input impedence,Ri(k-ohm) = %.f"%Ri)
print("Effective load,Rac(k-ohm) = %.2f"%(math.floor(Rac*100)/100))
print("Voltage gain,Av = %.f"%Av)
print("power gain,Ap = %.f"%Ap)
# output voltage
import math
#Variable declaration
Rc=10.0 # in k-ohm
Rl=10 # in k-ohm
Beta=100.0
Ri=2.5
Iv=2.0 # input voltage in mV
#Calculations
Rac=Rc*Rl/(Rc+Rl)
Av=round(Beta*Rac/Ri)
Ov=Av*Iv*10**-3
#Result
print("Output voltage,(V) = %.1f"%Ov)
# gain and resistance
import math
#Variable declaration
I=1.0
hfe=46.0
hoe=80*10**-6
hre=5.4*10**-4
hie=800.0 # in ohm
RL=5*10**3 # in ohm
Rg=500 # in ohm
#Result
Aie=hfe/(I+(hoe*RL))
Aie = math.floor(Aie*10)/10
Zie=hie-(hre*RL*Aie)
Ave=(Aie*RL)/Zie
Ave=math.floor(Ave*10)/10
Zoe=((hie+Rg)/(hoe*(hie+Rg)-(hfe*hre)))/10**3
Ape=Aie*Ave
#Result
print("Current gain,Aie = %.1f"%(Aie))
print("Input resistance,Zie(ohm) = %.1f"%(Zie))
print("Voltage gain,Ave = %.1f"%Ave)
print("Output resistance,Zoe(k-ohm) = %.1f"%Zoe)
print("Power gain,Ape = %.1f"%Ape)
#voltage gain and power gain are calculated wrong in the textbook
# gain and voltage
import math
#Variable declaration
A=100.0 # gain without feedback
Beta=1.0/25 # feed back ratio
vi=50.0 # mV
Af=(A/(1+(Beta*A))) # gain with feedback
ff=Beta*A # feedback factor
Vo=Af*vi*10**-3 # in V
fv=Beta*Vo # in V
vin=vi*(1+Beta*A) # mV
#Result
print("gain with feedback is , = %.f"%Af)
print("feedback factor is, = %.f"%ff)
print("output voltage is ,(V) = %.f"%Vo)
print("feedback voltage is ,(V) = %.2f"%fv)
print("new increased input voltage is ,(mV) = %.f"%vin)
# voltage gain
import math
#Variable declaration
A=1000.0 # gain without feedback
fctr=0.40 # gain reduction factor
A2=800.0 # redued gain
#Calculations
Af=A-fctr*A # gain with feedback
Beta=((A/Af)-1)/A # feed back ratio
Af2=((A2)/(1+(Beta*A2)))
prfb= ((A-A2)/A)*100 #percentage reduction without feedback
prwfb= ((Af-Af2)/Af)*100 #percentage reduction without feedback
#Result
print("(i) voltage gain is , = %.1f"%Af2)
print("(ii) percentage reduction without feedback is,(%%) = %.f"%prfb)
print(" percentage reduction with feedback is,(%%) = %.2f"%(math.ceil(prwfb*100)/100))
# small change in gain
import math
#Variable declaration
A=200.0 #gain without feedback
Beta=0.25 #feed back ratio
gc=10 #percent gain change
#Calculations
dA=gc/100.0
dAf= ((1/(1+Beta*A)))*dA
#Result
print("small change in gain is, = %.4f"%(math.floor(dAf*10**4)/10**4))
# input voltage
import math
#Variable declaration
A=200.0 # gain without feedback
Beta=0.05 # feed back ratio
Dn=10.0 # percentage distortion
vo=0.5 # initial output voltage
#Calculations
Af=(A/(1+(Beta*A))) # gain with feedback
Dn1=(Dn/(1+A*Beta)) # percentage Distortion with negative feedback
ff=Beta*A # feedback factor
vi=A*vo # in V
vin=vi/Af # in V
#Result
print("gain with negative feedback is , = %.1f"%Af)
print("percentage Distortion with negative feedback is ,(%%) = %.3f"%Dn1)
print("new input voltage is ,(V) = %.1f"%vin)
#gain and input voltage are calculated wrong in the textbook
# percentage of feedback
import math
#Variable declaration
A=50.0 # gain without feedback
Af=10.0 # gain with feedback
#Calculations
Beta=(((A/Af)-1)/A)*100 # feed back ratio
print("percentage of feedback is ,(%%) = %.f"%Beta)
# band width
import math
#Variable declaration
Bw=200.0 # bandwidth in kHz
vg=40.0 # dB
fb=5.0 # percentage negetive feedback
A=40.0 # gain without feedback
#Calculations
Beta=fb/100 # feed back ratio
Af=(A/(1+(Beta*A))) # gain with feedback
Bwf= (A*Bw)/Af # Bandwidth with feedback
#Result
print(" new band-width is ,(kHz) = %.f"%Bwf)
# percentage reduction
import math
#Variable declaration
A=50.0 # gain without feedback
Af=25.0 # gain with feedback
Ad=40.0 # new gain after ageing
#Calculations
Beta=(((A/Af)-1)/A) # feed back ratio
Af1=(Ad/(1+(Beta*Ad)))# new gain with feedback
df=Af-Af1 # reduction in gain
pdf= (df/Af)*100 # percentage reduction in gain
#Result
print(" percentage reduction in gain is ,(%%) = %.1f"%pdf)
# Av and beta
import math
#Variable declaration
Af=100.0 # gain with feeback
vi=50.0 # in mV
vi1=60.0 # in mV
#Calcualtion
AAf=vi1/vi
A=AAf*Af
Beta=(((A/Af)-1)/A)
#Result
print("Av is ,= %.f"%A)
print("feedback factor is, = %.5f or 1/600"%Beta)