In [2]:

```
from numpy import pi
# Given data
f_H= 2 # in kHz
f_H= f_H*10**3 # in Hz
C=0.01 # in micro F
C=C*10**-6 # in F
R= 1/(2*pi*f_H*C) # in ohm
R=R*10**-3 # in kohm
# R may be taken a pot of 10 k ohm
R=10 # in k ohm
# Since the passbond gain is 2.5, so
# 1+Rf/R1= 2.5 or Rf= 1.5*R1
# Since Rf||R1
R1= R*2.5/1.5 # in k ohm
Rf= R1*1.5 # in k ohm
print "Value of R1 = %0.2f k ohm (Standard value 18 k ohm)" %R1
print "Value of Rf = %0.f k ohm (Standard value 27 k ohm)" %Rf
```

In [9]:

```
from __future__ import division
# Given data
f_H= 2 # in kHz
f_H= f_H*10**3 # in Hz
C=0.033 # in micor F
C=C*10**-6 # in F
C_desh= C
R= 1/(2*pi*f_H*C) # in ohm
R=R*10**-3 # in kohm
R=2.7 # k ohm (Standard value)
R_desh= R
# So 2*R= Rf*R1/(Rf+R1) = 0.586*R1**2/(1.586*R1)
R1= 2*R*1.586/(0.586) # in k ohm
print "The value of R1 = %0.1f k ohm (Standard value 15 k ohm) " %R1
R1= 15 # k ohm (Standard value)
Rf= 0.586*R1 # in k ohm
print "The value of Rf = %0.2f k ohm (Standard value 10 k ohm) " % Rf
```

In [18]:

```
import math
# Given data
f_H= 1 # in kHz
f_H= f_H*10**3 # in Hz
C=0.0047 # in micro F
C=C*10**-6 # in F
C_desh= C
R= 1/(2*pi*f_H*C) # in ohm
R=R*10**-3 # in kohm
R=math.floor(R)
R_desh= R
R1=R # in k ohm
Rf= 0.586*R1 # in k ohm
Rf= math.ceil(Rf) # in k ohm
print "Value of R' = R = %0.f k ohm" %R
print "Value of C' = C = %0.4f micro F" %(C*10**6)
print "Value of R1 = %0.f k ohm" %R1
print "Value of Rf = %0.1f k ohm" %Rf
```

In [22]:

```
# Given data
f= 1 # in kHz
f= f*10**3 # in Hz
# Vout/Vin= 10
R1= 100 # in k ohm
R1=R1*10**3 # in ohm
R2= 1000 # in k ohm
R2=R2*10**3 # in ohm
omega= 2*pi*f
# Vout/Vin at a 3 dB frequency of 1 kHz = 1/sqrt(2) = omega*R2*C/sqrt(1+omega**2*R1**2*C2)
C= math.sqrt(1/(omega**2*(2*R2**2-R1**2))) # in F
print "Value of R1 = %0.f k ohm" %(R1*10**-3)
print "Value of R2 = %0.f k ohm" %(R2*10**-6)
print "Value of C = %0.4e F" %C
```

In [23]:

```
# Given data
R= 2.1 # in k ohm
R=R*10**3 # in ohm
R1= 20 # in k ohm
R1=R1*10**3 # in ohm
Rf= 60 # in k ohm
Rf=Rf*10**3 # in ohm
C=0.05 # in micro F
C=C*10**-6 # in F
fL= 1/(2*pi*R*C) # in Hz
print "Low cut-off frequency = %0.3f kHz" %(fL*10**-3)
```

In [25]:

```
# Given data
R= 10 # in k ohm
R=R*10**3 # in ohm
R_desh= R # in ohm
C=0.1 # in micro F
C=C*10**-6 # in F
C_desh=0.0025 # in micro F
C_desh=C_desh*10**-6 # in F
fH= 1/(2*pi*R_desh*C_desh) # in Hz
print "Higher cut-off frequency = %0.3f kHz"%(fH*10**-3)
fL= 1/(2*pi*R*C) # in Hz
print "Lower cut-off frequency = %0.2f Hz" %fL
BW= fH-fL
print "Bandwidth = %0.1f kHz" %(BW*10**-3)
```

In [30]:

```
# Given data
fc= 1 # in kHz
fc=fc*10**3 # in Hz
Q=5
Af=8
# Let C=C1=C2=0.01 # in micro F
C1= 0.01 # in micro F
C1=C1*10**-6 # in F
C2=C1 # in F
C=C2 # in F
R1= Q/(2*pi*fc*C*Af) # in ohm
R1=R1*10**-3 # in kohm
R1=math.ceil(R1)
R2= Q/(2*pi*fc*C*(2*Q**2-Af)) # in ohm
R2=R2*10**-3 # in kohm
R2=math.ceil(R2)
R3= Q/(pi*fc*C) # in ohm
R3=R3*10**-3 # in kohm
R3=math.ceil(R3)
# The value of R2_desh required to change the centre frequency from 1 kHz to 2 kHz is
f_desh_c= 2000 # in Hz
R2_desh= R2*(fc/f_desh_c)**2 # in kohm
print "Value of R1 = %0.f kohm" %R1
print "Value of R2 = %0.f kohm" %R2
print "Value of R3 = %0.f kohm" %R3
print "Value of R2_desh = %0.f ohm" %(R2_desh*10**3)
```

In [32]:

```
# Given data
C= 0.1 # in micro F
C=C*10**-6 # in F
R1= 2 # in kohm
R1=R1*10**3 # in ohm
R2= 2/3 # in kohm
R2=R2*10**3 # in ohm
R3= 200 # in kohm
R3=R3*10**3 # in ohm
# R1= Q/(2*pi*fc*C*Af) (i)
# R2= Q/(2*pi*fc*C*(2*Q**2-Af)) (ii)
# R3= Q/(pi*fc*C) (iii)
# From (i) and (iii)
Af= R3/(2*R1)
# From (ii) and (iii)
Q= math.sqrt(1/2*(R3/(2*R2)+Af))
# From (iii)
fc= Q/(R3*pi*C) # in Hz
omega_o= 2*pi*fc # in radians/second
print "The value of gain = %0.f" %Af
print "Value of Q = %0.f" %Q
print "Centre frequency = %0.f radians/second" %omega_o
```

In [1]:

```
from numpy import pi
# Given data
fL= 200 # in Hz
fH= 1 # in kHz
fH=fH*10**3 # in Hz
#Let the capacitor C_desh be of 0.01 micro F
C_desh= 0.01*10**-6 # in F
R_desh= 1/(2*pi*fH*C_desh) # in ohm
R_desh=R_desh*10**-3 # in kohm
R_desh= 18 # in kohm
# Let
C=0.05*10**-6 # in F
R= 1/(2*pi*fL*C) # in ohm
R=R*10**-3 # in kohm
R= 18 # in k ohm
Rf= 10 # in kohm
print "Value of Rf' = Rf = R1' = R1 = %0.f kohm" %Rf
print "Value of R = R' = %0.f kohm" %R
print "Value of C'= %0.2f micro F" %(C_desh*10**6)
print "Value of C = %0.2f micro F" %(C*10**6)
```

In [4]:

```
# Given data
fL= 200 # in Hz
fH= 1 # in kHz
fH=fH*10**3 # in Hz
fc= math.sqrt(fL*fH) # in Hz
Q= fc/(fH-fL)
print "The value of Q for filter = %0.3f" %Q
```

In [6]:

```
# 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 1.8 kΩ)" %R
```

In [8]:

```
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 47 kΩ)" %R
```

In [17]:

```
# Given data
fN= 60 # in Hz
# Let
C= 0.06 # in micro F
C=C*10**-6 # in F
R= 1/(2*pi*fN*C) # in ohm
R=R*10**-3 # in kohm
print "Value of R = %0.2f kohm (Standard value 47 kohm)" %R
print "For R/2, two 47 kohm resistors connected in parallel may be used and for 2C component, "
print "two parallel connected %0.2f micro F capacitors may be used" %(C*10**6)
```

In [19]:

```
# 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)
```