## Example 16-1, Page 567¶

In [1]:
Avm=200                #mid band voltage gain
f1=20                  #cutoff frequency1 (Hz)
f2=20*10**3            #cutoff frequency2 (Hz)
fi1=5                  #input frequency1(Hz)
fi2=200*10**3          #input frequency2(Hz)

Av=0.707*Avm                     #voltage gain at either frequency
Av1=Avm/(1+(f1/fi1)**2)**0.5     #voltage gain for 5Hz
Av2=Avm/(1+(fi2/f2)**2)**0.5     #voltage gain for 200KHz

print 'voltage gain for 200KHz = ',round(Av1,2)
print 'voltage gain for 5Hz = ',round(Av2,2)

voltage gain for 200KHz =  48.51
voltage gain for 5Hz =  19.9


## Example 16-2, Page 568¶

In [2]:
Avm=100000             #mid band voltage gain
f2=10                  #cutoff frequency (Hz)

Av=0.707*Avm                     #voltage gain at cutoff frequency

print 'voltage gain for 10Hz = ',Av

voltage gain for 10Hz =  70700.0


## Example 16-3, Page 569¶

In [8]:
import math   # This will import math module

Avm=100000               #mid band voltage gain
fc=10.0                  #cutoff frequency (Hz)
fi1=100.0                #input frequency1(Hz)
fi2=1*10**3              #input frequency2(Hz)
fi3=10*10**3             #input frequency3(Hz)
fi4=100*10**3            #input frequency4(Hz)
fi5=1*10**6              #input frequency5(Hz)

Av1=Avm/(1+(fi1/fc)**2)**0.5     #voltage gain for 100Hz
Av2=Avm/(1+(fi2/fc)**2)**0.5     #voltage gain for 1KHz
Av3=Avm/(1+(fi3/fc)**2)**0.5     #voltage gain for 10KHz
Av4=Avm/(1+(fi4/fc)**2)**0.5     #voltage gain for 100KHz
Av5=Avm/(1+(fi5/fc)**2)**0.5     #voltage gain for 1MHz

print 'voltage gain for 100Hz = ',math.ceil(Av1)
print 'voltage gain for 1KHz = ',math.ceil(Av2)
print 'voltage gain for 10KHz = ',math.ceil(Av3)
print 'voltage gain for 100KHz = ',math.ceil(Av4)
print 'voltage gain for 1MHz = ',math.ceil(Av5)

voltage gain for 100Hz =  9951.0
voltage gain for 1KHz =  1000.0
voltage gain for 10KHz =  100.0
voltage gain for 100KHz =  10.0
voltage gain for 1MHz =  1.0


## Example 16-4, Page 571¶

In [2]:
import math   # This will import math module

Ap1=1                    #power gain1
Ap2=2                    #power gain2
Ap3=4                    #power gain3
Ap4=8                    #power gain4

Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)
Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)
Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)
Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)

print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'
print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'
print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'
print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'
print 'Each time Ap increase by factor 2, decibel power gain increases by 3 dB'

decibel power gain Ap1(dB) =  0.0 dB
decibel power gain Ap2(dB) =  3.01 dB
decibel power gain Ap3(dB) =  6.02 dB
decibel power gain Ap4(dB) =  9.03 dB
Each time Ap increase by factor 2, decibel power gain increases by 3 dB


## Example 16-5, Page 571¶

In [3]:
import math   # This will import math module

Ap1=1                        #power gain1
Ap2=0.5                      #power gain2
Ap3=0.25                     #power gain3
Ap4=0.125                    #power gain4

Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)
Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)
Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)
Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)

print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'
print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'
print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'
print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'
print 'Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB'

decibel power gain Ap1(dB) =  0.0 dB
decibel power gain Ap2(dB) =  -3.01 dB
decibel power gain Ap3(dB) =  -6.02 dB
decibel power gain Ap4(dB) =  -9.03 dB
Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB


## Example 16-6, Page 572¶

In [19]:
import math   # This will import math module

Ap1=1                       #power gain1
Ap2=10                      #power gain2
Ap3=100                     #power gain3
Ap4=1000                    #power gain4

Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)
Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)
Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)
Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)

print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'
print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'
print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'
print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'
print 'Each time Ap increases by factor 10, decibel power gain increases by 10 dB'

decibel power gain Ap1(dB) =  0.0 dB
decibel power gain Ap2(dB) =  10.0 dB
decibel power gain Ap3(dB) =  20.0 dB
decibel power gain Ap4(dB) =  30.0 dB
Each time Ap increases by factor 10, decibel power gain increases by 10 dB


## Example 16-7, Page 572¶

In [20]:
import math   # This will import math module

Ap1=1                        #power gain1
Ap2=0.1                      #power gain2
Ap3=0.01                     #power gain3
Ap4=0.001                    #power gain4

Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)
Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)
Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)
Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)

print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'
print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'
print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'
print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'
print 'Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB'

decibel power gain Ap1(dB) =  0.0 dB
decibel power gain Ap2(dB) =  -10.0 dB
decibel power gain Ap3(dB) =  -20.0 dB
decibel power gain Ap4(dB) =  -30.0 dB
Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB


## Example 16-8, Page 575¶

In [4]:
import math   # This will import math module

Av1=100                     #voltage gain1
Av2=200                     #voltage gain2

Av=Av1*Av2                    #total voltage gain
Av_db=20*math.log10(Av)       #decibel total voltage gain(dB)
Av_db1=20*math.log10(Av1)     #decibel voltage gain(dB)
Av_db2=20*math.log10(Av2)     #decibel voltage gain(dB)
Avt_db=Av_db1+Av_db2          #decibel total voltage gain(dB)

print 'decibel total voltage gain Av(dB) = ',round(Av_db,2),'dB'
print 'decibel voltage gain Av1(dB) = ',Av_db1,'dB'
print 'decibel voltage gain Av2(dB) = ',round(Av_db2,2),'dB'
print 'so, again, decibel total voltage gain by addition of both: Avt(dB) = ',round(Avt_db,2),'dB'

decibel total voltage gain Av(dB) =  86.02 dB
decibel voltage gain Av1(dB) =  40.0 dB
decibel voltage gain Av2(dB) =  46.02 dB
so, again, decibel total voltage gain by addition of both: Avt(dB) =  86.02 dB


## Example 16-9, Page 577¶

In [27]:
import math   # This will import math module

Av_db1=23                    #voltage gain1(dB)
Av_db2=36                    #voltage gain2(dB)
Av_db3=31                    #voltage gain3(dB)

Avt_db=Av_db1+Av_db2+Av_db3          #decibel total voltage gain(dB)
Ap=10**(Avt_db/10)                   #power gain by taking antilog
Avt=10**(Avt_db/20.0)                #total voltage gain by taking antilog

print 'decibel total voltage gain Avt(dB) = ',Avt_db,'dB'
print 'power gain Ap = ',Ap
print 'total voltage gain Avt = ',math.ceil(Avt)

decibel total voltage gain Avt(dB) =  90 dB
power gain Ap =  1000000000
total voltage gain Avt =  31623.0


## Example 16-10, Page 577¶

In [5]:
Av_db1=23                    #voltage gain1(dB)
Av_db2=36                    #voltage gain2(dB)
Av_db3=31                    #voltage gain3(dB)

Av1=10**(Av_db1/20.0)        #voltage gain of stage 1 by taking antilog
Av2=10**(Av_db2/20.0)        #voltage gain of stage 2 by taking antilog
Av3=10**(Av_db3/20.0)        #voltage gain of stage 3 by taking antilog

print 'voltage gain of stage 1 : Av1 = ',round(Av1,2)
print 'voltage gain of stage 1 : Av2 = ',round(Av2,2)
print 'voltage gain of stage 1 : Av3 = ',round(Av3,2)

voltage gain of stage 1 : Av1 =  14.13
voltage gain of stage 1 : Av2 =  63.1
voltage gain of stage 1 : Av3 =  35.48


## Example 16-11, Page 579¶

In [6]:
Ap_dbm=24                           #power gain(dBm)

P=10**(Ap_dbm/10.0)                 #Output power(mW)

print 'Output power P = ',round(P,2),'mW'

Output power P =  251.19 mW


## Example 16-12, Page 580¶

In [39]:
import math   # This will import math module

Av_dbV=-34                          #voltage gain(dBV)

V=10**(Av_dbV/20.0)                 #Output voltage(V)

print 'Output voltage V = ',math.ceil(V*1000),'mV'

Output voltage V =  20.0 mV


## Example 16-13, Page 583¶

In [48]:
Avm=100000             #mid band voltage gain
f2=10                  #cutoff frequency (Hz)

Av_db=20*math.log10(Avm)       #decibel total voltage gain(dB)

print 'voltage gain for 10Hz = ',Av_db1,'dB'
print 'At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB'

voltage gain for 10Hz =  20.0 dB
At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB


## Example 16-14, Page 588¶

In [7]:
import math

R=5*10**3                      #resistance(Ohm)
C=100*10**-12                  #Capacitance (F)

f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)

print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'
print 'After f2, response rolls off at rate of 20 dB/decade'

cutoff frequency f2 =  318.31 KHz
After f2, response rolls off at rate of 20 dB/decade


## Example 16-15, Page 589¶

In [8]:
import math

R=2*10**3                      #resistance(Ohm)
C=500*10**-12                  #Capacitance (F)

f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)

print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'
print 'After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz'

cutoff frequency f2 =  159.15 KHz
After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz


## Example 16-17, Page 592¶

In [15]:
import math

R=5.3*10**3                #resistance(Ohm)
C=30*10**-12               #Capacitance (F)
Av=100000                  #voltage gain

Cout_M=C                     #input Miller Capacitance (F)
Cin_M=Av*C                   #input Miller Capacitance (F)
f2=(2*math.pi*R*Cin_M)**-1    #cutoff frequency (Hz)

print 'cutoff frequency f2 = ',round(f2,3),'Hz'

cutoff frequency f2 =  10.01 Hz


## Example 16-18, Page 595¶

In [10]:
TR=1*10**-6                #rise time(s)

f2=0.35/TR                 #cutoff frequency (Hz)

print 'cutoff frequency f2 = ',f2/1000,'KHz'

cutoff frequency f2 =  350.0 KHz


## Example 16-19, Page 597¶

In [14]:
import math

re=22.7                 #from past dc calculation (example:9-5)(Ohm)
VCC=10                  #collector voltage(V)
RC=3.6                  #Collector resistance (KOhm)
RE=1                    #Emitter resistance (KOhm)
R1=10                   #Base resistance1 (KOhm)
R2=2.2                  #Base resistance2 (KOhm)
VBE=0.7                 #Base-emitter voltage drop(V)
RL=10                   #Load resistance2 (KOhm)
B=150                   #current gain
RG=0.6                  #source resistance(KOhm)
C1=0.47*10**-6          #input capacitance(F)
C3=2.2*10**-6           #output capacitance(F)
C2=10*10**-6            #emitter capacitance(F)

Rinb=B*re/1000                                #Rin(base) (KOhm)
Ri=RG+((R1**-1)+(Rinb**-1)+(R2**-1))**-1      #thevenin resistance facing i/p capacitor
f1i=((2*math.pi*Ri*C1)**-1)/1000                      #input cutoff frequency (Hz)
Ro=RC+RL                                      #thevenin resistance facing o/p capacitor
f1o=((2*math.pi*Ro*C3)**-1)/1000                      #output cutoff frequency (Hz)
Zout=(((RE**-1)+((re/1000)**-1))**-1)+((((R1**-1)+(R2**-1)+(RG**-1))**-1)/B) #thevenin resistance facing emitter-bypass capacitor
f1z=((2*math.pi*Zout*C2)**-1)/1000                    #cutoff frequency for bypass circuit (Hz)

print 'input cutoff frequency f1 = ',round(f1i,2),'Hz'
print 'output cutoff frequency f1 = ',round(f1o,2),'Hz'
print 'cutoff frequency for bypass circuit f1 = ',round(f1z,2),'Hz'

input cutoff frequency f1 =  190.36 Hz
output cutoff frequency f1 =  5.32 Hz
cutoff frequency for bypass circuit f1 =  631.63 Hz


## Example 16-20, Page 602¶

In [12]:
import math   # This will import math module

re=22.7                 #from past dc calculation (example:9-5)(Ohm)
VCC=10                  #collector voltage(V)
RC=3.6                  #Collector resistance (KOhm)
RE=1                    #Emitter resistance (KOhm)
R11=10                  #Base resistance1 (KOhm)
R12=2.2                 #Base resistance2 (KOhm)
RL=10                   #Load resistance2 (KOhm)
B=150                   #current gain
RG=0.6                  #source resistance(KOhm)
fT=300*10**6            #current gain bandwidth product(Hz)
CC1=2.1*10**-12         #Cc' capacitance(F)
Cs=10*10**-12           #stray capacitance(F)

Rinb=B*re/1000                                #Rin(base) (KOhm)
Ce1=((2*math.pi*re*fT)**-1)                    #capacitance Ce'(F)
rc=RC*RL/(RC+RL)                              #collector resistance(KOhm)
rg=((R11**-1)+(RG**-1)+(R12**-1))**-1         #source resistance (Ohm)
Av=math.ceil(1000*rc/re)                      #voltage gain
Cin_M=CC1*(Av+1)                              #input Miller capacitance(F)
C1=Ce1+Cin_M                                  #base bypass capacitance(F)
R1=int(1000*rg*Rinb/(rg+Rinb))                #resistance facing this capacitance(Ohm)
f2=((2*math.pi*R1*C1)**-1)                     #base bypass circuit cutoff frequency (Hz)
Cout_M=CC1*((Av+1)/Av)                        #output Miller capacitance(F)
C2=Cout_M+Cs                                  #output bypass capacitance(F)
R2=1000*RC*RL/(RC+RL)                         #resistance facing this capacitance(Ohm)
f21=((2*math.pi*R2*C2)**-1)                    #collector bypass circuit cutoff frequency (Hz)

print 'base bypass circuit cutoff frequency f2 = ',round((f2/10**6),2),'MHz'
print 'collector bypass circuit cutoff frequency f21 = ',round((f21/10**6),2),'MHz'

base bypass circuit cutoff frequency f2 =  1.48 MHz
collector bypass circuit cutoff frequency f21 =  4.96 MHz


## Example 16-21, Page 605¶

In [13]:
import math

re=22.7                      #from past dc calculation (example:9-5)(Ohm)
RC=3.6                       #Collector resistance (KOhm)
R1=2*10**6                   #Base resistance1 (Ohm)
R2=1*10**6                   #Base resistance2 (Ohm)
RD=150                       #drain resistance(Ohm)
RL=1*10**3                   #Load resistance2 (Ohm)
RG=0.6*10**3                 #source resistance(Ohm)
Cin=0.1*10**-6               #Cin capacitance(F)
Cout=10*10**-6               #Cout capacitance(F)

Rthi=RG+((R1**-1)+(R2**-1))**-1                  #Thevenin resistance facing input coupling capacitor resistance (Ohm)
f1=((2*math.pi*Rthi*Cin)**-1)                     #base bypass circuit cutoff frequency (Hz)
Rtho=RD+RL                                       #Thevenin resistance facing output coupling capacitor resistance (Ohm)
f2=((2*math.pi*Rtho*Cout)**-1)                    #base bypass circuit cutoff frequency (Hz)

print 'base bypass circuit cutoff frequency f1 = ',round(f1,2),'Hz'
print 'collector bypass circuit cutoff frequency f2 = ',round(f2,2),'Hz'

base bypass circuit cutoff frequency f1 =  2.39 Hz
collector bypass circuit cutoff frequency f2 =  13.84 Hz


## Example 16-22, Page 606¶

In [6]:
import math

Ciss=60                     #Capacitance Ciss (pF)
Coss=25                     #Capacitance Coss (pF)
Crss=5                      #Capacitance Crss (pF)
gm=93*10**-3                #gm (S)
R1=2*10**6                  #resiatance 1(Ohm)
R2=1*10**6                  #resiatance 2(Ohm)
RG=600                      #resiatance(Ohm)
RD=150                      #resiatance(Ohm)
RL=1*10**3                  #load resiatance(Ohm)

Cgd=Crss                            #Internal Capacitance Cgd (pF)
Cgs=Ciss-Crss                       #Internal Capacitance Cgs (pF)
Cds=Coss-Crss                       #Internal Capacitance Cds (pF)
rd=((RD**-1)+(RL**-1))**-1          #rd (Ohm)
Av=gm*rd                            #voltage gain
Cin_M=Cgd*(Av+1)                    #Cin(M) (pF)
C=Cgs+Cin_M                         #gate bypass capacitance (pF)
R=((R1**-1)+(R2**-1)+(RG**-1))**-1  #resistance (Ohm)
f2=((2*math.pi*R*C*10**-12)**-1)    #gate bypass cutoff frequency (Hz)
Cout_M=Cgd*((Av+1)/Av)              #Cout(M) (pF)
C1=Cds+Cout_M                       #drain bypass capacitance(pF)
f21=((2*math.pi*rd*C1*10**-12)**-1) #drain bypass cutoff frequency (Hz)

print 'Gate bypass cutoff frequency = ',round(f2*10**-6,2),'MHz'
print 'Drain bypass cutoff frequency = ',round(f21*10**-6,2),'MHz'

Gate bypass cutoff frequency =  2.2 MHz
Drain bypass cutoff frequency =  48.02 MHz

In [ ]: