Chapter 7: Active Filters

examople 7.1, Page No. 279

In [4]:
# First order Butterworth low-pass filter

import math
#Variable declaration
R = 10.0*10**3              # Resistor R
R1 = 10.0*10**3             # Resistor R1
Rf = 100.0*10**3            # Resistor Rf
C = 0.001*10**-6            # Capacitance 

#calculations
#(i)
fc = 1/(2*math.pi*R*C)
#(ii)
Af = 1+(Rf/R1)

#Result
print("(i) cut-off frequency for a first order Butterworth LPF is %.3f kHz\n\n(ii) Passband Voltage gain = %d"%(fc/1000,Af))
(i) cut-off frequency for a first order Butterworth LPF is 15.915 kHz

(ii) Passband Voltage gain = 11

example 7.2, Page No. 279

In [6]:
# first order low-pass filter design

import math
#Variable declaration
Af = 2                  # Passband voltage gain
fc = 10*10**3           # cut-off frequency

#Calculations
#since Af = 1+Rf/R1, we have Rf = R1
Rf = 10*10**3           # assumed
C = 0.001*10**-6        # assumed
R = 1/(2*math.pi*fc*C)

#Result
print("Rf = R1 = %.0f k-ohm\nC = %.3f micro-F\nR = %.1f k-ohm"%(Rf/1000,C*10**6,R/1000))
Rf = R1 = 10 k-ohm
C = 0.001 micro-F
R = 15.9 k-ohm

example 7.3, Page No. 280

In [18]:
# low-pass filter design

import math
#Variable declaration
Af = 2.5                # Passband voltage gain
fc = 2*10**3            # cut-off frequency

#Calculations
C = 0.01*10**-6         # assumed
R = 1/(2*math.pi*fc*C)
R = R/1000              # k-ohm
Rp = 8.2*10**3          # practical value
x = (Af-1)              # Rf/R1
R1 = Rp*(x+1)/x
R1p = 15                # k-ohm 
Rf = R1*x/1000          # k-ohm

#Result
print("R  = %f k-ohm(practical value %f k-ohm)\nR1 = %.2f k-ohm(say %d k-ohm)\nRf = %d k-ohm"%(R,Rp/1000,R1/1000,R1p,Rf))
R  = 7.957747 k-ohm(practical value 8.200000 k-ohm)
R1 = 13.67 k-ohm(say 15 k-ohm)
Rf = 20 k-ohm

example 7.4, Page No.283

In [8]:
# 2nd order low-pass filter design(refer fig. 7.22)

import math
#Variable declaration
Af = 1.586              # Passband voltage gain
fc = 1000.0             # cut-off frequency

#Calculations
C = 0.005*10**-6        # assumed
R = 1/(2*math.pi*fc*C)
R = R/1000              # k-ohm
x = (Af-1)              # Rf/R1
R1 = 33                 # k-ohm 
Rf = R1*x               # k-ohm

#Result
print("R1 = %d k-ohm\nRf = %.3f k-ohm\nR2 = R3 = %.2f k-ohm\nC2 = C3 = %.3f micro-F"%(R1,Rf,R,C*10**6))
R1 = 33 k-ohm
Rf = 19.338 k-ohm
R2 = R3 = 31.83 k-ohm
C2 = C3 = 0.005 micro-F

example 7.5, Page No. 283

In [16]:
# 2nd order low-pass filter

import math
#Variable declaration
R1 = 12.0*10**3                  # resistor R1
Rf = 7.0*10**3                   # feedback resistance
R2 = 33.0*10**3                  # Resistance R2
R3 = 33.0*10**3                  # Resistance R3
C1 = 0.002*10**-6                # Capacitance C1
C2 = 0.002*10**-6                # Capacitance C2

#Calculations
#(i)
fc = 1/(2*math.pi*math.sqrt(R2*R3*C2*C1))
#(ii)
Af = 1+(Rf/R1)


#Result
print("(i)  cut-off frequency(fc)     = %.3f KHz\n(ii) Passband voltage gain(Af) = %.3f"%(fc/1000,Af))
(i)  cut-off frequency(fc)     = 2.411 KHz
(ii) Passband voltage gain(Af) = 1.583

example 7.6, Page No. 284

In [31]:
# 2nd order low-pass filter design

import math
#Variable declaration
fc = 2000.0                  # cut-off frequency
C  = 0.033*10**-6            # Capacitance, assumed

#Calculations
R = 1/(2*math.pi*fc*C)
Rp = 2.5
x = 0.586                    # Rf/R1 
R1 = 2*R*(1+x)/x
R1p = 15.0
Rf = R1p*x
Rfp = 10.0

#Result
print("C2 = C3 = %.3f micro-F"%(C*10**6))
print("R3 = R2 = %.1f k-ohm(say %.1f k-ohm)"%(R/1000,Rp))
print("R1 = %d k-ohm   = %d k-ohm (std value)\nRf = %.2f k-ohm = %d k-ohm (std value)"%(R1/1000,R1p,Rf,Rfp))
C2 = C3 = 0.033 micro-F
R3 = R2 = 2.4 k-ohm(say 2.5 k-ohm)
R1 = 13 k-ohm   = 15 k-ohm (std value)
Rf = 8.79 k-ohm = 10 k-ohm (std value)

example 7.7, Page No. 284

In [35]:
# 2nd order low-pass filter design

import math
#Variable declaration
fc = 1000.0                  # cut-off frequency
C  = 0.0047*10**-6           # Capacitance, assumed

#Calculations
R  = 1/(2*math.pi*fc*C)
Rp = 33
x  = 0.586                    # Rf/R1 
R1 = 30.0                     # R1 in k-ohm   
Rf = R1*x
Rfp = 20.0

#Result
print("C2 = C3 = %.4f micro-F"%(C*10**6))
print("R3 = R2 = %.2f k-ohm(say %.1f k-ohm)"%(R/1000,Rp))
print("R1 = %d k-ohm\nRf = %.2f k-ohm = %d k-ohm (std value)"%(R1,Rf,Rfp))
C2 = C3 = 0.0047 micro-F
R3 = R2 = 33.86 k-ohm(say 33.0 k-ohm)
R1 = 30 k-ohm
Rf = 17.58 k-ohm = 20 k-ohm (std value)

example 7.8, Page No. 189

In [51]:
# low pass second order Butterworth filter design

import math
#Variable declaration
fc = 1500.0                 # cut-off frequency
alfa = 1.414                # damping factor

#Calculations
Rf = 2-alfa
Ri = 1                      # for equal component model
Af = 1+Rf/Ri
print("Fig 7.26(a) shows the equal component second order Butterworth filter with critical frequency wc = 1 rad/sec.")
print("Where R = R1 = R2 and\nC = C1 = C2")
wc = 2*math.pi*fc
wc = math.floor(wc*100)/100
print("\nWe scale this to 1.5 kHz\nTherefore, wc = %.2f rad/sec"%(wc))
R = 1/wc
print("R1 = R2 = R = %.3f *10^-4 ohm\nFig 7.26(b) shows 1.5 kHz second order Butterworth filter."%(R*10**4))
R = R*10**7
C = 1*10**-7
print("\nTo increase R to a reasonable vaule , we multiply R1 and R2 by 10^7")
print("and to keep the fc unchanged we decrease the C1 and C2 by the same factor.")
print("R1 = R2 = %.3f k-ohm\nC1 = C2 = %.1f micro-F or %.0f nF"%(R/1000,C*10**6,C*10**9))
Fig 7.26(a) shows the equal component second order Butterworth filter with critical frequency wc = 1 rad/sec.
Where R = R1 = R2 and
C = C1 = C2

We scale this to 1.5 kHz
Therefore, wc = 9424.77 rad/sec
R1 = R2 = R = 1.061 *10^-4 ohm
Fig 7.26(b) shows 1.5 kHz second order Butterworth filter.

To increase R to a reasonable vaule , we multiply R1 and R2 by 10^7
and to keep the fc unchanged we decrease the C1 and C2 by the same factor.
R1 = R2 = 1.061 k-ohm
C1 = C2 = 0.1 micro-F or 100 nF

example 7.9, Page No. 292

In [53]:
print("Theeoretical example")
Theeoretical example

example 7.10, Page No. 292

In [52]:
print("Theeoretical example")
Theeoretical example

example 7.11, Page No. 293

In [73]:
# 2nd order Butterworth Low pass filter

import math
#Variable declaration
fc = 10*10**3            # Cut-off frequency
n = 2                    # order of the filter
one_by_Q = 1.414           # from table
#Calculations
C = 0.01*10**-6          # assumed
R = 1/(2*math.pi*fc*C)   
Af = 3-(one_by_Q)
Ri = 10*10**3            # assumed
Rf = (Af-1)*Ri
wc = 2*math.pi*fc
f1=1000
w1 = 2*math.pi*f1
f2 = 2000
w2 = 2*math.pi*f2 
f3 = 5000
w3 = 2*math.pi*f3
f4 = 10000
w4 = 2*math.pi*f4
f5 = 50000
w5 = 2*math.pi*f5
f6 = 100000
w6 = 2*math.pi*f6
Hs1 = 20*math.log10(Af/(math.sqrt(1+(w1/wc)**4)))
Hs2 = 20*math.log10(Af/(math.sqrt(1+(w2/wc)**4)))
Hs3 = 20*math.log10(Af/(math.sqrt(1+(w3/wc)**4)))
Hs4 = 20*math.log10(Af/(math.sqrt(1+(w4/wc)**4)))
Hs5 = 20*math.log10(Af/(math.sqrt(1+(w5/wc)**4)))
Hs6 = 20*math.log10(Af/(math.sqrt(1+(w6/wc)**4)))

#Result
print("R1 = R2 = %.3f k-ohm\nAf = %.3f\nC1 = C2 = %.2f micro-F\nRi = %d k-ohm\nRf = %.2f k-ohm"%(R/1000,Af,C*10**6,Ri/1000,Rf/1000))
print("\nFrequency in Hz\t\t Gain Magnitude in dB|H(s)|")
print("%d\t\t\t\t%d"%(f1,Hs1))
print("%d\t\t\t\t%.3f"%(f2,Hs2))
print("%d\t\t\t\t%.2f"%(f3,Hs3))
print("%d\t\t\t\t%.0f"%(f4,math.ceil(Hs4)))
print("%d\t\t\t\t%.2f"%(f5,math.ceil(Hs5*100)/100))
print("%d\t\t\t\t%.2f"%(f6,Hs6))
R1 = R2 = 1.592 k-ohm
Af = 1.586
C1 = C2 = 0.01 micro-F
Ri = 10 k-ohm
Rf = 5.86 k-ohm

Frequency in Hz		 Gain Magnitude in dB|H(s)|
1000				4
2000				3.999
5000				3.74
10000				1
50000				-23.95
100000				-35.99

example 7.12, Page No. 294

In [85]:
# 4th order Butterworth low pass filter(refer fig. 7.33)

import math
#Variable declaration
fc = 1000.0           # upper cut-off frequency
C = 0.1*10**-6        # aasumed
R = 1/(2*math.pi*fc*C)
R = R/1000
R = math.floor(R*1000)/1000
alfa1 = 0.765
alfa2 = 1.848
Af1 = 3-alfa1
Af2 = 3- alfa2
# for first stage
Ri1 = 10*10**3        # assumed
Rf1 = (Af1-1)*Ri1
# for second stage
Ri2 = 100*10**3       # assumed
Rf2 = (Af2-1)*Ri2

#Result
print("R = %.3f k-ohm\nAf1 = %.3f\t Af2 = %.3f\n\nFor first stage:\nRi = %d k-ohm\tRf = %.1f k-ohm"%(R,Af1,Af2,Ri1/1000,Rf1/1000))
print("\nfor second stage:\nRi = %d k-ohm\tRf = %.1f k-ohm"%(Ri2/1000,Rf2/1000))
R = 1.591 k-ohm
Af1 = 2.235	 Af2 = 1.152

For first stage:
Ri = 10 k-ohm	Rf = 12.3 k-ohm

for second stage:
Ri = 100 k-ohm	Rf = 15.2 k-ohm

example 7.13, Page No.297

In [87]:
# Value of R in first order butterworth high pass filter

import math
#Vartianble declaration
fc = 10*10**3               # cut-off frequency
C = 0.0047*10**-6           # Capacitance

#Calculations
R = 1/(2*math.pi*fc*C)

#Result
print("R = %.3f k-ohm"%(R/1000))
R = 3.386 k-ohm

example 7.14, Page No. 298

In [94]:
# first order butterworth high pass filter

import math
#Variable declaration
R = 15*10**3         # resistance
C = 0.01*10**-6      # capacitance
Rf = 10*10**3        # feedback resistance
R1 = 5*10**3         # resistace R1

#Calcualtions
fc = 1/(2*math.pi*R*C)
fc = math.floor(fc)
wc = 2*math.pi*fc

#Result
print("(i)  Cut-off frequency, fc = %d Hz\n(ii) Cut-off frequency, wc = %f k rad/sec"%(fc,wc/1000))
# Answer for wc is wrong in the book
(i)  Cut-off frequency, fc = 1061 Hz
(ii) Cut-off frequency, wc = 6.666460 k rad/sec

example 7.15, Page No. 299

In [101]:
# cut-off frequency and voltage gain(refer fig. 7.36)

import math
# Variable declaration
R1 = 27.0*10**3           # resistor R1
R2 = R1                   # resistor R2
R3 = R1                   # resistor R3
RL = 10*10**3             # resistor Rl
Rf = 16.0*10**3           # resistor Rf
C2 = 0.005*10**-6         # capacitance
C3 = 0.005*10**-6         # capacitance

#Calculations
fc = 1/(2*math.pi*math.sqrt(R2*R3*C2*C3))
Af = 1+Rf/R1

#Result
print("Cut-off frequency, fc = %.2f kHz\nAf = %.3f"%(fc/1000,math.floor(Af*1000)/1000))
Cut-off frequency, fc = 1.18 kHz
Af = 1.592

example 7.16, Page No. 302

In [125]:
# 2nd order high pass Bessel filter

import math
#Variable declaration
fb = 2000.0               # Break frequency
alfa = 1.732              # damping factor, from table
kf = 1.274                # frequency factor, from table

#calculations
R1 = alfa/2
R2 = 2/alfa
Rf = R2
C = 1
print("R1 = %.3f ohm\nR2 = Rf = %.3f ohm"%(R1,R2))
print("\n2nd order high pass filter with wc = 1 rad/sec is shown in fig 7.40")
fc = fb/kf
fc = math.floor(fc*100)/100
wc = 2*math.pi*fc
wc = math.ceil(wc*10)/10
print("\nfc = %.2f Hz\nwc = %.1f rad/sec"%(fc,wc))
print("\nIn frequency scaling proicedure, we keep the capacitor unchanged and scale down the resistors as follow:")
R1 = R1/wc
R1 = R1*10**5
R1 = math.floor(R1*10**4)/10**4
R2 = R2/wc
print("R1 = %.4f*10^-5\t\t\tR2 = %.4f*10^-4"%(R1,R2*10**4))
print("\nThe above mentioned components are not practical. So we multyply each resistor by 10^8 and divide each capacitor by 10^8 to")
print("get the final component values as under:")
R1 = R1*10**3
R2 = R2*10**8
C = 1*10**-8
print("R1 = %f k-ohm\t\t\tR2 = %f k-ohm\t\tC = %d nF\n\nFinal diagram is shown in fig. 7.42"%(R1/1000,R2/1000,C*10**9))
R1 = 0.866 ohm
R2 = Rf = 1.155 ohm

2nd order high pass filter with wc = 1 rad/sec is shown in fig 7.40

fc = 1569.85 Hz
wc = 9863.7 rad/sec

In frequency scaling proicedure, we keep the capacitor unchanged and scale down the resistors as follow:
R1 = 8.7796*10^-5			R2 = 1.1707*10^-4

The above mentioned components are not practical. So we multyply each resistor by 10^8 and divide each capacitor by 10^8 to
get the final component values as under:
R1 = 8.779600 k-ohm			R2 = 11.706909 k-ohm		C = 10 nF

Final diagram is shown in fig. 7.42

example 7.17, Page No.304

In [147]:
# Wide bandpass filter design

import math
#Variable declaration
fl = 100.0                  # lower cut-off frequency
fh = 1000.0                 # higher cut-off frequency
Af = 4

# Calculations
# 1. low-pass filter components
C_dash = 0.01*10**-6         # assumed
R_dash = 1/(2*math.pi*fh*C_dash)
R_dash = R_dash/1000
Af2 = 2
x1 = (Af2 - 1)              # Rf_dash/R1_dash
R1_dash = 10                # k-ohm
Rf_dash = x1*R1_dash
# 2. High pass filter components
C = 0.05*10**-6 
R = 1/(2*math.pi*fl*C)
Af1 = 2
x2 = (Af1-1)
R1 = 10                      # k-ohm
Rf = x2*R1
# 3. Quality factor Q
Q = math.sqrt(fl*fh)/(fh-fl)

#Result
print("1.The componets for the low-pass filter are as under:")
print("R1_dash = %d k-ohm\nR_dash  = %.1f k-ohm\nRf_dash = %d k-ohm\nC       = %.2f micro-F"%(R1_dash,R_dash,Rf_dash,C_dash*10**6))
print("\n2.The componets for the high pass filter are as under:")
print("R1 = %d k-ohm\nR  = %.2f k-ohm\nRf = %d k-ohm\nC  = %.2f micro-F"%(R1,R/1000,Rf,C*10**6))
print("\n3.Quality factor\nQ = %.3f"%Q)
1.The componets for the low-pass filter are as under:
R1_dash = 10 k-ohm
R_dash  = 15.9 k-ohm
Rf_dash = 10 k-ohm
C       = 0.01 micro-F

2.The componets for the high pass filter are as under:
R1 = 10 k-ohm
R  = 31.83 k-ohm
Rf = 10 k-ohm
C  = 0.05 micro-F

3.Quality factor
Q = 0.351

example 7.18, Page No. 307

In [171]:
# Narrow band pass filter design

import math
#Variable declaration
fc = 2000.0             # cut-off frequency
Af = 10                 # voltage gain
Q  = 4                  # quality factor

#Calculations
C = 0.01*10**-6         # assumed
R1 = Q/(2*math.pi*fc*C*Af)
R1 = R1/1000            # k-ohm
R2 = Q/(2*math.pi*fc*C*((2*Q**2)-Af))
R2 = R2/1000
R3 = Q/(math.pi*fc*C)
R3 = R3 /1000
fc_new = 1000.0
R2_dash = R2*(fc/fc_new)**2

#Result
print("C1 = C2 = %.2f micro-F\nR1 = %.3f k-ohm\nR2 = %.3f k-ohm\nR3 = %.2f k-ohm"%(C*10**6,R1,math.floor(R2*1000)/1000,R3))
print("We use\t R1 = 3.3 k-ohm,R2 = 1.5 k-ohm, R3 = 63 k-ohm")
print("\nNew value of R2 = %.3f k-ohm.\nWe use\t     R2 = %.1f k-ohm"%(R2_dash,R2_dash))
C1 = C2 = 0.01 micro-F
R1 = 3.183 k-ohm
R2 = 1.446 k-ohm
R3 = 63.66 k-ohm
We use	 R1 = 3.3 k-ohm,R2 = 1.5 k-ohm, R3 = 63 k-ohm

New value of R2 = 5.787 k-ohm.
We use	     R2 = 5.8 k-ohm

example 7.19, Page No. 308

In [191]:
# Wide band reject filter

import math
#Variable declaration
fh = 100.0             # higher cut-off frequency
fl = 2000.0            # lower cut-off frequency

# Calculations
# (i) High-pass section
C = 0.01*10**-6        # assumed
R = 1/(2*math.pi*fl*C)
Af1 = 2
x1 = Af1-1             # Rf/R1
R1 = 10                # k-ohm
Rf = x1*R1
#(ii) Low-pass section
C1 = 0.1*10**-6   # assumed
R_dash = 1/(2*math.pi*fh*C1)
Af2 = 2
x2  = Af2-1            # Rf'/R1'
R1_dash = 10           # k-ohm
Rf_dash = x2*R1_dash
#(iii) Summing amplifier
R2 = 10.0              # k-ohm
R3 = R4 = R2
Rom = (R2*R3/(R2+R3))*R4/(R4+(R2*R3/(R2+R3)))
#result
print("(i) High Pass section:\nC  = %.2f micro-F\nR  = %.2f k-ohm\nR1 = %d k-ohm\nRf = %d k-ohm\n"%(C*10**6,R/1000,R1,Rf))
print("(ii) Low Pass section:\nC  = %.1f micro-F\nR  = %.3f k-ohm\nR1 = %d k-ohm\nRf = %d k-ohm"%(C1*10**6,R_dash/1000,R1_dash,Rf_dash))
print("\n(iii) Summing amplifier:\nRom = %f k-ohm"%(Rom))
print("\nThe completed circuit diagram is shownn in figure 7.47")
(i) High Pass section:
C  = 0.01 micro-F
R  = 7.96 k-ohm
R1 = 10 k-ohm
Rf = 10 k-ohm

(ii) Low Pass section:
C  = 0.1 micro-F
R  = 15.915 k-ohm
R1 = 10 k-ohm
Rf = 10 k-ohm

(iii) Summing amplifier:
Rom = 3.333333 k-ohm

The completed circuit diagram is shownn in figure 7.47

example 7.20, Page No. 311

In [193]:
# #Active notch filter

import math
#Variable declaration
fn = 50                # frequency to be rejected

#Calculations
C = 0.47*10**-6        # Capacitance, assumed
R = 1/(2*math.pi*fn*C)

#Result
print("C = %.2f micro-F\nR = %.3f k-ohm. We use %.1f k-ohm"%(C*10**6,R/1000,R/1000))
C = 0.47 micro-F
R = 6.773 k-ohm. We use 6.8 k-ohm

example 7.21, Page No. 313

In [199]:
# phase shift between the input and output voltages for all pass filter

import math
#Variable declaration
R = 10*10**3              # resistance
C = 0.01*10**-6           # Capacitance
f = 2000.0                # frequency for which phase shift is to be calculated

#Calculations
fi = -2*math.atan(2*math.pi*R*f*C)
fi = math.ceil(math.degrees(fi)*100)/100

#Result
print("Phase shift = %.2f°"%fi)
Phase shift = -102.97°

example 7.22, Page No.313

In [203]:
# Wide band pass filter

import math
#Variable declaration
fl = 200.0                # lower cut-off frequency
fh = 1000.0               # higher cut-off frequency


#Calculations
fc = math.sqrt(fl*fh)
Q = fc/(fh-fl)

#Result
print("fc = %.1f Hz\nQ  = %.3f\nfilter with Q = 0.8 is more selective."%(fc,Q))
fc = 447.2 Hz
Q  = 0.559
filter with Q = 0.8 is more selective

example 7.23, Page No. 313

In [216]:
# Wide bandpass filter design

import math
#Variable declaration
f1 = 5*10**3             # cut-off frequency
f2 = 15*10**3            # ciut-off frequency
Af = 2                   # Passband gain 

#Calculations
# low pass filter
C_dash = 0.01*10**-6     # assumed
R_dash = 1/(2*math.pi*f2*C_dash)
R_dash = R_dash/1000
Af1 = Af2 = 1.414
x1 = Af2-1               # Rf'/R1'
R1_dash = 10             # k-ohm
Rf_dash = x1*R1_dash
# high pass filter
C = 0.05*10**-6          # assumed
R = 1/(2*math.pi*f1*C)
x2 = Af1-1               # Rf'/R1'
R1 = 10                  # k-ohm
Rf = x2*R1

#Result
print("Low pass filter component:")
print("C' = %.2f micro-F\nR' = %.3f k-ohm\nR1'= %d k-ohm\nRf'= %.2f k-ohm"%(C_dash*10**6,R_dash,R1_dash,Rf_dash))
print("\nHigh pass filter component:")
print("C  = %.2f micro-F\nR  = %.2f k-ohm\nR1 = %d k-ohm\nRf = %.2f k-ohm"%(C*10**6,R,R1,Rf))
Low pass filter component:
C' = 0.01 micro-F
R' = 1.061 k-ohm
R1'= 10 k-ohm
Rf'= 4.14 k-ohm

High pass filter component:
C  = 0.05 micro-F
R  = 636.62 k-ohm
R1 = 10 k-ohm
Rf = 4.14 k-ohm

example 7.24, Page No. 317

In [274]:
# output waveform of circuit in fig.7.54

%matplotlib inline
import matplotlib.pyplot as plt
from numpy import arange,sin,pi
t = arange(0.0,2,0.01)
t1 = arange(0.0,2.0,0.01)
t2 = arange(0.0,1.002,0.01)
t3 = arange(1.0,2,0.01)
t4 = arange(-15.0,15.0,0.01)

S = sin(math.pi*t)
plt.axis([0,2.0,-16,16])

plt.plot(t1,t1*0/t1,'b')
plt.plot(t4/t4,t4,'g')
plt.plot(t2,15*t2/t2,'g')
plt.plot(t3,-15*t3/t3,'g')
plt.plot(t,S,'r')
plt.title("Output of the circuit shown in fig. 7.54")
plt.text(-0.3,14.8,'+Vsat')
plt.text(-0.3,-15.2,'-Vsat')
Out[274]:
<matplotlib.text.Text at 0xef879e8>

example 7.25, Page No. 317

In [275]:
# Cut-off frequency

import math
#Variable declaration
C = 0.1*10**-6             # capacitance
R = 10*10**3               # Resistance

#Calculations
fh = 1/(2*math.pi*C*R)

#Result
print("cut-off frequency = %.4f Hz"%fh)
cut-off frequency = 159.1549 Hz

example 7.26, Page No. 317

In [284]:
# first order low pass filter design(refer fig 7.56)

import math
#Variable declaration
fc = 2000.0           # cut-off frequency
Af = 2                # passband gain

#Calculations
C = 0.01*10**-6       # Capacitance, assumed
R = 1/(2*math.pi*fc*C)
R = R/1000            # k-ohm
R = math.floor(R*10**3)/1000
x = Af -1             # Rf/R1
R1 = 10               # k-ohm
Rf = x*R1

#Result
print("C  = %.2f micro-F\nR  = %.3f k-ohm\nR1 = %d k-ohm\nRf = %d k-ohm"%(C*10**6,R,R1,Rf))
C  = 0.01 micro-F
R  = 7.957 k-ohm
R1 = 10 k-ohm
Rf = 10 k-ohm