In [2]:

```
from numpy import pi
#Given data
R = 10 # in k ohm
R = R * 10**3 # in ohm
C = 0.001 # in µF
C = C * 10**-6 # in F
f_c = 1/(2*pi*R*C) # Hz
f_c = f_c * 10**-3 # in kHz
print "Cutoff frequency = %0.3f kHz" %f_c
R_F = 100 # in k ohm
R1 = 10 # in k ohm
A_F = 1+(R_F/R1)
print "The passband voltage gain = %0.f" %A_F
```

In [4]:

```
#Given data
R1 = 10 # in k ohm
R_F = R1 # in k ohm
print "The value of R_F = %0.f kΩ" %R_F
C = 0.001 # in µF
C = C *10**-6 # in F
f_c = 10 # in kHz
f_c = f_c * 10**3 # in Hz
R = 1/(2*pi*f_c*C) # in ohm
R = R * 10**-3 # in k ohm
print "The value of R = %0.1f kΩ" %R
```

In [7]:

```
#Given data
f_c = 2 # in kHz
f_c = f_c * 10**3 # in Hz
C = 0.01 # in µF
C = C * 10**-6 # in F
R = 1/(2*pi*f_c*C) # in ohm
R = R * 10**-3 # in k ohm
R = 8.2 # in k ohm(Practical value)
A_F = 2.5
R1 = (A_F*R)/1.5 # in k ohm
R_F = 1.5*R1 # in k ohm
print "The value of R1 = %0.2f kΩ (standard value 15 kohm)" %R1
print "The value of R_F = %0.f kΩ" %R_F
```

In [11]:

```
#Given data
f_c = 1 # in kHz
f_c = f_c * 10**3 # in Hz
C = 0.005*10**-6 # in F
R3 = 1/(2*pi*f_c*C) # in ohm
R3 = R3 * 10**-3 # in k ohm
R2 = R3 # in k ohm
R1 = 33 # in k ohm (standard value)
R_F = 0.586*R1 # in k ohm
print "The value of R1 = %0.f kΩ" %R1
print "The value of R2 = R3 = %0.2f kΩ" %R3
print "The value of R_F = %0.3f kΩ" %R_F
print "The value of C2 = C3 = %0.3f µF" %(C*10**6)
```

In [15]:

```
from __future__ import division
#Given data
R1 = 12 # in k ohm
R_F = 7 # in k ohm
R2 = 33 # in k ohm
R3 = R2 # in k ohm
R = R2 # in k ohm
R = R * 10**3 # in ohm
C1 = 0.002 # in µF
C1 = C1 * 10**-6 # in F
C2 = C1 # in F
C = C1 # in F
f_c = 1/(2*pi*R*C) # in Hz
f_c = f_c * 10**-3 # in kHz
print "Cut off frequency = %0.3f kHz" %f_c
A_F = 1+(R_F/R1)
print "Pass band voltage gain = %0.3f" %A_F
#Note : The unit of cut off frequency in the book is wrong
```

In [18]:

```
#Given data
f_c = 2 # in kHz
f_c = f_c * 10**3 # in Hz
C2 = 0.033 # in µF
C2 = C2 * 10**-6 # in F
C3 = C2 # in F
C = C2 # in F
R2 = 1/(2*pi*f_c*C) # in ohm
R2 = R2 * 10**-3 # in k ohm
R3=R2 # in kohm
print "The value of R2 = R3 = %0.1f kΩ" %R2
#R_F= 0.586*R1
R1= 2*R2*(1+0.586)/0.586 # in k ohm
print "The value of R1 = %0.f kΩ" %R1
R1= 15 # in k ohm
R_F = 0.586 * R1 # in k ohm
print "The value of R_F = %0.2f kΩ" %R_F
print "R_F may be taken as a pot of 10 kΩ"
```

In [26]:

```
import math
#Given data
f_c = 1 # in kHz
f_c = f_c * 10**3 # in Hz
C2 = 0.0047 # in µF
C2 = C2 * 10**-6 # in F
C3 = C2 # in F
C = C2 # in F
R2 = 1/(2*pi*f_c*C) # in ohm
R2 = R2 * 10**-3 # in k ohm
R3= R2 # in kohm
# Let
R1=30 # in kohm
R_F= R1*0.586 # in kohm
print "The value of R2 = R3 = %0.f kΩ" %math.floor(R2)
print "The value of C2 = C3 = %0.4f micro F" %(C3*10**6)
print "The value of R1 = %0.f kΩ" %R1
print "The value of R_F = %0.f kΩ" %R_F
print "The standard value of R_F is 20 kΩ"
```

In [47]:

```
from math import sqrt
#Given data
f_c = 1.5 # in kHz
f_c = f_c * 10**3 # in Hz
alpha = sqrt(2)
R_F = (2-alpha) # in ohm
print "The value of R_F = %0.3f Ω" %R_F
R_i = 1 # in ohm
A_F = 1+(R_F/R_i)
print "The pass band gain = %0.3f" %A_F
Omega_c = 2*pi*f_c # in rad/sec
C = 1 # in F
R = 1/Omega_c # in ohm
R = R * 10**7 # in ohm
R=R*10**-3 # in kohm
R1 = R # in k ohm
R2=R1 # in kohm
print "The value of R1 = R2 = %0.3f kΩ" %R1
C = C/10**7 # in µF
C = C * 10**9 # in nF
C1=C # in nF
C2= C1 # in nF
print "The value of C1 = C2 = %0.f nF" %C1
#Note: The unit of R1 and R2 is wrong in the book
```

In [48]:

```
#Given data
alpha = 1.414
f_c = 1.5 # in kHz
f_c = f_c * 10**3 # in Hz
C1 = 2/alpha # in F
C2 = alpha/2 # in F
R1 = 1 # in ohm
R2 = R1 # in ohm
R_F = 2 # in ohm
Omega_c = 2*pi*f_c # in rad/sec
R = 1/Omega_c # in ohm
R = R * 10**7 # in ohm
R1 = R # in ohm
R2= R1 # in ohm
R_F = 2*R # in ohm
C1 = C1/10**7 # in F
C2 = C2/10**7 # in F
print "The value of R1 = R2 = %0.3f kohm" %(R1*10**-3)
print "The value of C1 = %0.1f nF" %(C1*10**9)
print "The value of C2 = %0.1f nF" %(C2*10**9)
print "The value of R_F = %0.3f kohm" %(R_F*10**-3)
```

In [95]:

```
from __future__ import division
from math import log10
#Given data
f_c = 10 # in kHz
f_c = f_c * 10**3 # in Hz
omega_c= 2*pi*f_c # in rad/sec
C = 0.01 # in µF
C= C*10**-6 # in F
Ri= 10*10**3 # in Ω
n=2
Q= 1/1.414
R= 1/(2*pi*f_c*C) # in Ω
Af= 3-1/Q
Rf= (Af-1)*Ri # in Ω
print "The value of C = %0.2f µF" %(C*10**6)
print "The value of R = %0.3f kΩ" %(R*10**-3)
print "The value of Rf = %0.2f kΩ" %(Rf*10**-3)
print "Frequency versus gain magnitude shown in following table:"
print "-----------------------------------------------------------------------------------------"
print "| Frequency in Hz Gain Magnitude in dB |H(s)| |"
print "-----------------------------------------------------------------------------------------"
f= 1000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",int(HsdB)," |"
f= 2000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",round(HsdB,3)," |"
f= 5000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",round(HsdB,2)," |"
f= 10000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",int(round(HsdB,2))," |"
f= 50000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",round(HsdB,2)," |"
f= 100000 # in Hz
omega= 2*pi*f # in rad/sec
HsdB= 20*log10(Af/sqrt(1+(omega/omega_c)**4))
print "| ",int(f)," ",round(HsdB,2)," |"
print "-----------------------------------------------------------------------------------------"
```

In [97]:

```
#Given data
f_c = 1 # in kHz
f_c = f_c * 10**3 # in Hz
C = 0.1 # in µF
print "The value of C = %0.1f µF" %C
C = C * 10**-6 # in F
R = 1/(2*pi*f_c*C) # in ohm
print "The value of R = %0.3f kΩ" %(R*10**-3)
Q1 = 1/0.765
alpha1 = 1/Q1
Q2 = 1/1.848
alpha2 = 1/Q2
A_F1 = 3-alpha1
A_F2 = 3-alpha2
R_i =10*10**3 # in ohm
R_F = (A_F1-1)*R_i # in ohm
print "For first stage the value of R_F = %0.2f kΩ" %(R_F*10**-3)
R_i = 100*10**3 # ohm
R_F = (A_F2-1)*R_i # in ohm
print "For second stage the value of R_F = %0.1f kΩ" %(R_F*10**-3)
```

In [99]:

```
#Given data
f_c = 10 # in kHz
f_c = f_c *10**3 # in Hz
C = 0.0047 # in µF
C = C * 10**-6 # in F
R = 1/(2*pi*f_c*C) # in ohm
R = R * 10**-3 # in k ohm
print "The value of R = %0.3f kΩ" %R
```

In [103]:

```
#Given data
R = 15 # in k ohm
R = R *10**3 # in ohm
C = 0.01 # in µF
C = C * 10**-6 # in F
f_c = 1/(2*pi*R*C) # in Hz
f_c= round(f_c)
print "Cut off frequency = %0.f Hz" %f_c
Omega_c = 2*pi*f_c # in rad/sec
print "The value of omega_c = %0.3f k rad/sec" %(Omega_c*10**-3)
# Note: There is calculation error to find the value of omega_c. So the answer in the book is wrong
```

In [105]:

```
#Given data
R1 = 27 # in k ohm
R1 = R1 * 10**3 # in ohm
R2 = R1 # in ohm
R3 = R2 # in ohm
R = R1 # in ohm
R_L = 10 # in k ohm
R_F = 16 # in k ohm
C2 = 0.005 # in µF
C2 = C2 * 10**-6 # in F
C3 = C2 # in F
C = C3 # in F
f_c = 1/(2*pi*R*C) # in Hz
f_c = f_c * 10**-3 # in kHz
R1= R1*10**-3 # in kohm
print "Cut off frequency = %0.2f kHz" %f_c
A_F = 1+(R_F/R1)
print "Voltage gain = %0.3f" %A_F
```

In [107]:

```
#Given data
alpha = 1.732
k_f = 1.274
C1 = 1 # in F
C2 = C1 # in F
R1 = alpha/2 # in ohm
R2 = 2/alpha # in ohm
R_F = R2 # in ohm
f_3dB = 2 # in kHz
f_3dB = f_3dB * 10**3 # in Hz
f_c = f_3dB/k_f # in Hz
Omega_c = 2*pi*f_c # in rad/sec
R1 = R1/Omega_c # in ohm
R1 = R1 * 10**8 # in ohm
R2 = R2/Omega_c # in ohm
R2 = R2 * 10**8 # in ohm
R_F = R2 # in ohm
C1 = C1/10**8 # in F
print "The value of R1 = %0.4f kΩ" %(R1*10**-3)
print "The value of R2 = R_F = %0.3f kΩ" %(R2*10**-3)
print "The value of C1 = C2 = %0.f nF" %(C1*10**9)
```

In [111]:

```
from math import sqrt
#Given data
Cdesh = 0.01 # in µF
Cdesh= Cdesh* 10**-6 # in F
f_H = 1 # in kHz
f_H = f_H * 10**3 # in Hz
Rdesh= 1/(2*pi*f_H*Cdesh) # in ohm
A_F2 = 2
R1desh = 10*10**3 # in ohm
Rdesh_F= R1desh # in ohm
print "(i) Low-pass Filter Components : "
print "The value of R1' = %0.f kΩ" %(R1desh*10**-3)
print "The value of R' = %0.1f kΩ" %(Rdesh*10**-3)
print "The value of R'F = %0.f kΩ" %(Rdesh_F*10**-3)
print "The value of C = %0.2f µF" %(Cdesh*10**6)
C = 0.05 # in µF
C = C * 10**-6 # in F
f_L = 100 # in Hz
R = 1/(2*pi*f_L*C) # in ohm
A_F1 = 2
R1 = 10*10**3 # in ohm
R_F = R1 # in ohm
print "\n(ii) High pass Filter Components"
print "The value of R1 = %0.f kΩ" %(R1*10**-3)
print "The value of R = %0.3f kΩ" %(R*10**-3)
print "The value of R_F = %0.f kΩ" %(R_F*10**-3)
print "The value of C = %0.2f µF" %(C*10**6)
Q = sqrt(f_H*f_L)/(f_H-f_L)
print "The quality factor = %0.3f" %Q
# Note : In High pass filter components, the value of R is calculated 31.83 kΩ but at last it is writter as 3.183 kΩ
# so the answer of R in High pass filter components is wrong.
```

In [113]:

```
#Given data
f_c = 2 # in kHz
f_c = f_c * 10**3 # in Hz
A_F = 10
Q = 4
C = 0.01 # in µF
C = C * 10**-6 # in F
R1 = Q/(2*pi*f_c*C*A_F) # in ohm
R1 = R1 * 10**-3 # in k ohm
print "The value of R1 =",round(R1,3),"kΩ (standard value 3.3 kΩ)"
R2 = Q/(2*pi*f_c*C*(2*Q**2-A_F)) # in ohm
R2 = R2 * 10**-3 # in k ohm
print "The value of R2 =",round(R2,3),"kΩ (standard value 1.5 kΩ)"
R3 = Q/(pi*f_c*C) # in ohm
R3 = R3 * 10**-3 # in k ohm
print "The value of R3 =", round(R3,2),"kΩ (standard value 63 kΩ)"
f_c1 = 1 # in kHz
Rdesh2 = R2*(((f_c*10**-3)/f_c1)**2) # in k ohm
print "The value of R'2 =", round(Rdesh2,3),"kΩ (standard value 5.8 kΩ)"
```

In [117]:

```
#Given data
f_H = 100 # in Hz
f_L = 2 # in kHz
f_L = f_L * 10**3 # in Hz
C = 0.01 # in µF
C = C * 10**-6 # in F
R = 1/(2*pi*f_L*C) # in ohm
R = R * 10**-3 # in k ohm
A_F = 2
R1 = 10 # in k ohm
# A_F= 1+R_F/R1 or
R_F= (A_F-1)*R1 # in k ohm
print "(i) High-pass Section Components : "
print "The value of C = %0.2f µF" %(C*10**6)
print "The value of R = %0.2f kΩ" %R
print "The value of R_F = R1 = %0.f kΩ" %R_F
Cdesh = 0.1 # in µF
Cdesh= Cdesh* 10**-6 # in F
Rdesh = 1/(2*pi*f_H*Cdesh) # in ohm
Rdesh= Rdesh * 10**-3 # in k ohm
Rdesh1 = 10 # in k ohm
Rdesh_F= Rdesh1 # in k ohm
print "\n(ii) Low-pass Section components : "
print "The value of C' = %0.1f µF" %(Cdesh*10**6)
print "The value of R' = %0.3f kΩ" %Rdesh
print "The value of R'F = R'1 = %0.f kΩ" %Rdesh_F
R2 = 10 # in k ohm
R3 = R2 # in k ohm
R4 = R2 # in k ohm
R_OM = (R2*R3*R4)/(R2*R3+R3*R4+R4*R2) # in k ohm
print "\n(iii) Summing Amplifier component"
print "The value of R_OM = %0.1f kΩ" %R_OM
```

In [119]:

```
#Given data
f_N = 50 # in Hz
C = 0.47 # in µF
C = C * 10**-6 # in F
R = 1/(2*pi*f_N*C) # in ohm
R = R * 10**-3 # in k ohm
print "The value of Resistance = %0.3f kohm" %R
```

In [140]:

```
from math import atan
#Given data
R = 10 # in k ohm
R = R * 10**3 # in ohm
C = 0.01 # in µF
C = C * 10**-6 # in F
f = 2 # in kHz
f = f * 10**3 # in Hz
Phi = -2*atan(2*pi*R*C*f)*180/pi # in degree
print "The phase shift = %0.2f degree" %Phi
```

In [142]:

```
#Given data
f_L = 200 # in Hz
f_H = 1 # in kHz
f_H = f_H * 10**3 # in Hz
f_c = sqrt(f_H*f_L) # in Hz
print "The center frequency = %0.1f Hz" %f_c
Q = f_c/(f_H-f_L)
print "Quality factor = %0.3f" %Q
```

In [146]:

```
#Given data
f1 = 5 # in kHz
f1 = f1 * 10**3 # in Hz
f2 = 15 # in kHz
f2 = f2 * 10**3 # in Hz
Cdesh = 0.01 # in µF
Cdesh= Cdesh * 10**-6 # in F
Rdesh = 1/(2*pi*f2*Cdesh) # in ohm
A_F1 = 1.414
A_F2 = A_F1
Rdesh1 = 10 # in k ohm
Rdesh_F = (A_F1-1)*Rdesh1 # in k ohm
print "(i) Low pass Filter components : "
print "The value of R'1 = %0.f kΩ" %Rdesh1
print "The value of R' = %0.3f kΩ" %(Rdesh*10**-3)
print "The value of R'F = %0.2f kΩ" %Rdesh_F
print "The value of C' = %0.2f µF" %(Cdesh*10**6)
C = 0.05 # in µF
C = C * 10**-6 # in F
R = 1/(2*pi*f1*C) #in ohm
R1 = 10 # in k ohm
R_F = (A_F1-1)*R1 # in k ohm
print "\n(ii) High pass Filter components : "
print "The value of R1 = %0.f kΩ" %R1
print "The value of R = %0.2f Ω" %R
print "The value of R_F = %0.2f kΩ" %R_F
print "The value of C = %0.2f µF" %(C*10**6)
```