# Chapter 6: BJT Amplifiers

### Example 6.1, Page Number: 171

In [1]:
%matplotlib inline

Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.
In [2]:
# result

print "theoretical example"

theoretical example

### Example 6.2, Page Number: 174

In [3]:
# variable declaration
I_E=2.0*10**-3;   #emittor current

#calculation
r_e=25.0*10**-3/I_E;  #ac emitter resistance

#result
print "ac emitter resistance = %.2f ohms" %r_e

ac emitter resistance = 12.50 ohms

### Example 6.3, Page Number: 178

In [4]:
# variable declaration
I_E=3.8*10**-3;    #emittor current
B_ac=160.0;        #AC value
R1=22*10**3;       #resistance in ohm
R2=6.8*10**3;      #resistance in ohm
R_s=300.0;         #resistance in ohm
V_s=10.0*10**-3;   #voltage in volt
r_e=25.0*10**-3/I_E;

#calculation
R_in_base=B_ac*r_e;   #base resistance
R_in_tot=(R1*R2*R_in_base)/(R_in_base*R1+R_in_base*R2+R1*R2);
V_b=(R_in_tot/(R_in_tot+R_s))*V_s;  #base voltage

#result
print "voltage at the base of the transistor = %.3f volts" %V_b

voltage at the base of the transistor = 0.007 volts

### Example 6.4, Page Number: 180

In [5]:
import math
# variable declaration
R_E=560.0;     #resistance in ohm
f=2*10**3;     #minimum value of frequency in hertz
X_C=R_E/10.0;  #minimum value of capacitive reactance

#calculation
C2=1.0/(2.0*math.pi*X_C*f); #capacitor

#result
print "value of bypass capacitor = %.7f farads" %C2

value of bypass capacitor = 0.0000014 farads

### Example 6.5, Page Number: 181

In [6]:
import math
# variable declaration
r_e=6.58;      #from ex6.3
R_C=1.0*10**3; #collector resistance
R_E=560;       #emittor resistance

#calculation
A_v=R_C/(R_E+r_e);   #gain without bypass capacitor
A_v1=R_C/r_e;        #gain with bypass capacitor
print "gain without bypass capacitor = %.2f" %A_v
print "gain in the presence of bypass capacitor = %.2f" %A_v1

gain without bypass capacitor = 1.76
gain in the presence of bypass capacitor = 151.98

### Example 6.6, Page Number: 182

In [7]:
# variable declaration
R_C=10.0**3;    #resistance in ohm
R_L=5.0*10**3;  #inductor resistance
r_e=6.58;       #r_e value

#calculation
R_c=(R_C*R_L)/(R_C+R_L);  #collector resistor

#result
print "ac collector resistor = %.2f ohms" %R_c
print "gain with load = %.2f" %A_v

ac collector resistor = 833.33 ohms
gain with load = 126.65

### Example 6.7, Page Number: 184

In [8]:
# variable declaration
R_C=3.3*10**3;   #resistance in ohm
R_E1=330.0;      #emitter resistance

#calculation
A_v=R_C/R_E1;    #voltage gain

#result
print "approximate voltage gain as R_E2 is bypassed by C2 = %.2f" %A_v

approximate voltage gain as R_E2 is bypassed by C2 = 10.00

### Example 6.8, Page Number: 184

In [9]:
import math
B_DC=150.0;
B_ac=175.0;
V_CC=10.0;
V_s=10.0*10**-3;
R_s=600.0;
R1=47.0*10**3;
R2=10.0*10**3;
R_E1=470.0;
R_E2=470.0;
R_C=4.7*10**3;
R_L=47.00*10**3;
R_IN_base=B_DC*(R_E1+R_E2);
#since R_IN_base is ten times more than R2,it can be neglected in DC voltage calculation
V_B=(R2/(R2+R1))*V_CC;
V_E=V_B-0.7;
I_E=V_E/(R_E1+R_E2);
I_C=I_E;
V_C=V_CC-I_C*R_C;
print('dc collector voltage = %.3f volts'%V_C)
r_e=25.0*10**-3/I_E;
#base resistance
R_in_base=B_ac*(r_e+R_E1);
#total input resistance
R_in_tot=(R1*R2*R_in_base)/(R1*R2+R_in_base*R1+R_in_base*R2);
attenuation=R_in_tot/(R_s+R_in_tot);
#ac collector resistance
R_c=R_C*R_L/(R_C+R_L);
#voltage gain from base to collector
A_v=R_c/R_E1;
#overall voltage gain A_V
A_V=A_v*attenuation;
#rms voltage at collector V_c
V_c=A_V*V_s;
V_out_p=math.sqrt(2)*V_c;
print('V_out peak = %d mV'%(V_out_p*1000))

################Waveform plotting##############################

import pylab
import numpy

t = arange(0.0, 4.0, 0.0005)

subplot(121)
plot(t, V_C+V_c*sin(2*pi*t))
ylim( (4.63,4.82) )
title('Collector Voltage')

subplot(122)
plot(t, -V_s*sin(2*pi*t))
plot(t, V_out_p*sin(2*pi*t))
ylim( (-0.15,0.15) )
title('Source and output AC voltage')

dc collector voltage = 4.728 volts
V_out peak = 119 mV
Out[9]:
<matplotlib.text.Text at 0xad2caac>

### Example 6.9,Page Number: 190

In [10]:
# variable declaration
R_E=10.0**3;      #emitter resistance
R_L=10.0**3;      #resistance in ohm
R1=18.0*10**3;    #R1 in ohm
R2=18.0*10**3;    #R2 in ohm
B_ac=175.0;      #AC value
V_CC=10.0;       #voltage in volt
V_BE=0.7;      #base-emitter voltage
V_in=1.0;        #input voltage in volt

#calculation

R_e=(R_E*R_L)/(R_E+R_L);        #ac emitter resistance R_e
R_in_base=B_ac*R_e;             #resistance from base R_in_base

#total input resiatance R_in_tot
R_in_tot=(R1*R2*R_in_base)/(R1*R2+R1*R_in_base+R2*R_in_base);
print "total input resistance = %.2f ohms" %R_in_tot
V_E=((R2/(R1+R2))*V_CC)-V_BE;   #emitter voltage
I_E=V_E/R_E;                    #emitter current
r_e=25.0*10**-3/I_E;            #emitter resistance
A_v=R_e/(r_e+R_e);
print "voltage gain =  %.2f" %A_v
#ac emitter current I_e
#V_e=A_v*V_b=1V
V_e=1.0;                          #V_evoltage
I_e=V_e/R_e;                    #emitter current
I_in=V_in/R_in_tot;             #input current in ampere
A_i=I_e/I_in;                   #current gain
print "current gain = %.2f" %A_i
A_p=A_i;                        #power gain
#since R_L=R_E, one half of the total power is disspated to R_L

total input resistance = 8160.62 ohms
voltage gain =  0.99
current gain = 16.32
power gain delivered to load = 8.16

### Example 6.10, Page Number: 193

In [11]:
# variable declaration
V_CC=12.0;        #source voltage in volt
V_BE=0.7;         #base-emitter volatge
R_C=1.0*10**3;    #resistance in ohm
r_e_ce=5.0;       #for common emitter amplifier
R1=10.0*10**3;    #resistance in ohm
R2=22.0*10**3;    #resistance in ohm
R_E=22.0;         #emitter resistance in ohm
B_DC=100.0;       #dc value
B_ac=100.0;       #ac value

#calculation
pt=R2+B_DC**2*R_E     #temp variable
V_B=((R2*B_DC**2*R_E/(pt))/(R1+(R2*B_DC**2*R_E/(pt))))*V_CC;
V_E=V_B-2.0*V_BE;      #emitter voltage
I_E=V_E/R_E;           #emitter current
r_e=25.0*10**-3/I_E;   #for darlington emitter-follower
P_R_E=I_E**2*R_E;      #power dissipated by R_E
P_Q2=(V_CC-V_E)*I_E    #power dissipated by transistor Q2
R_e=R_E*R_L/(R_E+R_L); #ac emitter resi. of darlington emitter follower
#total input resistance of darlington
kt=R_e+r_e             #temp varaible
R_in_tot=R1*R2*B_ac**2*(kt)/(R1*R2+R1*B_ac**2*(kt)+R2*B_ac**2*(kt));
R_c=R_C*R_in_tot/(R_C+R_in_tot);    #effective ac resistance
A_v_CE=R_c/r_e_ce;     #voltage gain of common emitter
A_v_EF=R_e/(r_e+R_e);  #voltage gain of common emitter amplifier
A_v=A_v_CE*A_v_EF;     #overall voltage gain

#result
print "voltage gain of common emitter amplifier= %.2f" %A_v_CE
print "voltage gain of common emitter amplifier= %.2f" %A_v_EF
print "overall voltage gain = %.2f" %A_v

voltage gain of common emitter amplifier= 172.08
voltage gain of common emitter amplifier= 0.99
overall voltage gain = 169.67

### Example 6.11, Page Number: 196

In [12]:
# variable declaration
B_DC=250.0;    #dc value
R_C=2.2*10**3; #resistance in ohm
R_E=1.0*10**3; #emitter resistance
R1=56.0*10**3; #resistance in ohm
R2=12.0*10**3; #resistance in ohm
V_BE=0.7;      #base-emitter voltage in volt
V_CC=10.0;     #source voltage in volt

#calculation
#since B_DC*R_E>>R2
V_B=(R2/(R1+R2))*V_CC;
V_E=V_B-V_BE;   #emiiter voltage
I_E=V_E/R_E;    #emitter current
r_e=25.0*10**-3/I_E;  #r_e value
R_in=r_e;       #input resistance
R_c=R_C*R_L/(R_C+R_L);    #ac collector resistance
A_v=R_c/r_e;    #current gain
#current gain is almost 1
#power gain is approximately equal to voltage gain
A_p=A_v;  #power gain
A_i=1;    #current gain

#result
print "input resistance = %.2f ohms" %R_in
print "voltage gain = %.2f" %A_v
print "current gain = %.2f" %A_i
print "power gain = %.2f" %A_p

input resistance = 23.48 ohms
voltage gain = 76.80
current gain = 1.00
power gain = 76.80

### Example 6.12, Page Number: 197

In [13]:
import math
# variable declaration
A_v1=10.0;
A_v2=15.0;
A_v3=20.0;

#calcultion
A_v=A_v1*A_v2*A_v3;    #overall voltage gain
A_v1_dB=20.0*math.log10(A_v1); #gain in decibel
A_v2_dB=20.0*math.log10(A_v2); #gain in decibel
A_v3_dB=20.0*math.log10(A_v3); #gain in decibel
A_v_dB=A_v1_dB+A_v2_dB+A_v3_dB;        #total gain in decibel

#result
print "overall voltage gain = %.1f" %A_v
print "Av1 = %.1f dB" %A_v1_dB
print "Av2 = %.1f dB" %A_v2_dB
print "Av3 = %.1f dB" %A_v3_dB
print "total voltage gain =%.1f dB" %A_v_dB

overall voltage gain = 3000.0
Av1 = 20.0 dB
Av2 = 23.5 dB
Av3 = 26.0 dB
total voltage gain =69.5 dB