%matplotlib inline
from matplotlib.pyplot import plot,show,title,xlabel,ylabel
# Calculate the following dc quantities Icq, Vceq, Pd, Ic(sat) and Vce(off). Also draw the dc load line
# Given Data
R1 = 18.*10**3# # Resistor 1=18k Ohms
R2 = 2.7*10**3# # Resistor 2=2.7k Ohms
Vcc = 20.# # Supply Voltage(Collector)=20 Volts
Vbe = 0.7# # Voltage Base-Emitter=0.7 Volts
Re = 240.# # Emitter Resistor=240 Ohms
Rc = 1.*10**3# # Collector Resistor=1k Ohms
Vb = Vcc*(R2/(R1+R2))#
Ve = Vb-Vbe#
#Ie = Ic#
Icq = Ve/Re#
print 'The value of Icq = %0.2e Amps'%Icq
print 'i.e Approx 7.91 mAmps'
Vceq = Vcc-Icq*(Rc+Re)#
print 'The value of Vceq = %0.2f Volts'%Vceq
Pd = Vceq*Icq#
print 'The Power Dissipation = %0.2e Watts'%Pd
print 'i.e 80.6 mWatts'
Icsat = Vcc/(Rc+Re)#
print 'The value of Ic(sat) = %0.2e Amps'%Icsat
print 'i.e 16.1 mAmps'
Vceoff = Vcc#
print 'The value of Vce(off) = %0.2f Volts'%Vceoff
# For DC load line
Vce1=[Vceoff ,Vceq, 0]
Ic1=[0, Icq, Icsat]
#To plot DC load line
print "Q(%f,%f)\n"%(Vceq,Icq)
plot(Vce1, Ic1)
plot(Vceq,Icq)
plot(0,Icq)
plot(Vceq,0)
plot(0,Icsat)
plot(Vceoff,0)
xlabel("Vce in volt")
ylabel("Ic in Ampere")
title("DC Load-line for Common-Emitter Class A Amplifier Circuit")
show()
%matplotlib inline
from matplotlib.pyplot import plot,show,title,xlabel,ylabel
# Claculate the following AC quantities Av, Vout, Pl, Pcc and percent efficiency. Also calculate the endpoints of ac loadline
# Given data
Icq = 7.91*10**-3# # Collector Currect(Q-point)=7.91 mAmps
Rl = 1.5*10**3# # Load Resistor=1.5 kOhms
Rc = 1.*10**3# # Collector Resistor=1 kOhms
Vin = 25.*10**-3# # Input Voltage=25 mVolts(p-p)
R1 = 18.*10**3# # Resistor 1=18 kOhms
R2 = 2.7*10**3# # Resistor 2=2.7 kOhms
Vcc = 20.# # Supply Voltage(Collector)=20 Volts
Vceq = 10.19# # Voltage Colector-Emitter(Q-point)=10.19 Volts
rc = (25.*10**-3)/Icq#
rl = (Rc*Rl)/(Rc+Rl)
Av = rl/rc#
print 'The Voltage Gain Av =%0.2f'%Av
print 'Approx 190'
Vout = Av*Vin#
print 'The Output Voltage = %0.2f Volts'%Vout
Pl = (Vout*Vout)/(8*Rl)#
print 'The Load Power = %0.2e Watts'%Pl
print 'i.e Approx 1.88 mWatts'
Ivd = Vcc/(R1+R2)#
# Ic = Icq
Icc = Ivd+Icq#
Pcc = Vcc*Icc#
print 'The Dc Input Power = %0.2e Watts'%Pcc
print 'i.e Approx 177.4 mWatts'
efficiency = ((Pl/Pcc)*100)#
print 'The Efficiency in %% =%0.2f'%efficiency
print 'Approx 1%'
# Endpoints of AC load line
icsat = Icq+(Vceq/rl)#
print 'The Y-axis Value of AC Load-line is ic(sat) = %0.2e Amps'%icsat
print 'i.e 24.89 mAmps'
vceoff = Vceq+Icq*rl#
print 'The X-axis value of AC Load-line is vce(off) = %0.2f Volts'%vceoff
# For AC load line
Vce1=[vceoff, Vceq, 0]
Ic1=[0 ,Icq ,icsat]
#To plot AC load line
print "Q(%f,%f)\n"%(Vceq,Icq)
plot(Vce1, Ic1)
plot(Vceq,Icq)
plot(0,Icq)
plot(Vceq,0)
plot(0,icsat)
plot(vceoff,0)
xlabel("Vce in volt")
ylabel("Ic in Ampere")
title("AC Load-line for Common-Emitter Class A Amplifier Circuit")
show()
#Calculate the following quantities: Pl, Pcc, Pdmax & percent efficiency
# Given data
Vin = 20.# # Input Voltage=20 Volts(p-p)
Vopp = 20.# # Output Voltage(p-p)=20 Volts(p-p)
Vcc = 24.# # Supply Voltage(Collector)=24 Volts
Vop = 10.# # Output Voltage(peak)=10 Volts
Rl = 8.# # Load Resistor=8 Ohms
Vopp1 = Vopp*Vopp#
Pl = (Vopp1/(8*Rl))#
print 'The Load Power = %0.2f Watts'%Pl
Icc = ((Vop/Rl)*0.318)#
Pcc = Vcc*Icc
print 'The DC Input Power = %0.2f Watts'%Pcc
eff = ((Pl/Pcc)*100)#
print 'The Efficiency in %% =%0.2f'%eff
Pd = (Vcc*Vcc)/(40*Rl)#
print 'The Maximum Power Dissipation = %0.2f Watts'%Pd
# Calculate the following quantities Pl, Pcc & percent efficiency
# Given data
Rl = 8# # Load Resistor=8 Ohms
Vopp = 50# # Output Voltage(p-p)=50 Volts(p-p)
Vcc = 30# # Supply Voltage(Collector)=30 Volts
Vopk = Vopp/2# # Output Voltage(peak)
Pl = (Vopp*Vopp)/(8*Rl)#
print 'The Load Power = %0.2f Watts'%Pl
Pcc = Vcc*0.636*(Vopk/Rl)#
print 'The DC Input Power = %0.2f Watts'%Pcc
efficiency = ((Pl/Pcc)*100)#
print 'The Efficiency in %% = %0.2f'%efficiency
from math import sqrt
# Calculate the fr of LC tank circuit and dc bias voltage at base
# Given data
L = 100*10**-6# # Inductor=100 uHenry
C = 63.325*10**-12# # Capacitor=63.325 pFarad
Vin = 1.5# # Input Voltage(peak)=1.5 Volts
Vbe = 0.7# # Voltage Base-Emitter=0.7 Volts
A = sqrt(L*C)#
fr = 1./(2*3.14*A)#
print 'The Resonant Frequency = %0.2e Hertz'%fr
print 'i.e 2 MHz'
Vdc = (Vin-Vbe)#
print 'The DC Bias Voltage at Base = %0.2f Volts'%Vdc
# Calculate the minimum base reisitance Rb, necessary to provide clamping action
# Given data
C = 0.01*10**-6# # Capacitor=0.01 uFarad
fr = 2.*10**6# # Resonant Frequency=2 MHertz
fin = fr
T = 1/fin
Rb = 10*T/C
print 'The Minimum Base Reisitance Rb to Provide Clamping Action = %0.f Ohms'%Rb
# Calculate the Bandwidth
# Given data
L = 100*10**-6# # Inductor=100 uHenry
fr = 2*10**6# # Resonant Frequency=2 MHertz
ri = 12.56# # Resistance of Coil=12.56 Ohms
Rp = 100*10**3# # Rp=100 kOhms
Xl = 2*3.14*fr*L#
Qcoil = Xl/ri#
Ztank = Qcoil*Xl#
A = Ztank#
B = Rp#
C = (A*B)/(A+B)#
Qckt = C/Xl#
BW = fr/Qckt#
print 'The Bandwidth = %0.f Hertz'%BW
print 'i.e Approx 45 kHz'