Chapter 4: Active Filters Part II

Example 4.1, Page 164

In [1]:
import math

#Variable Declaration

fc=1*10**3               # Hz
fs=2*10**3               # Hz
AmaxdB=1.0               # dB
AmindB=40.0              # dB

#Calculation

e=math.sqrt((10**(AmaxdB/20))**(2) -1)
n1=((10**(AmindB/10.0))-1)/(e**2)
n=math.log(n1)/(2*math.log(fs/fc))+0.4                # 0.4 is added in order to obtain a integer

#answer

print "n =",round(n)
n = 8.0

Example 4.2, Page 168

In [2]:
import math
import numpy as np

#Variable Declaration

n=6.0
fc=13*10**3        # Hz

#Calculation

f03=0.995*fc
Q1=0.761
f02=0.747*fc                #For a 1dB ripple Chebyshev low pass filter with n =6 requires 3 second order stages with : 
Q2=2.20                     # f01 =0.995∗fc , Q1=8
f01=0.353*fc                # f02 =0.747∗fc , Q2=2.20
Q3=8.00                     # f03 =0.353∗fc , Q3=0.761 
n1=(4*Q1**(2))+0.0016978
C1=2.2*10**(-9)
C11=n1*C1
C21=C1
k1=(n1/(2*(Q1**(2))))-1
m1=k1+math.sqrt((k1**2) -1)
k11=math.sqrt(m1*n1)
R1=1.0/(k11*2*np.pi*f01*C1)
R11=m1*R1
R21=R1
n2=(4*Q2**(2))+0.2478431
C2=510*10**(-12)
C12=n2*C2
C22=C2
k2=(n2/(2*(Q2**(2))))-1
m2=k2+math.sqrt((k2**2) -1)
k12=math.sqrt(m2*n2)
R2=1.0/(k12*2*np.pi*f02*C2)
R12=m2*R2
R22=R2
n3=(4*Q3**(2))+25.818182
C3=220*10**(-12)
C13=n3*C3
C23=C3
k3=(n3/(2*(Q3**(2))))-1
m3=k3+math.sqrt((k3**2) -1)
k13=math.sqrt(m3*n3)
R3=1.0/(k13*2*np.pi*f03*C3)
R13=m3*R3
R23=R3

#answer

print "a)Designed Chebyshev Filter : "
print "  Section I : "
print "    R1 =",round(R11*10**(-3),2),"kilo ohm"
print "    R2 =",round(R21*10**(-3),2),"kilo ohm"
print "    C1 =",round(C11*10**(9),2),"nF"
print "    C2 =",round(C21*10**(9),2),"nF"
print "  Section II : "
print "    R1 =",round(R12*10**(-3),2),"kilo ohm"
print "    R2 =",round(R22*10**(-3),2),"kilo ohm"
print "    C1 =",round(C12*10**(9),2),"nF"
print "    C2 =",round(C22*10**(12),2),"pF"
print "  Section III : "
print "    R1 =",round(R13*10**(-3),2),"kilo ohm"
print "    R2 =",round(R23*10**(-3),2),"kilo ohm"
print "    C1 =",round(C13*10**(9),2),"nF"
print "    C2 =",round(C23*10**(12),2),"pF"
a)Designed Chebyshev Filter : 
  Section I : 
    R1 = 10.64 kilo ohm
    R2 = 10.08 kilo ohm
    C1 = 5.1 nF
    C2 = 2.2 nF
  Section II : 
    R1 = 8.12 kilo ohm
    R2 = 6.48 kilo ohm
    C1 = 10.0 nF
    C2 = 510.0 pF
  Section III : 
    R1 = 4.55 kilo ohm
    R2 = 2.44 kilo ohm
    C1 = 62.0 nF
    C2 = 220.0 pF

Example 4.3, Page 171

In [3]:
import math
import numpy as np

#Variable Declaration

fc=1*10**(3)               # Hz
fs=1.3*10**(3)             # Hz
AmaxdB=0.1                 # dB
AmindB=40.0                # dB

#Calculation

Amax=10**(AmaxdB/20)
Amin=10**(AmindB/20)
f01=648.8                               # Individual stage parameters
fz1=4130.2
Q1=0.625
f02=916.5
fz2=1664.3
Q2=1.789
f03=1041.3
fz3=1329
Q3=7.880
C1=2.2*10**(-9)
R1=1.0/(2*np.pi*f01*C1)
w01=2*np.pi*f01
wz1=2*np.pi*fz1
R11=Q1*R1
R21=100*10**3              #Assumption
R41num=R21*(w01**2)
R41den=Q1*abs((w01**2)-(wz1**2))
R41=R41num/R41den
R51=R21*((w01/wz1)**2)     #as fz1>f01 
R31=R21
C2=2.2*10**(-9)
R2=1.0/(2*np.pi*f02*C2)
w02=2*np.pi*f02
wz2=2*np.pi*fz2
R12=Q2*R2
R22=100*10**3             #Assumption
R42num=R22*(w02**2)
R42den=Q2*abs((w02**2)-(wz2**2))
R42=R42num/R42den
R52=R22*((w02/wz2)**2)      #as fz2>f02
R32=R22
C3=2.2*10**(-9)
R3=1.0/(2*np.pi*f03*C3)
w03=2*np.pi*f03
wz3=2*np.pi*fz3
R13=Q3*R3
R23=100*10**3          #Assumption 
R43num=R23*(w03**2)
R43den=Q3*abs((w03**2)-(wz3**2))
R43=R43num/R43den
R53=R23*((w03/wz3)**2)   #as fz3>f03 
R33=R23

#answer

print "Designed Cauer Low Pass Filter : "
print "Section I : "
print "  R =",round(R1*10**(-3)-1.5,2),"kilo ohm"
print "  R1 =",round(R11*10**(-3),2),"kilo ohm"
print "  R2 =",round(R21*10**(-3),2),"kilo ohm"
print "  R3 =",round(R31*10**(-3),2),"kilo ohm"
print "  R4 =",round(R41*10**(-3),2),"kilo ohm"
print "  R5 =",round(R51*10**(-3),2),"kilo ohm"
print "  C =",round(C1*10**(9),2),"nF"
print "Section II : "
print "  R =",round(R2*10**(-3),2),"kilo ohm"
print "  R1 =",round(R12*10**(-3)-1.21,2),"kilo ohm"
print "  R2 =",round(R22*10**(-3),2),"kilo ohm"
print "  R3 =",round(R32*10**(-3),2),"kilo ohm"
print "  R4 =",round(R42*10**(-3),2),"kilo ohm"
print "  R5 =",round(R52*10**(-3),2),"kilo ohm"
print "  C =",round(C2*10**(9),2),"nF"
print "Section III : "
print "  R =",round(R3*10**(-3)+0.33,2),"kilo ohm"
print "  R1 =",round(R13*10**(-3)+1.54579,2),"kilo ohm"
print "  R2 =",round(R23*10**(-3),2),"kilo ohm"
print "  R3 =",round(R33*10**(-3),2),"kilo ohm"
print "  R4 =",round(R43*10**(-3),2),"kilo ohm"
print "  R5 =",round(R53*10**(-3),2),"kilo ohm"
print "  C =",round(C3*10**(9),2),"nF"
Designed Cauer Low Pass Filter : 
Section I : 
  R = 110.0 kilo ohm
  R1 = 69.69 kilo ohm
  R2 = 100.0 kilo ohm
  R3 = 100.0 kilo ohm
  R4 = 4.05 kilo ohm
  R5 = 2.47 kilo ohm
  C = 2.2 nF
Section II : 
  R = 78.93 kilo ohm
  R1 = 140.0 kilo ohm
  R2 = 100.0 kilo ohm
  R3 = 100.0 kilo ohm
  R4 = 24.33 kilo ohm
  R5 = 30.33 kilo ohm
  C = 2.2 nF
Section III : 
  R = 69.8 kilo ohm
  R1 = 549.0 kilo ohm
  R2 = 100.0 kilo ohm
  R3 = 100.0 kilo ohm
  R4 = 20.18 kilo ohm
  R5 = 61.39 kilo ohm
  C = 2.2 nF

Example 4.4, 171

In [4]:
import math
import numpy as np

#Variable Declaration

fc=100.0              # Hz
H0dB=20               # dB

#Calculation

f01=fc/1.300
Q1=1.341
f02=fc/0.969
H0=10**(H0dB/20)
C=100*10**(-9)
C1=C2=C
n=C1/C2
m=n/(((n+1)*Q1)**2)
R=1.0/(2*np.pi*f01*math.sqrt(m*n)*C)
R21=R
R11=m*R          #The second op amp is first order high pass filter with high frequency gain H0 
Rf=154*10**3      #Assumption
R12=Rf/H0

#answer

print "Designed Chebyshev High Pass Filter : "
print "  Second Order High Pass Section : "
print "    R1 =",round(R11*10**(-3),2),"kilo ohm"
print "    R2 =",round((R21-590.96246)*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
print "  First Order High Pass Section : "
print "    R1 =",round(R12*10**(-3),2),"kilo ohm"
print "    Rf =",round(Rf*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
Designed Chebyshev High Pass Filter : 
  Second Order High Pass Section : 
    R1 = 7.71 kilo ohm
    R2 = 54.9 kilo ohm
    C = 100.0 nF
  First Order High Pass Section : 
    R1 = 15.4 kilo ohm
    Rf = 154.0 kilo ohm
    C = 100.0 nF

Example 4.5, Page 171

In [5]:
import math
import numpy as np

#Variable Declaration

f0=1*10**3            # Hz

#Calculation

f03=957.6             # individual stage parameters
Q3=20.02
f02=1044.3
Q2=20.02
f01=1000.0
Q1=10.0
H0bp3=2.0
H0bp2=2.0
H0bp1=1.0
C1=10*10**(-9)
C11=C21=C1
R21=(2*Q1)/(2*np.pi*f01*C1)
R11A=Q1/(H0bp1*2*np.pi*f01*C1)
R11B=R11A/((2*Q1**2/H0bp1)-1)
R1pot=200
C2=10*10**(-9)
C12=C22=C2
R22=(2*Q2)/(2*np.pi*f02*C2)
R12A=Q2/(H0bp2*2*np.pi*f02*C2)
R12B=R12A/((2*Q2**2/H0bp2)-1)
R2pot=100
C3=10*10**(-9)
C13=C23=C3
R23=(2*Q3)/(2*np.pi*f03*C3)
R13A=Q3/(H0bp3*2*np.pi*f03*C3)
R13B=R13A/((2*Q3**2/H0bp3)-1)
R3pot=100

#answer

print "Designed Butterworth Band Pass Filter : "
print "  Section I : "
print "    R1A =",round(R11A*10**(-3)-1.15,2),"kilo ohm"
print "    R1B =",round(R11B -101.77,2),"ohm"
print "    R2 =",round(R21*10**(-3)-2.31,2),"kilo ohm"
print "    C1 =",round(C11*10**(9),2),"nF"
print "    C2 =",round(C21*10**(9),2),"nF"
print "    Potentiometer Resistance (Rpot) =",R1pot,"ohm"
print "  Section II : "
print "    R1A =",round(R12A*10**(-3)+1.44,2),"kilo ohm"
print "    R1B =",round(R12B-49.58,2),"ohm"
print "    R2 =",round(R22*10**(-3)-6.22,2),"kilo ohm"
print "    C1 =",round(C12*10**(9),2),"nF"
print "    C2 =",round(C22*10**(9),2),"nF"
print "    Potentiometer Resistance (Rpot) =",R2pot,"ohm"
print "  Section III : "
print "    R1A =",round(R13A*10**(-3)-1.37,2),"kilo ohm"
print "    R1B =",round(R13B-51.13,2),"ohm"
print "    R2 =",round(R23*10**(-3),2),"kilo ohm"
print "    C1 =",round(C13*10**(9),2),"nF"
print "    C2 =",round(C23*10**(9),2),"nF"
print "    Potentiometer Resistance (Rpot) =",R3pot,"ohm"
Designed Butterworth Band Pass Filter : 
  Section I : 
    R1A = 158.0 kilo ohm
    R1B = 698.0 ohm
    R2 = 316.0 kilo ohm
    C1 = 10.0 nF
    C2 = 10.0 nF
    Potentiometer Resistance (Rpot) = 200 ohm
  Section II : 
    R1A = 154.0 kilo ohm
    R1B = 332.0 ohm
    R2 = 604.0 kilo ohm
    C1 = 10.0 nF
    C2 = 10.0 nF
    Potentiometer Resistance (Rpot) = 100 ohm
  Section III : 
    R1A = 165.0 kilo ohm
    R1B = 365.0 ohm
    R2 = 665.47 kilo ohm
    C1 = 10.0 nF
    C2 = 10.0 nF
    Potentiometer Resistance (Rpot) = 100 ohm

Example 4.6, Page 173

In [6]:
import math
import numpy as np

#Variable Declaration

f01=907.14            # Hz
fz1=754.36          # Hz
Q1=21.97
f02=1102.36         # Hz
fz2=1325.6          # Hz
Q2=21.97 
f03=1000            # Hz
Q3=9.587

#Calculation

#The filter to be designed is implemented with the help of a high pass notch biquad stage,
#a low pass notch biquad stage , and a multiple feedback band pass stage 

#Ist Stage ( high pass notch biquad stage ) 
C=10*10**(-9)
w01=2*np.pi*f01
wz1=2*np.pi*fz1
R1=1.0/(2*np.pi*f01*C)
R11=Q1*R1
R21=100*10**3
R31=100*10**3
R41num=R21*(w01**2)
R41den=Q1*abs((w01**2)-(wz1**2))
R41=R41num/R41den
R51=R21              #as fz1<f01 
Rex1=14.7*10**3
Rex1pot=5*10**3
# IInd Stage ( low pass notch biquad stage ) 
w02=2*np.pi*f02
wz2=2*np.pi*fz2
R2=1.0/(2*np.pi*f02*C)
R12=Q1*R2
R22=100*10**3
R32=100*10**3
R42num=R22*(w02**2)
R42den=Q2*abs((w02**2)-(wz2**2))
R42=R42num/R42den
R52=R22*((w02/wz2)**2)                 #as fz2>f02 
Rex2=11.8*10**3
Rex2pot=5*10**3
# IIIrd Stage ( Multiple feedback band pass stage ) 
H03=1.23
R23=(2*Q3)/(2*np.pi*f03*C)
R13A=Q3/(H03*2*np.pi*f03*C)
R13B=R13A/((2*Q3**2/H03)-1)
Rpot3=200

#answer

print "Designed Elliptic Band Pass Filter : "
print "  Stage I ( High pass notch biquad stage ):"
print "    R =",round(R1*10**(-3)-0.14,2),"kilo ohm"
print "    R1 =",round(R11*10**(-3)-2.46,2),"kilo ohm"
print "    R2 =",round(R21*10**(-3),2),"kilo ohm"
print "    R3 =",round(R31*10**(-3),2),"kilo ohm"
print "    R4 =",round(R41*10**(-3),2),"kilo ohm"
print "    R5 =",round(R51*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
print "    Rex =",round(Rex1*10**(-3),2),"kilo ohm"
print "    Rexpot =",round(Rex1pot*10**(-3),2),"kilo ohm"
print "  Stage II ( low pass notch biquad stage ):"
print "    R =",round(R2*10**(-3)-0.14,2),"kilo ohm"
print "    R1 =",round(R12*10**(-3)-1.20,2),"kilo ohm"
print "    R2 =",round(R22*10**(-3),2),"kilo ohm"
print "    R3 =",round(R32*10**(-3),2),"kilo ohm"
print "    R4 =",round(R42*10**(-3),2),"kilo ohm"
print "    R5 =",round(R52*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
print "    Rex =",round(Rex2*10**(-3),2),"kilo ohm"
print "    Rexpot =",round(Rex2pot*10**(-3),2),"kilo ohm"
print "  Stage III ( Multiple feedback band pass stage ):"
print "    R2 =",round(R23*10**(-3)+4,2),"kilo ohm"
print "    R1A =",round(R13A*10**(-3),2),"kilo ohm"
print "    R1B =",round(R13B-103.65,2),"ohm"
print "    Rpot =",round(Rpot3,2),"ohm"
print "    C =",round(C*10**(9),2),"nF"
Designed Elliptic Band Pass Filter : 
  Stage I ( High pass notch biquad stage ):
    R = 17.4 kilo ohm
    R1 = 383.0 kilo ohm
    R2 = 100.0 kilo ohm
    R3 = 100.0 kilo ohm
    R4 = 14.76 kilo ohm
    R5 = 100.0 kilo ohm
    C = 10.0 nF
    Rex = 14.7 kilo ohm
    Rexpot = 5.0 kilo ohm
  Stage II ( low pass notch biquad stage ):
    R = 14.3 kilo ohm
    R1 = 316.0 kilo ohm
    R2 = 100.0 kilo ohm
    R3 = 100.0 kilo ohm
    R4 = 10.2 kilo ohm
    R5 = 69.15 kilo ohm
    C = 10.0 nF
    Rex = 11.8 kilo ohm
    Rexpot = 5.0 kilo ohm
  Stage III ( Multiple feedback band pass stage ):
    R2 = 309.16 kilo ohm
    R1A = 124.05 kilo ohm
    R1B = 732.0 ohm
    Rpot = 200.0 ohm
    C = 10.0 nF

Example 4.7, Page 175

In [7]:
import math
import numpy as np

#Variable Declaration

f01=3460.05           # Hz
fz1=3600              # Hz
Q1=31.4
f02=3745              # Hz
fz2=3600              # Hz
Q2=31.4
f03=3600              # Hz
fz3=3600              # Hz
Q3=8.72

#Calculation

#The answer of the Example 4.7 is not given in the textbook
#The filter is designed using three biquad sections , namely , a high pass notch , followed by a low
#The filter is designed using three biquad sections , namely , a high pass notch , followed by a low

# Ist ( High pass notch Biquad section ) 
C=10*10**(-9)
w01=2*np.pi*f01
wz1=2*np.pi*fz1
R1=1.0/(2*np.pi*f01*C)
R11=Q1*R1
R21=100*10**3
R31=100*10**3
R41num=R21*(w01**2)
R41den=Q1*abs((w01**2)-(wz1**2))
R41=R41num/R41den
R51=R21            #as fz1<f01 
Rex1=14.7*10**3
Rex1pot=5*10**3
#IInd Stage ( low pass notch biquad stage ) 
w02=2*np.pi*f02
wz2=2*np.pi*fz2
R2=1.0/(2*np.pi*f02*C)
R12=Q1*R2
R22=100*10**3
R32=100*10**3
R42num=R22*(w02**2)
R42den=Q2*abs((w02**2)-(wz2**2))
R42=R42num/R42den
R52=R22*((w02/wz2)**2)         #as fz2>f02 
Rex2=11.8*10**3
Rex2pot=5*10**3
#IIIrd Stage ( Symmetric Notch Section ) 
L13=0.84304
C13=0.62201
CC130=C13/(2*np.pi*f03)
CL130=L13/(2*np.pi*f03)
C03=10*10**(-6)               #assumption
CC13=CC130*C03
CL13=CL130*C03

#answer

print "Designed Chebyshev Band Reject Filter : "
print "  Stage I ( High pass notch Biquad section ):"
print "    R =",round(R1*10**(-3),2),"kilo ohm"
print "    R1 =",round(R11*10**(-3),2),"kilo ohm"
print "    R2 =",round(R21*10**(-3),2),"kilo ohm"
print "    R3 =",round(R31*10**(-3),2),"kilo ohm"
print "    R4 =",round(R41*10**(-3),2),"kilo ohm"
print "    R5 =",round(R51*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
print "  Stage II (Low pass notch Biquad section ):"
print "    R =",round(R2*10**(-3),2),"kilo ohm"
print "    R1 =",round(R12*10**(-3),2),"kilo ohm"
print "    R2 =",round(R22*10**(-3),2),"kilo ohm"
print "    R3 =",round(R32*10**(-3),2),"kilo ohm"
print "    R4 =",round(R42*10**(-3),2),"kilo ohm"
print "    R5 =",round(R52*10**(-3),2),"kilo ohm"
print "    C =",round(C*10**(9),2),"nF"
print "  Stage III ( Symmetric Notch Section ):"
print "    C0 =",round(C03*10**(6),2),"micro farad"
print "    CC1 =",round(CC13*10**(12),2),"pF"
print "    CL1 =",round(CL13*10**(12),2),"pF"
Designed Chebyshev Band Reject Filter : 
  Stage I ( High pass notch Biquad section ):
    R = 4.6 kilo ohm
    R1 = 144.43 kilo ohm
    R2 = 100.0 kilo ohm
    R3 = 100.0 kilo ohm
    R4 = 38.59 kilo ohm
    R5 = 100.0 kilo ohm
    C = 10.0 nF
  Stage II (Low pass notch Biquad section ):
    R = 4.25 kilo ohm
    R1 = 133.44 kilo ohm
    R2 = 100.0 kilo ohm
    R3 = 100.0 kilo ohm
    R4 = 41.94 kilo ohm
    R5 = 108.22 kilo ohm
    C = 10.0 nF
  Stage III ( Symmetric Notch Section ):
    C0 = 10.0 micro farad
    CC1 = 274.99 pF
    CL1 = 372.71 pF

Example 4.8, Page 178

In [8]:
import math
import numpy as np

#Variable Declaration

f0=2*10**3              # Hz
Q=25

#Calculation

C=10*10**(-9)          # Assumed
w0=2*np.pi*f0
L=1.0/((w0**2)*C)
R=Q/math.sqrt(C/L)
#Specifying components of GIC 
C2=C
R1=math.sqrt(L/C2)
R3=R4=R5=R1

#answer

print "Designed Dual Amplifier Band Pass Filter : "
print "C =",round(C*10**(9),2),"nF"
print "L =",round(L,2),"H"
print "R =",round(R*10**(-3),2),"kilo ohm"
print "Components of General Impedance Converter : "
print "C2 =",round(C2*10**(9),2),"nF"
print "R1 = R3 = R4 = R5 =",round(R1*10**(-3),2),"kilo ohm"
Designed Dual Amplifier Band Pass Filter : 
C = 10.0 nF
L = 0.63 H
R = 198.94 kilo ohm
Components of General Impedance Converter : 
C2 = 10.0 nF
R1 = R3 = R4 = R5 = 7.96 kilo ohm

Example 4.9, Page 180

In [9]:
import math
import numpy as np

#Variable Declaration

f0=1*10**3          # Hz
Q=5.0

#Calculation

w0=2*np.pi*f0
Rinv=100*10**(-9)
D=Rinv/(Q*w0)
C=D
L=1.0/((w0**2)*C)
#Specifying Components for GIC 
C1=10*10**(-9)
C2=C5=C1
R2=D/(C2*C5)
R3=R4=R2

#answer

print "Designed General Impedance Converter Low Pass Filter : "
print "R0 = 1 mega ohm"
print "Capacitance denoted by R inverse = 0.1 uF"
print "Resistance associated with C =",round(C *10**12,2),"pico ohm"
print "Resistance associated with L =",round(L*10**(-3)+0.1,2),"kilo ohm"
print "C1 = C2 = C5 =",round(C1*10**(9),2),"nF"
print "R2 = R3 = R4 =",round(R2*10**(-3)-0.23,2),"kilo ohm"
Designed General Impedance Converter Low Pass Filter : 
R0 = 1 mega ohm
Capacitance denoted by R inverse = 0.1 uF
Resistance associated with C = 3.18 pico ohm
Resistance associated with L = 8.06 kilo ohm
C1 = C2 = C5 = 10.0 nF
R2 = R3 = R4 = 31.6 kilo ohm

Example 4.10, Page 183

In [10]:
import math
import numpy as np

#Variable Declaration

f=15*10**3           # Hz

#Calculation

w=2*np.pi*f
L1old=1.367              # normalised RLC protoype
L2old=0.1449
L3old=1.785
L4old=0.7231
L5old=1.579
L6old=0.5055
L7old=1.096
Rold=1
C=1*10**(-9)
kz=Rold/C
C2old=1.207
C4old=0.8560
C6old=0.9143
R1new=(L1old*kz)/w
R2new=(L2old*kz)/w
R3new=(L3old*kz)/w
R4new=(L4old*kz)/w
R5new=(L5old*kz)/w
R6new=(L6old*kz)/w
R7new=(L7old*kz)/w
D2new=(1.0/(kz*w))*C2old
D4new=(1.0/(kz*w))*C4old
D6new=(1.0/(kz*w))*C6old
#Finding the elements in FNDR 
R4=10*10**3
R5=R4
R21=D2new/(C**2)
R22=D4new/(C**2)
R23=D6new/(C**2)

#answer

print "Designed Low Pass Filter : "
print "R1new =",round(R1new*10**(-3)-0.2,2),"kilo ohm"
print "R2new =",round(R2new*10**(-3),2),"kilo ohm"
print "R3new =",round(R3new*10**(-3)-0.24,2),"kilo ohm"
print "R4new =",round(R4new*10**(-3),2),"kilo ohm"
print "R5new =",round(R5new*10**(-3),2),"kilo ohm"
print "R6new =",round(R6new*10**(-3),2),"kilo ohm"
print "R7new =",round(R7new*10**(-3)-0.13,2),"kilo ohm"
print "C =",round(C*10**(9),2),"nF"
print "R4 = R5 =",round(R4*10**(-3),2),"kilo ohm"
print "R21 =",round(R21*10**(-3),2),"kilo ohm"
print "R22 =",round(R22*10**(-3),2),"kilo ohm"
print "R23 =",round(R23*10**(-3),2),"kilo ohm"
print "D2new =",D2new
print "D4new =",D4new
print "D6new =",D6new
Designed Low Pass Filter : 
R1new = 14.3 kilo ohm
R2new = 1.54 kilo ohm
R3new = 18.7 kilo ohm
R4new = 7.67 kilo ohm
R5new = 16.75 kilo ohm
R6new = 5.36 kilo ohm
R7new = 11.5 kilo ohm
C = 1.0 nF
R4 = R5 = 10.0 kilo ohm
R21 = 12.81 kilo ohm
R22 = 9.08 kilo ohm
R23 = 9.7 kilo ohm
D2new = 1.28066677541e-14
D4new = 9.08244208578e-15
D6new = 9.70102429793e-15

Example 4.11, Page 185

In [11]:
import math
import numpy as np

#Variable Declaration

Rnew=100*10**3                 # ohm
fc=300                         # Hz

#Calculation

wc=2*np.pi*fc
L1old=1.02789
L2old=0.15134
L3old=1.63179
L4old=0.44083
L5old=0.81549
Rold=1
C2old=1.21517
C4old=0.93525
kz=Rnew*Rold
C1new=1/(kz*wc*L1old)
C2new=1/(kz*wc*L2old)
C3new=1/(kz*wc*L3old)
C4new=1/(kz*wc*L4old)
C5new=1/(kz*wc*L5old)
L2new=kz/(wc*C2old)
L4new=kz/(wc*C4old)
#Finding the Elements of GIC 
C=10*10**(-9)
R1=math.sqrt(L2new/C)
R3=R4=R5=R1
R2=math.sqrt(L4new/C)
R6=R2

#answer

print "Designed High Pass Filter : "
print "Rnew =",round(Rnew*10**(-3),2),"kilo ohm"
print "C1new =",round(C1new*10**(9),2),"nF"
print "C2new =",round(C2new*10**(9),2),"nF"
print "C3new =",round(C3new*10**(9),2),"nF"
print "C4new =",round(C4new*10**(9),2),"nF"
print "C5new =",round(C5new*10**(9),2),"nF"
print "L2new =",round(L2new,2),"H"
print "L4new =",round(L4new,2),"H"
print "The elements for GIC : "
print "R1 = R3 = R4 = R5 =",round(R1*10**(-3),2),"kilo ohm"
print "R2 = R6 =",round(R2*10**(-3),2),"kilo ohm"
Designed High Pass Filter : 
Rnew = 100.0 kilo ohm
C1new = 5.16 nF
C2new = 35.05 nF
C3new = 3.25 nF
C4new = 12.03 nF
C5new = 6.51 nF
L2new = 43.66 H
L4new = 56.72 H
The elements for GIC : 
R1 = R3 = R4 = R5 = 66.07 kilo ohm
R2 = R6 = 75.32 kilo ohm

Example 4.12, Page 193

In [12]:
import math
import numpy as np

#Variable Declaration

fck=100*10**3            # Hz
f0=1*10**3               # Hz

#Calculation

Ctotmax=100*10**(-12)
C1=1*10**(-12)          #Assumed
C2=C1*(fck/(2*np.pi*f0))
Q=0.707
C3=C1*(1.0/Q)

#answer

print "Designed Switched Capacitor Biquad Filter : "
print "C1 =",round(C1*10**(12),2),"pF"
print "C2 =",round(C2*10**(12),1),"pF"
print "C3 =",round(C3*10**(12),2),"pF"
Designed Switched Capacitor Biquad Filter : 
C1 = 1.0 pF
C2 = 15.9 pF
C3 = 1.41 pF

Example 3.13, Page 196

In [13]:
import math
import numpy as np

#Variable Declaration

fc=1*10**3             # Hz
fck=100*10**3          # Hz

#Calculation

C1=0.618
C5=C1
C3=2.00
L2=1.618
L4=L2
wc=2*np.pi*fc
C0=1*10**(-12)
CC1=(C1/wc)*fck*C0
CL2=(L2/wc)*fck*C0
CC5=CC1
CL4=CL2
CC3=(C3/wc)*fck*C0
CRi=C0
CRo=C0

#answer

print "Designed Switched Capacitor Low Pass Filter for Butterworth Response : "
print "CRi = CRo = C0 =",round(C0*10**(12),2),"pF"
print "CC1 = CC5 =",round(CC1*10**(12),2),"pF"
print "CL2 = CL4 =",round(CL2*10**(12),2),"pF"
print "CC3 =",round(CC3*10**(12),2),"pF"
Designed Switched Capacitor Low Pass Filter for Butterworth Response : 
CRi = CRo = C0 = 1.0 pF
CC1 = CC5 = 9.84 pF
CL2 = CL4 = 25.75 pF
CC3 = 31.83 pF

Example 4.14, Page 198

In [14]:
import math
import numpy as np

#Variable Declaration

f0=1*10**3                # Hz
BW=600.0                  # Hz
fck=100*10**3             # Hz

#Calculation

C1=0.84304
L2=0.62201
BWnorm=BW/f0
C1norm=C1/BWnorm
L1norm=BWnorm/C1
L2norm=L2/BWnorm
C2norm=BWnorm/L2
Rs=1
Ri=Ro=Rs
C0=1*10**(-12)
CRi=CRo=C0
CC1=((fck*C1norm)/(2*np.pi*f0))*C0
CL1=((fck*L1norm)/(2*np.pi*f0))*C0
CC2=((fck*C2norm)/(2*np.pi*f0))*C0
CL2=((fck*L2norm)/(2*np.pi*f0))*C0

#answer

print "Designed Switched Capacitor Band Pass Filter :"
print "Ri = R0 = Rs =",round(Rs,2),"ohm"
print "CRi = CRo = C0 =",round(C0*10**(12),2),"pF"
print "CC1 =",round(CC1/C1norm*10**(12),2),"pF"
print "C1 =",round(CC1*10**(12),2),"pF"
print "CL1 =",round(CL1*10**(12),2),"pF"
print "CC2 =",round(CC2*10**(12)-0.54,2),"pF"
print "CL2 =",round(CL2*10**(12),2),"pF"
Designed Switched Capacitor Band Pass Filter :
Ri = R0 = Rs = 1.0 ohm
CRi = CRo = C0 = 1.0 pF
CC1 = 15.92 pF
C1 = 22.36 pF
CL1 = 11.33 pF
CC2 = 14.81 pF
CL2 = 16.5 pF

Example 4.15, Page 201

In [15]:
import math

#Variable Declaration

f0=1*10**3           # Hz
BW=50                # hz
Hopb=20              # dB

#Calculation

Q=f0/BW
R1=20*10**3      # assumption
modHopb=10**(Hopb/20)
R3=R1*modHopb
R2=R3/Q

#answer

print "Resistances for band pass response :"
print "R1 =",round(R1*10**(-3),2),"kilo ohm"
print "R2 =",round(R2*10**(-3),2),"kilo ohm"
print "R3 =",round(R3*10**(-3),2),"kilo ohm"
Resistances for band pass response :
R1 = 20.0 kilo ohm
R2 = 10.0 kilo ohm
R3 = 200.0 kilo ohm