# For the diode circuit, calculate the ac resistance, rac, for the following values of R: (a) 10 kOhms, (b) 5 kOhms, and (c) 1 kOhms. Use the second approximation of a diode.
# Given data
R1 = 10.*10**3# # Resistance 1=10 kOhms
R2 = 5.*10**3# # Resistance 2=5 kOhms
R3 = 1.*10**3# # Resistance 3=1 kOhms
Vdc = 10.# # DC supply=10 Volts
V = 0.7# # Starting voltage of diode=0.7 Volts
A = 25.*10**-3# # Constant
# For R=10 kOhms
Id1 = (Vdc-V)/R1#
rac1 = A/Id1#
print 'The Ac Resistance with R=10 kOhms = %0.2f Ohms'%rac1
# For R=5 kOhms
Id2 = (Vdc-V)/R2#
rac2 = A/Id2#
print 'The Ac Resistance with R=5 kOhms = %0.2f Ohms'%rac2
# For R=1 kOhms
Id3 = (Vdc-V)/R3#
rac3 = A/Id3#
print 'The Ac Resistance with R=1 kOhms = %0.2f Ohms'%rac3
print 'Approx 2.69 Ohms'
#A common-emitter amplifier circuit has an input of 25 mVp-p and an output of 5 Vp-p. Calculate Av.
# Given data
Vin = 25*10**-3# # Input voltage=25 mVolts(p-p)
Vo = 5# # Output voltage=5 Volts(p-p).
Av = Vo/Vin#
print 'The Voltage Gain Av =%0.2f'%Av
# assume Av still equals 300. If vin is 5 mVp-p, calculate Vout.
# Given data
Vin = 5*10**-3# # Input voltage=5 mVolts(p-p)
Av = 300# # Voltage gain=300
Vo = Av*Vin#
print 'The Output Voltage = %.2f Volts(p-p)'%Vo
# Assume that re varies from 3.33 Ohms to 6.67 Ohms as the temperature of the transistor changes. Calculate the variation in the voltage gain, Av.
# Given data
rl = 600# # Load resistance=600 Ohms
re = 6.67# # Internal emitter resistance=6.67 Ohms
Av = rl/re#
print 'The Voltage Gain Av =%0.2f'%Av
print 'Approx 90'
# Assume that r'e varies from 3.33 Ohms to 6.67 Ohms. Calculate the minimum and maximum values for Av.
# Given data
rl = 600.# # Load resistance=600 Ohms
re1 = 3.33# # Internal emitter resistance=3.33 Ohms
re2 = 6.67# # Internal emitter resistance=6.67 Ohms
rE = 60.# # Emitter resistance=60 Ohms
Av1 = rl/(re1+rE)#
print "The Voltage Gain Av(max) when r`e=3.33 Ohms: %0.2f"%Av1
Av2 = rl/(re2+rE)#
print 'The Voltage Gain Av(min) when r`e=6.67 Ohms: %0.2f'%Av2
# Find the exact value of Av. Also, find Vout.
# Given data
rl = 909.# # Load resistance=909 Ohms
re = 3.35# # Internal emitter resistance=3.35 Ohms
Vin = 1.# # Input voltage=1 Volts(p-p)
Av = rl/(re+rl)#
print 'The Voltage Gain Av =%0.3f'%Av
print 'i.e 996 mVolts(p-p)'
Vo = Av*Vin#
print 'The Output Voltage = %0.3f Volts(p-p)'%V
# Calculate Zin.
# Given data
rl = 909.# # Load resistance=909 Ohms
re = 3.35# # Internal emitter resistance=3.35 Ohms
B = 100.# # Beta=100
R1 = 4.7*10**3# # Resistance1=4.7 kOhms
R2 = 5.6*10**3# # Resistance2=5.6 kOhms
Zibase = B*(re+rl)#
A = (R1*R2)/(R1+R2)#
Zin = (Zibase*A)/(A+Zibase)#
print 'The Input impedence = %0.2f Ohms'%Zin
print 'i.e 2.48 kOhms'
%matplotlib inline
from matplotlib.pyplot import plot,xlabel,title,ylabel,show
# Calculate the following quantities: Vb, Ve, Ic, Vc, Vce, r'e, Zin(base), Zin, Av, vb, and vout. Also, plot the dc load line.
# Given data
R1 = 22.*10**3# # Resistance1=22 kOhms
R2 = 18.*10**3# # Resistance2=18 kOhms
Rg = 600.# # Generator resistance=600 Ohms
Re = 1.5*10**3# # Emitter resistance=1.5 kOhms
Rl = 1.*10**3# # Load resistance=1 kOhms
Vcc = 20.# # Supply Voltage=20 Volts
Vbe = 0.7# # Voltage Base-Emitter=0.7 Volts
B = 200.# # Beta=200
vin = 5.# # Input Voltage=5 Volts(p-p)
# Calculate the DC quantities first:
Vb = Vcc*(R2/(R1+R2))#
print 'The Base Voltage = %0.2f Volts'%Vb
Ve = Vb-Vbe#
print 'The Emitter Voltage = %0.2f Volts'%Ve
Ie = Ve/Re#
Ic = Ie# # Ic =~ Ie
print 'The Collector current = %0.2f Amps'%Ic
print 'i.e 5.53 mAmps'
Vc = Vcc# # Since the collector is tied directly to Vcc
print 'The Collector Voltage = %0.2f Volts'%Vc
Vce = Vcc-Ve#
print 'The Collector-Emmiter Voltage = %0.2f Volts'%Vce
Icsat = Vcc/Re#
Vceoff = Vcc#
# Now, calculate AC quantities:
a = 25.*10**-3#
re = a/Ie#
print 'The AC emmiter resistance = %0.2f Ohms'%re
print 'Approx 4.52 Ohms'
b = Re*Rl#
c = Re+Rl#
rl = b/c#
Av = rl/(rl+re)#
print 'The Voltage gain =%0.2f'%Av
Zinbase = B*(re+rl)#
print 'The Input Base Impedence = %0.2f Ohms'%Zinbase
print 'i.e 120.9 kOhms'
d = 1./Zinbase#
e = 1./R1#
f = 1./R2#
Zin = (d+e+f)**-1
print 'The Input Impedence = %0.2f Ohms'%Zin
print 'i.e 9.15 kOhms'
vb = vin*(Zin/(Zin+Rg))#
print 'The AC base voltage = %0.2f Volts(p-p)'%vb
vout = Av*vb#
print 'The AC output voltage = %0.2f Volts(p-p)'%vout
Icq = Ic
Vceq = Vce
Vce1=[Vcc, 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 mAmps")
title("DC Load-line for Emitter Follower Circuit")
show()
# Calculate the following: Ie, Vcb, r'e, Av, vout and zin.
# Given data
Rc = 1.5*10**3# # Collector resistance=1.5 kOhms
Re = 1.8*10**3# # Emitter resistance=1.8 kOhms
Rl = 1.5*10**3# # Load resistance=1.5 kOhms
Vcc = 15.# # +ve Supply Voltage=15 Volts
Vee = 9.# # -ve Supply Voltage=9 Volts
Vbe = 0.7# # Voltage Base-Emitter=0.7 Volts
vin = 25.*10**-3# # Input Voltage=25 mVolts(p-p)
Ie = (Vee-Vbe)/Re#
print 'The Emmiter current = %0.4f Amps'%Ie
print 'i.e 4.61 mApms'
Ic = Ie# # Ic =~ Ie
Vcb = Vcc-(Ic*Rc)#
print 'The Collector-Base Voltage = %0.2f Volts'%Vcb
print 'Approx 8.09 Volts'
a = 25.*10**-3#
re = a/Ie#
print 'The AC emmiter resistance = %0.2f Ohms'%re
b = Rc*Rl#
c = Rc+Rl#
rl = b/c#
Av = rl/re#
print 'The Voltage gain =%0.2f'%Av
vout = Av*vin#
print 'The AC output voltage = %0.2f Volts(p-p)'%vout
print 'Approx 3.46 Volts(p-p)'
d = Re*re
e = Re+re
Zin = d/e#
print 'The Input Impedence = %0.2f Ohms'%Zin
# Calculate the ac output voltage, vout.
# Given data
Rc = 1.2*10**3# # Collector resistance=1.2 kOhms
Re = 2.2*10**3# # Emitter resistance=2.2 kOhms
Rl = 3.3*10**3# # Load resistance=3.3 kOhms
Rg = 600.# # Generator Resistance=600 Ohms
Vcc = 12.# # +ve Supply Voltage=15 Volts
Vee = 12.# # -ve Supply Voltage=9 Volts
Vbe = 0.7# # Voltage Base-Emitter=0.7 Volts
vin = 1.# # Input Voltage=1 Volts(p-p)
Ie = (Vee-Vbe)/Re#
a = 25*10**-3#
re = a/Ie#
b = Rc*Rl#
c = Rc+Rl#
rl = b/c#
Av = rl/re#
d = Re*re
e = Re+re
Zin = d/e#
ve = vin*(Zin/(Zin+Rg))#
vout = Av*ve#
print 'The AC output voltage = %0.2f Volts(p-p)'%vout