In [4]:

```
import math
#Variables
Av1 = 10.0 #Voltage gain1
Av2 = 20.0 #Voltage gain2
Av3 = 40.0 #Voltage gain3
#Calculation
Av = Av1 * Av2 * Av3 #Voltage gain
Gv1 = 20 * math.log10(Av1) #dB voltage gain1
Gv2 = 20 * math.log10(Av2) #dB voltage gain2
Gv3 = 20 * math.log10(Av3) #dB voltage gain3
Gv = Gv1 + Gv2 + Gv3 #dB voltage gain
#Result
print "Overall voltage gain is ",Av,".\nTotal dB voltage gain is ",round(Gv)," dB."
```

In [2]:

```
import math
#Variables
n = 3 #Number of amplified stages
Vin1 = 0.05 #Input to first stage (in volts peak-to-peak)
Vout3 = 150.0 #Output of final stage (in volts peak-to-peak)
Av1 = 20.0 #Voltage gain of first stage
Vin3 = 15.0 #Input of final stage (in volts peak-to-peak)
#Calculation
Av = Vout3 / Vin1 #Overall voltage gain
Av3 = Vout3 / Vin3 #Voltage gain of third stage
Av2 = Av / (Av1 * Av3) #Voltage gain of second stage
Vin2 = Vin3 / Av2 #Input voltage gain of second stage
#Result
print "Overall voltage gain is ",Av,".\nVoltage gain of 2nd and 3rd stage is ",Av2," and ",Av3,".\nInput voltage of the second stage is ",Vin2," Vpk-pk."
```

In [3]:

```
import math
#Variables
VCC = 10.0 #Source voltage (in volts)
RC = 5.0 * 10**3 #Collector resistance (in ohm)
RB = 1.0 * 10**6 #Base resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RL = 10.0 * 10**3 #Load resistance (in ohm)
beta1 = beta2 = 100.0 #Common emitter current gain
#Calculation
IE = VCC /(RE + RB/beta1) #Emitter current (in Ampere)
r1e = 25.0/IE * 10**-3 #a.c. emitter diode resistance (in ohm)
Ri1 = beta1 * r1e #Input resistance of first stage (in ohm)
Ri2 = beta2 * r1e #Input resistance of second stage (in ohm)
Ro1 = RC * Ri2 / (RC + Ri2) #Output resistance of first stage (in ohm)
Ro2 = RC * RL / (RC + RL) #Output resitance of second stage (in ohm)
Av1 = Ro1 / r1e #Voltage gain of first stage
Av2 = Ro2 / r1e #Voltage gain of second stage
Av = Av1 * Av2 #Overall voltage gain
Gv = 20 * math.log10(Av) #Overall dB voltage gain
#Result
print "Input resistance of first and scond stage is ",round(Ri1)," ohm and ",round(Ri2)," ohm.\nOutput resistance of first and second stage is ",round(Ro1,1)," ohm and ",round(Ro2,1)," ohm.\nVoltage gain of first and second stage is ",round(Av1)," and ",round(Av2,1),".\nOverall voltage gain and dB voltage gain is ",round(Av)," and ",round(Gv,1)," dB."
```

In [2]:

```
import math
#Variables
VCC = 15.0 #Source voltage (in volts)
RC = 3.3 * 10**3 #Collector resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RL = 10.0 * 10**3 #Load resistance (in ohm)
R1 = 33.0 * 10**3 #Resistance (in ohm)
R2 = 8.2 * 10**3 #Resistance (in ohm)
beta1 = beta2 = 100.0 #Common emitter current gain
VBE = 0.7 #Emitter-to-base voltage (in volts)
#Calculation
Vth = VCC * R2 / (R1 + R2) #Thevenin's voltage (in volts)
Rth = R1 * R2 / (R1 + R2) #Thevenin's equivalent resistance (in ohm)
IE = (Vth - VBE)/(RE + Rth/beta1) #Emitter current (in Ampere)
r1e = 25.0/IE * 10**-3 #a.c. emitter resistance (in ohm)
Ri2 = beta1 * r1e #Input resistance of second stage (in ohm)
Ro1 = RC * Ri2 / (RC + Ri2) #Output resistance of first stage (in ohm)
Ro2 = RC * RL /(RC + RL) #Output resistance of second stage (in ohm)
Av1 = Ro1 / r1e #Voltage gain of the first stage
Av2 = Ro2 / r1e #Voltage gain of second stage
Av = Av1 * Av2 #Overall voltage gain
Gv = 20 * math.log10(Av) #Overall voltage (in decibels)
#Result
print "Voltage gain of stage one and two are as follows ",round(Av1,2)," and ",round(Av2,2),".\nOverall voltage gain is ",round(Av),".\nOverall voltage gain in decibels is ",round(Gv,1)," dB."
#Slight variation in the value of Av2 and Av due to higher precision.
```

In [1]:

```
import math
#Variables
VCC = 10.0 #Source voltage (in volts)
RB = 470.0 * 10**3 #Base resistance (in ohm)
RE = 1.0 * 10**3 #Emitter resistance (in ohm)
RL = 1.0 * 10**3 #Load resistance (in ohm)
a = 4.0 #Turn's ratio
beta1 = beta2 = 50.0 #Common emitter current gain
VBE = 0.7 #Emitter-to-base voltage (in volts)
#Calculation
IE = VCC/ (RE + RB/beta1) #Emitter current (in Ampere)
r1e = 25.0 / IE * 10**-3 #a.c. emitter diode resistance (in ohm)
Ri1 = RB*beta1*r1e/(RB+beta1*r1e) #Input resistance of first stage (in ohm)
Ri2 = RB*beta2*r1e/(RB+beta2*r1e) #Input resistance of Second stage (in ohm)
R1i2 = a**2 * Ri2 #Input resistance of the second stage transformed to primary side (in ohm)
Ro1 = R1i2 #Output resistance of second stage (in ohm)
R1o2 = a**2 * RL #Output resistance of the second stage transformed to the primary side (in ohm)
Av1 = Ro1/r1e #Voltage gain of first stage
Av2 = R1o2/r1e #Voltage gain of second stage
Av = Av1 * Av2 #Overall voltage gain
Gv = 20 * math.log10(Av) #Overall voltage gain (in decibels)
#Result
print "Voltage gain of first stage is ",round(Av1,1),".\nVoltage gain of second stage is ",round(Av2,1),".\nOverall voltage gain is ",round(Av),".\nOverall voltage gain in decibels is ",round(Gv)," dB."
#Slight variation due to higher precision.
```

In [6]:

```
import math
#Variables
VCC = 12.0 #Source voltage (in volts)
R1 = 100.0 * 10**3 #Resistance (in ohm)
R2 = 20.0 * 10**3 #Resistance (in ohm)
R3 = 10.0 * 10**3 #Resistance (in ohm)
R4 = 2.0 * 10**3 #Resistance (in ohm)
R5 = 10.0 * 10**3 #Resistance (in ohm)
R6 = 2.0 * 10**3 #Resistance (in ohm)
beta1 = beta2 = 100.0 #Common emitter current gain
#Calculation
Vth = VCC * R2 / (R1 + R2) #Thevenin's voltage (in volts)
IE1 = Vth / R4 #Emitter curren1 (in Ampere)
r1e = 25.0 / IE1 * 10**-3 #a.c. emitter diode resistance (in ohm)
VR6 = VCC - IE1 * R3 #Voltage across resistance6 (in volts)
IE2 = VR6 / R6 #Emitter current2 (in Ampere)
r1e2 = 25.0 / IE2 * 10**-3 #a.c. emitter diode resistance2 (in ohm)
Ri2 = beta2*(r1e2 + R6) #Input resistance of second stage (in ohm)
Ro1 = R3 * Ri2 /(R3 + Ri2) #Output resistance of first stage (in ohm)
Ro2 = R5 #Output resistance of second stage (in ohm)
Av1 = Ro1/(r1e + R4) #Voltage gain of first stage
Av2 = Ro2/(r1e2 + R6) #Voltage gain of second stage
Av = Av1 * Av2 #Overall voltage gain
#Result
print "Voltage gain of first stage is ",round(Av1,1),".\nVoltage gain of second stage is ",round(Av2,1),".\nOverall voltage gain is ",round(Av,2),"."
#Calculation mistake in book about Ro1 , therefore slight variation in the answers.
```

In [7]:

```
import math
#Variables
VCC = 10.0 #Source voltage (in volts)
R1 = 800.0 #Resistance (in ohm)
R2 = 200.0 #Resistance (in ohm)
R3 = 600.0 #Resistance (in ohm)
R4 = 200.0 #Resistance (in ohm)
R5 = 100.0 #Resistance (in ohm)
R6 = 1000.0 #Resistance (in ohm)
beta1 = beta2 = 100.0 #Common emitter current gain
VBE = 0.7 #Emitter-to-base voltage (in volts)
#Calculation
VR2 = VCC * (R2 / (R1 + R2)) #Voltage across resistance2 (in volts)
IE1 = (VR2 - VBE)/R2 #Emitter current of Q1 transistor (in Ampere)
IC1 = IE1 #Collector current of Q1 transistor (in Ampere)
VC1 = VCC - IC1 * R3 #Voltage at the collector of Q1 transistor (in volts)
VE1 = IE1 * R4 #Voltage at the emitter of Q1 transistor (in volts)
VCE1 = VC1 - VE1 #Collector-to-emitter voltage of Q1 transistor (in volts)
VE2 = VC1 - (-VBE) #Voltage at the emitter of Q2 transistor (in volts)
IE2 = (VCC - VE2)/R6 #Emitter current of Q2 transistor (in Ampere)
IC2 = IE2 #Collector-current of Q2 transistor (in Ampere)
VC2 = IC2 * R5 #Voltage at the collector of Q2 transistor (in volts)
VCE2 = VC2 - VE2 #Collector-to-emitter voltage of Q2 transistor (in volts)
r1e1 = 25.0 / IE1 * 10**-3 #a.c. emitter diode resistance of Q1 transistor (in ohm)
r1e2 = 25.0 / IE2 * 10**-3 #a.c. emitter diode resistance of Q2 transistor (in ohm)
Ri2 = beta2 * (r1e2 + R6) #Input resistance of second stage (in ohm)
Ro1 = R3 * Ri2 / (R3 + Ri2) #Output resistance of first stage (in ohm)
Av1 = Ro1 / (r1e1 + R4) #Voltage gain of first stage
Av2 = 1.0 #Voltage gain of second stage
Av = Av1 * Av2 #Overall voltage gain
#Result
print "Emitter current of Q1 transistor is ",IE1 * 10**3," mA.\nCollector current of Q1 transistor is ",IC1 * 10**3," mA.\nEmitter current of Q2 transistor is ",IE2 * 10**3," mA.\nCollecotr-current of Q2 transistor is ",IC2 * 10**3," mA."
print "Collector-to-emitter voltage of Q1 transistor is ",VCE1," v.\nCollector-to-emitter voltage of Q2 transistor is ",VCE2,"."
print "Overall voltage gain is ",round(Av,2),"."
```

In [8]:

```
import math
#Variables
VCC = 10.0 #Source voltage (in volts)
RE = 1.5 * 10**3 #Emitter resistance (in ohm)
R1 = 30.0 * 10**3 #Resistance (in ohm)
R2 = 20.0 * 10**3 #Resistance (in ohm)
beta1 = 150.0 #Common emitter current gain
beta2 = 100.0 #Common emitter current gain
VBE = 0.7 #Emitter-to-base voltage (in volts)
#Calculation
Ai = beta1 * beta2 #Overall current gain of transistor
VR2 = VCC * R2/(R1 + R2) #Voltage across resistor2 (in volts)
VB2 = VR2 - VBE #Voltage at the base of Q2 (in volts)
VE2 = VB2 - VBE #Voltage at the emitter of Q2 (in volts)
IE2 = VE2 / RE #Emitter current of Q2 (in Ampere)
r1e2 = 25.0/IE2 * 10**-3 #a.c. emitter diode resistance of Q2 (in ohm)
IB2 = IE2 / beta2 #Base current of Q2 (in Ampere)
IE1 = IB2 #Emitter current of Q2
r1e1 = 25.0/IE1 * 10**-3 #a.c. emitter diode resistance of Q1 (in ohm)
Ri1 = R1 * R2/(R1 + R2) #Total input resistance (in ohm)
Av = RE/(r1e1/beta2 + r1e2 + RE) #Overall voltage gain
#Result
print "The overall current gain is ",Ai,"."
print "The a.c. emitter diode resistance of Q1 transistor is ",round(r1e1,1)," ohm.\nThe a.c. emitter diode resistance of Q2 transistor is ",round(r1e2,2)," ohm."
print "Total input resistance is ",Ri1 * 10**-3," kilo-ohm."
print "Overall voltage gain is ",round(Av,2),"."
#Slight variation due to higher precision.
```