from numpy import arange
%matplotlib inline
from matplotlib.pyplot import show,title,ylabel,xlabel,plot
# given data
V_CC= 10## V
R_E= 430## Ω
V_BE= 0.7##in V
V_B= 5##in V
# The collector saturation current,
I_Csat= V_CC/R_E## A
# The collector emitter voltage,
V_CEcutoff= V_CC## V
# The collector current,
I_C= (V_B-V_BE)/R_E## A
# The collector emitter voltage,
V_CE= V_CC-(V_B-V_BE)## V
I_C= I_C*10**3## mA
print "Q-point = (%.2fV,%.2fmA)"%(V_CE,I_C)
print "DC load line shown in figure"
I_C= I_C*10**-3## A
V_CE= arange(0,0.1+V_CEcutoff,0.1) # V
I_C= (V_CC-V_CE)/R_E*10**3## mA
# The plot of DC load line
plot(V_CE,I_C)#
xlabel("V_CE in volts")
ylabel("I_C in mA")
title("DC load line")
show()
# given data
Vin= 100## mV
Vin= Vin*10**-3## V
R_E= 430## Ω
R_L= 1*10**3## Ω
r_e= 2.5## Ω
# The ac load resistance,
r_L= R_E*R_L/(R_E+R_L)## Ω
A= r_L/(r_L+r_e)## unit less
# The output voltage
Vout= A*Vin## V
Vout= Vout*10**3## mV
print "The output voltage = %.2f mV"%Vout
# given data
R_E= 430## Ω
R_L= 100## Ω
R1= 10*10**3## Ω
R2= 10*10**3## Ω
bita= 200## unit less
r_e= 2.5## Ω
r_L= R_E*R_L/(R_E+R_L)## Ω
# The voltge gain
A= r_L/(r_L+r_e)#
print "The voltge gain = %.2f"%A
Zin_base= bita*(r_L+r_e)## Ω
# The input impedence
Zin= R1*R2*Zin_base/(R1*R2+R2*Zin_base+Zin_base*R1)## Ω
Zin= Zin*10**-3## k ohm
print "The input impedence = %.2f kΩ"%Zin
# given data
R_E= 430## Ω
R_L= 100## Ω
R1= 10*10**3## Ω
R2= 10*10**3## Ω
bita= 200#
r_e= 2.5## Ω
# The load resistance
r_L= R_E*R_L/(R_E+R_L)## Ω
# The power gain
G= bita*r_L/(r_L+r_e)#
print "The power gain = %.2f"%G
# given data
R_C= 5*10**3## Ω
r_e= 25## Ω
Vin= 1*10**-3## V
R_L= 1*10**3## Ω
A= R_C/r_e#
# Thevenin voltage,
V_TH= A*Vin## V
# The ac output voltage
Vout= R_L*V_TH/(R_C+R_L)## V
Vout= Vout*10**3## mV
print "The ac output voltage = %.2f mV"%Vout
# given data
V_B= 1.8## V
V_E= 1.1## V
V_TH= 200*10**-3## V
I_E= 1*10**-3## A
r_e= 2.5##in Ω
bita=200#
V_CC= 10## V
R_C= 5*10**3## Ω
R_E= 430## Ω
R_L= 1*10**3##in Ω
I_C= I_E## A
# The collector voltage,
V_C= V_CC-I_C*R_C## V
V_E= 4.3## V
# The emitter current,
I_E= V_E/R_E## A
# The base current,
I_B= I_E/bita## A
# The load resistance,
r_L= R_E*R_L/(R_E+R_L)## Ω
Zin= bita*(r_L+r_e)## Ω
Vin= Zin*V_TH/(R_C+Zin)## V
# The ac output voltage
Vout= r_L*Vin/(r_L+r_e)##in V
Vout= Vout*10**3## mV
print "The ac output voltage = %.2f mV"%Vout
# given data
R1= 100##in kΩ
R2= 100##in kΩ
R3= 360##in Ω
bita= 100#
V1= 5## V
v1= 1.4## V
v2= 25## mV
# Voltage at first base
V2= R1/R2*V1## V
# Emitter current = %.2f second transistor
I_E2= (V2-v1)/R3## A
I_E2= I_E2*10**3## mA
# Resistance of second emitter diode,
r_desh_e2= v2/I_E2## Ω
# Base current
I_B2= I_E2/bita## mA
# Emitter current,
I_E1= I_B2## mA
# First emitter diode resistance
r_desh_e1= v2/I_E1## Ω
print "The value of r''e2 = %.2f Ω"%r_desh_e2
print "The value of r''e1 = %.2f Ω"%r_desh_e1
# given data
R_E= 360## Ω
R_L= 1*10**3## Ω
R1= 100*10**3##in Ω
R2= 100*10**3##in Ω
r_desh_e1= 250## Ω
r_desh_e2= 2.5## Ω
h_FE= 100#
h_fe= 100#
# The load resistance,
r_L= R_E*R_L/(R_E+R_L)## Ω
Zin1= h_FE*h_fe*r_L## Ω
Zin= R1*R2*Zin1/(R1*R2+R2*Zin1+Zin1*R1)## Ω
Zin2= h_FE*(r_L+r_desh_e2)## Ω
Zin1= h_FE*(Zin2+r_desh_e1)## Ω
# The input impedence
Zin= R1*R2*Zin1/(R1*R2+R2*Zin1+Zin1*R1)## Ω
Zin= Zin*10**-3## k ohm
print "The input impedence = %.2f kΩ"%Zin
# given data
Vin= 20## V
Vz= 10## V
Rs= 680## Ω
V_BE= 0.7## V
R_L= 15## Ω
bita= 80#
Is= (Vin-Vz)/Rs## A
Vout= Vz-V_BE## V
I_E= Vout/R_L## A
I_L= I_E## A
I_B= I_E/bita## A
# The current through the zener diode
Iz= Is-I_B## A
V_CE= Vin-Vout## V
# The transistor power dissipation
Po= I_L*(Vin-Vout)## W
Iz= Iz*10**3## mA
print "The current through the zener diode = %.2f mA"%Iz
print "The transistor power dissipation = %.2f watt"%Po