from numpy import pi
from __future__ import division
# Given data
f_H= 2*10**3 #cut-off frequency in Hz
C= 0.01*10**-6 # in F
passband_gain= 2.5
R= 1/(2*pi*f_H*C) # in Ω
R= 8.2 # in kΩ (standard value)
# 1+Rf/R1= passband_gain or Rf should be equal to 1.5*R1 since Rf||R1= R
R1= passband_gain/1.5*R # in kΩ
print "The value of R1 = %0.2f kΩ (Standard value 15 kΩ)" %R1
Rf= int(1.5*R1) # in kΩ
print "The value of Rf = %0.f kΩ" % Rf
# Given data
f_H= 2*10**3 #cut-off frequency in Hz
C= 0.033*10**-6 # in F
R= 1/(2*pi*f_H*C) # in Ω
# 2*R= Rf*R1/(Rf+R1)= 0.586*R1**2/(1.586*R1) since Rf= 0.586*R1
R1= 2*R*1.586/0.586 # in Ω
R1= round(R1*10**-3) # in kΩ
print "The value of R1 = %0.f kΩ (Standard value 15 kohm)" %R1
R1= 15 # in kΩ
Rf= R1*0.586 # in kΩ
#Rf= floor(1.5*R1) # in kΩ
print "The value of Rf = %0.2f kΩ" %Rf
print "(The value of Rf may be taken as a pot of 10 kΩ)"
# Given data
f_H= 1*10**3 #cut-off frequency in Hz
C= 0.0047*10**-6 # in F
R= 1/(2*pi*f_H*C) # in Ω
R= (R*10**-3) # in kΩ
R1= 30 # in kΩ (assume)
Rf= 0.586*R1 # in kΩ
C= C*10**6 # in µF
print "The value of R'= R = %0.2f kΩ (standard value 33 kΩ)" %R
print "The value of C'= C = %0.4f µF " %C
print "The value of R1= %0.2f kΩ " %R1
print "The value of Rf= %0.2f kΩ (standard value 20 kΩ pot)" %Rf
import math
# Given data
fc= 1*10**3 # in Hz
alpha= 1.414
C= 0.1*10**-6 # in F (assume)
C_desh= C*alpha**2/4 # in F
C_desh= C_desh*10**6 # in µF
print "The value of C' = %0.2f µF" %C_desh
C_desh= C_desh*10**-6 # in F
R_desh= 1/(2*pi*fc*math.sqrt(C*C_desh)) # in Ω
R_desh= R_desh*10**-3 # in kΩ
print "The value of R' = %0.2f kΩ (standard value 2.2 kΩ)"%R_desh
# Given data
alpha= 1.414 # passband
C= 0.01*10**-6 # in F (assume)
fc= 1*10**3 # in Hz
dc_gain= 6
R= 1/(2*pi*C*fc) # in Ω
R= R*10**-3 # in kΩ
print "The value of R = %0.1f kΩ (standard value 15 kΩ)" %R
R= 15 # in kΩ
Af= 3-alpha # and Af= 1+Rf/R1 or
# Rf= (Af-1)*R1 (i)
# 2*R= Rf || R1, hence from (i)
R1= 2*R*Af/(Af-1) # in kΩ
print "The value of R1 = %0.1f kΩ (standard value 82 kΩ)" %R1
R1= 82 # in kΩ
Rf= (Af-1)*R1 # in kΩ
print "The value of Rf = %0.f kΩ (standard value 47 kΩ)" %Rf
Aamp= dc_gain/Af
print "The value of Aamp = %0.2f" %Aamp
# Given data
R= 2.1*10**3 # in kΩ
C= 0.05*10**-6 # in F
R1= 20*10**3 # in Ω
Rf= 60*10**3 # in Ω
# Low cut-off frequency,
f_L= 1/(2*pi*R*C) # in Hz
f_L= f_L*10**-3 # in kHz
print "The cut-off frequency = %0.3f kHz" %f_L
import math
from __future__ import division
# Given data
R1= 2*10**3 # in Ω
R2= 2/3*10**3 # in Ω
R3= 200*10**3 # in Ω
C= 0.1*10**-6 # in F
Af= R3/(2*R1) # gain
print "The value of Af = %0.f" %Af
# R1= Q/(2*pi*f_C*C*Af) (i)
# R2= Q/(2*pi*f_C*C*(2*Q**2-Af)) (ii)
# R3= Q/(pi*f_C*C) (iii)
Q= math.sqrt((R3/(2*R2)+Af)/2) # from (ii) and (iii)
print "The value of Q = %0.f" %Q
f_C= Q/(R3*pi*C) # in Hz (from (iii))
print "The value of f_C = %0.f Hz" %f_C
omega_0= 2*pi*f_C # in radians/second
print "The value of omega_0 = %0.f radians/seconds" %omega_0
# Given data
f_L= 2*10**3 # in Hz
f_H= 2.5*10**3 # in Hz
Af= -5
f_C= math.sqrt(f_L*f_H) # centre frequency in Hz
del_f= f_H-f_L #bandwidth in Hz
Q= f_C/del_f # selectivity
# Assume C1= C2= C= 0.01µF
C= 0.01*10**-6 # in F
R3= 1/(pi*del_f*C) # in Ω
R3= R3*10**-3 # in kΩ
print "The value of R3 = %0.2f kΩ (standard value 64 kΩ)" %R3
R3= 64 # in kΩ
R3= R3*10**3 # in Ω
R1= -R3/(2*Af) #in Ω
R2= R1/(4*pi**2*f_C**2*R1*R3*C**2-.1)
R1= R1*10**-3 # in kΩ
C=C*10**6 # in µF
print "The value of R1 = %0.1f kΩ " %R1
print "The value of R2 = %0.f kΩ (standard value 800Ω)" %R2
print "The value of C = %0.2f µF " %C
# Given data
f_C= 1*10**3 #centre frequency in Hz
f_C_desh= 2*10**3 #new centre frequency in Hz
Q= 5 # selectivity
Af= -8
C= 0.01*10**-6 # in F (assume)
R3= Q/(pi*f_C*C) #in Ω
R3= R3*10**-3 # in kΩ
print "The value of R3 = %0.1f kΩ (160 kΩ (approx))" %R3
R1= round(-R3/(2*Af)) # in kΩ
print "The value of R1 = %0.f kΩ" %R1
R2= R1*10**3/(4*pi**2*f_C**2*R1*10**3*R3*10**3*C**2-1) # in Ω
R2= R2*10**-3 # in kΩ
print "The value of R2 = %0.2f kΩ (2 kΩ (approx))" %R2
R2= 2 # in kΩ (approx)
R2_desh= R2*(f_C/f_C_desh)**2 # in kΩ
R2_desh= R2_desh*10**3 # in Ω
print "The value of R2' = %0.f Ω" %R2_desh
# Given data
R= 10*10**3 # in Ω
C1= 0.1*10**-6 # in F
C2= 0.0025*10**-6 # in F
f_H= 1/(2*pi*R*C2) #higher cut-off frequency in Hz
f_H= f_H*10**-3 # in kHz
f_L= 1/(2*pi*R*C1) #lower cut-off frequency in Hz
BW= f_H-f_L*10**-3 # bandwidth in kHz
print "The higher cut-off frequency = %0.3f kHz" %f_H
print "The lower cut-off frequency = %0.2f Hz" %f_L
print "The bandwidth = %0.1f kHz" %BW
# Given data
f_L= 200 # in Hz
f_H= 1*10**3 # in Hz
alpha=4 # passband gain
C_desh= 0.01*10**-6 # in F (assume)
R_desh= 1/(2*pi*f_H*C_desh) # in Ω
R_desh= R_desh*10**-3 # in kΩ
print "The value of R' = %0.1f kΩ (Standard value 20 kΩ)" %R_desh
R_desh= 20 # in kΩ (standard value)
# First Order High-Pass Filter
C= 0.05*10**-6 # in F (assume)
R= 1/(2*pi*f_L*C) # in Ω
R= R*10**-3 # in kΩ
R1= 10 # in kΩ
Rf= R1 # in kΩ
C_desh= C_desh*10**6 # in µF
C= C*10**6 # in µF
print "The value of R = %0.1f kΩ (Standard value 20 kΩ)" %R
R= 20 # in kΩ (standard value)
print "The value of R1 and Rf = %0.f kΩ" %R1
print "The value of C' = %0.2f µF" %C_desh
print "The value of C = %0.2f µF" %C
# Given data
f_H= 200 # in Hz
f_L= 2*10**3 # in Hz
C= 0.05*10**-6 # in F
# For low-pass filter,
R_desh= 1/(2*pi*f_H*C) # in Ω
R_desh= R_desh*10**-3 # in kΩ
print "The value of R' = %0.1f kΩ (standard value 20 kΩ)" %R_desh
# For high-pass filter,
R= 1/(2*pi*f_L*C) # in Ω
R= R*10**-3 # in kΩ
print "The value of R = %0.2f kΩ (standard value 2 kΩ)" %R
from numpy import pi
# Given data
C= 0.068*10**-6 # in F
f_N= 50 # in Hz
R= 1/(2*pi*f_N*C) # in Ω
R= R*10**-3 # in kΩ
print "The value of R = %0.1f kΩ (standard value 50 kΩ)" %R
import math
# Given data
R= 15*10**3 # in Ω
C= 0.01*10**-6 # in F
f= 2*10**3 # in Hz
PhaseShift= -2*(math.atan(2*pi*f*R*C))*180/pi # in °
print "The phase shift = %0.f°" %PhaseShift
print "i.e. %0.f° (lagging)" %abs(PhaseShift)
# Given data
R_A= 2.2*10**3 # in Ω
R_B= 1.2*10**3 # in Ω
Rf= 4.7*10**3 # in Ω
C= 0.01*10**-6 # in F
k_lp= 1.238
k_hp= 1/k_lp
# Part (i)
alpha= 3*R_B/(R_A+R_B)
print "Part (i) : The value of alpha = %0.3f" %alpha
print "Given filter is 1db peak Chebyshev"
# Part (ii)
f_0= 1/(2*pi*Rf*C) #critical frequency in Hz
f_0= f_0*10**-3 # in kHz
f_low_pass= f_0*k_lp # in kHz
print "\nPart (ii) : The low-pass frequency = %0.3f kHz" %f_low_pass
f_high_pass= f_0*k_hp # in kHz
print "The high-pass frequency = %0.3f kHz" %f_high_pass
# Part (iii)
fc= f_0 # bandpass centre frequency in kHz
print "Part (iii) : The bandpass centre frequency = %0.3f kHz" %fc
# Part (iv)
# Formula used : delta_f= fc/Q= fc/(1/alpha)
delta_f= fc/(1/alpha) # in kHz
print "Part (iv) : The bandpass width = %0.3f kHz" %delta_f
# Part (v)
A0= 1/alpha # bandpass gain at centre frequency
print "Part (v) : The bandpass gain at centre frequency = %0.4f" %A0