from math import pi
# given data
R=10 #in Kohm
C=0.01 #in uF
R1=4.7 #in Kohm
RF=47 #in Kohm
fc=1/(2*pi*R*1000*C*10**-6) #in Hz
AF=1+RF/R1 #unitless
print "Cut-off frequency = %0.2f kHz" %(fc/1E3)
print "Pass band gain =",AF
from math import pi, ceil
# given data
fc=2 #in KHz
AF=2 #unitless
# let C=0.01 uF
C=0.01 #in uF
R=(1/(2*pi*fc*1E3*C*1E-6))/1E3 #in Kohm
R=ceil(R)
# Bias compensation Rbc
# Rbc=R1*RF/(R1+RF) ohm
# R=R1*RF/(R1+RF)=Rdash/2 ohm
#Rdash=R1=RF=2*R #in ohm
Rdash=2*R #in ohm
R1=2*R #in ohm
RF=2*R #in ohm
R1=RF #in kohm
print "Component values are :"
print "R1 = RF = %0.2f kohm" %(R1)
print "R = %0.2f kohm"%R
from __future__ import division
# given data
fc_original=2 #in KHz
fc_new=3 #in KHz
R_original=8 #in Kohm
R_new=fc_original*R_original/fc_new #in Kohm
print "New value of resistance = %0.2f ohm"%R_new
# given data
fc=1 #in KHz
AF=2 #unitless
# let C=0.01 uF
C=0.01 #in uF
R=(1/(2*pi*fc*1000*C*10**-6))/1000 #in Kohm
#For Bias compensation
#Rbc=R1*RF/(R1+RF) ohm
#R=R1*RF/(R1+RF)=Rdash/2 ohm"
#Rdash=R1=RF=2*R #in ohm
Rdash=2*R #in ohm
R1=2*R #in ohm
RF=2*R #in ohm
R1=RF #in kohm
print "Component values are :"
print "R1 = RF = %0.1f kohm" %(R1)
print "R = %0.1f kohm"%R
from math import sqrt, pi
# given data
AF=5 #unitless
fc=1 #in KHz
alfa=1.414 #unitless
# assume C2=0.1 uF
C2=0.1 #in uF
C3=(C2*alfa**2)/4 # in uF
R=1/(2*pi*fc*10**3*sqrt(C2*10**-6*C3*10**-6)) #in ohm
#Take RF=10 Kohm
RF=10 #in Kohm
R1=RF/(AF-1) #in Kohm
print "Value of R = %0.2f kohm"%(R/1E3)
print "Value of RF = %0.2f kohm" %(RF)
print "Value of R1 = %0.2f kohm"%R1
from math import sqrt, pi
# given data
C2=0.1 #in uF
C3=0.0333 #in uF
alfa=2*sqrt(C3/C2) #unitless
print "Value of alfa = %0.2f" %alfa
print "This filter is situated between Butterworth and the Chebyshev, hence approximating Klp=1.1"
Klp=1.1 #unitless
R=2.25 #in Kohm
f3dB=Klp/(2*pi*R*sqrt(C2*C3)) #in KHz
print "f3dB = %0.2f kHz" %f3dB
#Note : Answer in the book is wrong
from math import pi
# given data
Klp=1 #unitless# it is 1 for butterworth filter
alfa=1.414 #unitless# it is 1.414 for butterworth filter
fc=1 #in KHz
R=15.9 #in Kohm
# assume C=0.01 uF
C=0.01 #in uF
R=Klp/(2*pi*fc*1000*C*10**-6) # in ohm
AF=3-alfa #unitless
R1=2*R/0.369 #in Kohm
RF=(AF-1)*R1 #in Kohm
A2=5/AF #unitless
print "Value of RF = %0.2f kohm" %(RF/1000)
print "Gain of this amplifier = %0.2f "%A2
from __future__ import division
from math import pi
# given data
R2=20 #in Kohm
R3=20 #in Kohm
R=R2 #in Kohm
C2=0.47 #in uF
C3=0.47 #in uF
C=C2 #in uF
RF=56 #in Kohm
R1=56 #in Kohm
AF=1+RF/R1 #unitless
alfa=3-AF #unitless
Klp=1.238 #unitless
print "Value of alfa = %0.2f" %alfa
print "alfa=1 corresponds to chebyshev filter response."
f3dB=Klp/(2*pi*R*1000*C*10**-6) #in Hz
print "Critical frequency = %0.2f Hz" %(f3dB)
from math import pi
# given data
fc=2 #in kHz
alfa=1.414 #unitless
Klp=1 #unitless
#assume C=0.01 uF
C=0.01 #in uF
R=Klp/(2*pi*fc*1000*C*10**-6) #in ohm
AF=3-alfa #unitless
R1=2*R/0.369 #in ohm
RF=0.586*R1 #in ohm
print "Design components values are :"
print "Value of R1 = %0.2f kohm"%(R1/1000)
print "Value of RF = %0.2f kohm"%(RF/1000)
print "Value of R2=R3=R= %0.2f kohm" %(R/1000)
print "Value of C2=C3=C= %0.2f uF" %(C)
# given data
C=0.1 #in uF
R=11 #in Kohm
RF=5.6 #in Kohm
R1=10 #in Kohm
AF=1+RF/R1 #unitless
alfa=3-AF #unitless
Klp=1 #unitless# for Butterworth filter
Khp=1/Klp #unitless
f3dB=Khp/(2*pi*R*1000*C*10**-6) #in Hz
print "3 dB frequency = %0.2f Hz"%(f3dB)
print "Value of alfa = %0.2f"%alfa
print "Value of alfa shows that it is a Butterworth flter."
print "Passband gain for a high pass filter = %0.2f"%Khp
from math import pi
# given data
fc=2 #in KHz
alfa=1.414 #unitless
Klp=1 #unitless
#assume C=0.01 uF
C=0.01 #in uF
R=Klp/(2*pi*fc*1000*C*10**-6) #in ohm
AF=3-alfa #unitless
R1=2*R/0.369 #in ohm
RF=0.586*R1 #in ohm
print "Design components values are :"
print "Value of R1 = %0.2f kohm" %(R1/1000)
print "Value of RF = %0.2f kohm" %(RF/1000)
print "Value of R2=R3=R= %0.2f kohm " %(R/1000)
print "Value of C2=C3=C= %0.2f uF" %(C)
from math import pi, sqrt
# given data
fL=200 #in Hz
fH=1 #in KHz
AFBP=4 #unitless
#for LP section design
#assume C=0.01 uF
C=0.01 #in uF
R=1/(2*pi*fH*1000*C*10**-6) #in ohm
print "For low pass section design component values are :"
print "Value of R = %0.1f kohm" %(R/1000)
print "Value of C = %0.2f uF "%C
#for HP section design
#assume C=0.05 uF
C=0.05 #in uF
R=1/(2*pi*fL*1000*C*10**-6) #in ohm
print "For high pass section design component values are :"
print "Value of R = %0.1f kohm" %R
print "Value of C = %0.2f uF"%C
print "We have AFBP=AFHP*AFLP=4"
print "R=10 kohm"
fc=sqrt(fH*fL*1000) #in Hz
BW=fH*1000-fL #in Hz
Q=fc/BW #unitless
print "Center frequency = %0.2f Hz"%fc
print "BW = %0.2f Hz"%BW
print "Selectivity = %0.2f" %Q
print "As Q<10, hence the given filter is wide band pass filter."
from math import sqrt, pi
# given data
fL=2 #in KHz
fH=2.5 #in KHz
AF=-5 #unitless
fc=sqrt(fH*1000*fL*1000) #in Hz
BW=fH*1000-fL*1000 #in Hz
Q=fc/BW #unitless
print "Center frequency = %0.f Hz"%fc
print "BW = %0.2f Hz"%BW
print "Selectivity = %0.3f " %Q
#assume C=0.01 uF
C=0.01 #in uF
R2=2/(2*pi*C*10**-6*BW) #in Kohm
R1=-R2/(2*AF) #in KOhm
R3=R1/((4*pi*pi*R1*R2*fc*1000*fc*1000*C*C*10**-12)-1) #in Kohm
print "Value of R1 = %0.2f kohm "%(R1/1000)
print "Value of R2 = %0.2f kohm "%(R2/1000)
print "Value of R3 = %0.2f ohm "%(R3*1000)
print "Value of C = %0.2f uF" %C
# given data
AF=-10 #unitless
Q=20 #unitless
fc=50 #in Hz
fc1=fc #in Hz
fc2=fc #in Hz
fc3=fc #in Hz
Q1=0.51*Q #unitless
Q2=0.51*Q #unitless
Q3=0.51*Q #unitless
AF1=-(-AF)**(1/3) #unitless
print "A single op-amp band passed filter can be design with specifications :"
print "Center frequency = %0.2f Hz" %fc
print "AF1 = %0.2f "%AF1
print "Q1 = %0.2f "%Q1
from math import tan, pi
# given data
f=2 #in KHz
fi_degree=-135 #in degree
fi_radian=fi_degree*(pi/180)
print "A phase shift of -135 degree is achieved by an all pass phase lag filter."
#assume C=0.1 uF and R1=RF=10 Kohm
C=0.1 #in uF
R1=10 #in Kohm
RF=10 #in Kohm
R=tan(-fi_radian/2)/(2*pi*f*1000*C*10**-6)
print "Component values are :"
print "Value of R1 = %0.2f kohm "%R1
print "Value of RF = %0.2f kohm"%RF
print "Value of R = %0.2f kohm " %(R/1000)
print "Value of C = %0.2f uF "%C
# given data
R=10 #in Kohm
R1=R #in Kohm
R2=R #in Kohm
R3=R #in Kohm
Rf=5.6 #in Kohm
R4=Rf #in Kohm
R5=Rf #in Kohm
RA=2.7 #in Kohm
RB=1.5 #in Kohm
C=0.01 #in uF
C1=C #in uF
C2=C #in uF
alfa=3*RB/(RA+RB)
print "Value of alfa = %0.2f"%alfa
print "This value correspondes to the chebyshev response."
C=0.01 #in uF
C1=C #in uF
C2=C #in uF
fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz
Klp=1.238 #unitless
fH=fc*Klp #in Hz
Khp=1/Klp #unitless
fL=fc*Khp#in Hz
print "Critical frequency = %0.2f kHz"%(fc/1000)
print "High cut-off frequency = %0.2f kHz" %(fH/1000)
print "Low cut-off frequency = %0.2f kHz "%(fL/1000)
C=0.01 #in uF
C1=C #in uF
C2=C #in uF
fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz
print "Band pass center frequency = %0.2f kHz" %(fc/1000)
C=0.01 #in uF
C1=C #in uF
C2=C #in uF
alfa=3*RB/(RA+RB) #unitless
Q=1/alfa #unitless
fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz
BW=fc/Q #in Hz
print "Band pass bandwidth = %0.2f kHz" %(BW/1000)
C=0.01 #in uF
C1=C #in uF
C2=C #in uF
alfa=3*RB/(RA+RB) #in unitless
Q=1/alfa #in unitless
print "The band pass gain at center frequency = %0.3f "%Q