{ "metadata": { "name": "", "signature": "sha256:f8c6689b27d28f641fc8e24d065a4f69d8ad2a49bb0688697280bb451473eab1" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter-7 Active Filters" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.1 - Page 204" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import pi\n", "from __future__ import division\n", "# Given data\n", "f_H= 2*10**3 #cut-off frequency in Hz\n", "C= 0.01*10**-6 # in F\n", "passband_gain= 2.5 \n", "R= 1/(2*pi*f_H*C) # in \u03a9\n", "R= 8.2 # in k\u03a9 (standard value)\n", "# 1+Rf/R1= passband_gain or Rf should be equal to 1.5*R1 since Rf||R1= R\n", "R1= passband_gain/1.5*R # in k\u03a9\n", "print \"The value of R1 = %0.2f k\u03a9 (Standard value 15 k\u03a9)\" %R1 \n", "Rf= int(1.5*R1) # in k\u03a9\n", "print \"The value of Rf = %0.f k\u03a9\" % Rf" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R1 = 13.67 k\u03a9 (Standard value 15 k\u03a9)\n", "The value of Rf = 20 k\u03a9\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.2 - Page 207" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_H= 2*10**3 #cut-off frequency in Hz\n", "C= 0.033*10**-6 # in F\n", "R= 1/(2*pi*f_H*C) # in \u03a9\n", "# 2*R= Rf*R1/(Rf+R1)= 0.586*R1**2/(1.586*R1) since Rf= 0.586*R1\n", "R1= 2*R*1.586/0.586 # in \u03a9\n", "R1= round(R1*10**-3) # in k\u03a9\n", "print \"The value of R1 = %0.f k\u03a9 (Standard value 15 kohm)\" %R1\n", "R1= 15 # in k\u03a9\n", "Rf= R1*0.586 # in k\u03a9\n", "#Rf= floor(1.5*R1) # in k\u03a9\n", "print \"The value of Rf = %0.2f k\u03a9\" %Rf\n", "print \"(The value of Rf may be taken as a pot of 10 k\u03a9)\" " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R1 = 13 k\u03a9 (Standard value 15 kohm)\n", "The value of Rf = 8.79 k\u03a9\n", "(The value of Rf may be taken as a pot of 10 k\u03a9)\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.3 - Page 207" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_H= 1*10**3 #cut-off frequency in Hz\n", "C= 0.0047*10**-6 # in F\n", "R= 1/(2*pi*f_H*C) # in \u03a9\n", "R= (R*10**-3) # in k\u03a9\n", "R1= 30 # in k\u03a9 (assume)\n", "Rf= 0.586*R1 # in k\u03a9\n", "C= C*10**6 # in \u00b5F\n", "print \"The value of R'= R = %0.2f k\u03a9 (standard value 33 k\u03a9)\" %R\n", "print \"The value of C'= C = %0.4f \u00b5F \" %C\n", "print \"The value of R1= %0.2f k\u03a9 \" %R1 \n", "print \"The value of Rf= %0.2f k\u03a9 (standard value 20 k\u03a9 pot)\" %Rf " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R'= R = 33.86 k\u03a9 (standard value 33 k\u03a9)\n", "The value of C'= C = 0.0047 \u00b5F \n", "The value of R1= 30.00 k\u03a9 \n", "The value of Rf= 17.58 k\u03a9 (standard value 20 k\u03a9 pot)\n" ] } ], "prompt_number": 6 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.4 - Page 212" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Given data\n", "fc= 1*10**3 # in Hz\n", "alpha= 1.414 \n", "C= 0.1*10**-6 # in F (assume)\n", "C_desh= C*alpha**2/4 # in F\n", "C_desh= C_desh*10**6 # in \u00b5F\n", "print \"The value of C' = %0.2f \u00b5F\" %C_desh\n", "C_desh= C_desh*10**-6 # in F\n", "R_desh= 1/(2*pi*fc*math.sqrt(C*C_desh)) # in \u03a9\n", "R_desh= R_desh*10**-3 # in k\u03a9\n", "print \"The value of R' = %0.2f k\u03a9 (standard value 2.2 k\u03a9)\"%R_desh" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of C' = 0.05 \u00b5F\n", "The value of R' = 2.25 k\u03a9 (standard value 2.2 k\u03a9)\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.5 - Page 213" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "alpha= 1.414 # passband\n", "C= 0.01*10**-6 # in F (assume)\n", "fc= 1*10**3 # in Hz\n", "dc_gain= 6 \n", "R= 1/(2*pi*C*fc) # in \u03a9\n", "R= R*10**-3 # in k\u03a9\n", "print \"The value of R = %0.1f k\u03a9 (standard value 15 k\u03a9)\" %R\n", "R= 15 # in k\u03a9\n", "Af= 3-alpha # and Af= 1+Rf/R1 or\n", "# Rf= (Af-1)*R1 (i)\n", "# 2*R= Rf || R1, hence from (i)\n", "R1= 2*R*Af/(Af-1) # in k\u03a9\n", "print \"The value of R1 = %0.1f k\u03a9 (standard value 82 k\u03a9)\" %R1\n", "R1= 82 # in k\u03a9\n", "Rf= (Af-1)*R1 # in k\u03a9\n", "print \"The value of Rf = %0.f k\u03a9 (standard value 47 k\u03a9)\" %Rf\n", "Aamp= dc_gain/Af \n", "print \"The value of Aamp = %0.2f\" %Aamp" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R = 15.9 k\u03a9 (standard value 15 k\u03a9)\n", "The value of R1 = 81.2 k\u03a9 (standard value 82 k\u03a9)\n", "The value of Rf = 48 k\u03a9 (standard value 47 k\u03a9)\n", "The value of Aamp = 3.78\n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.7 - Page 221" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "R= 2.1*10**3 # in k\u03a9\n", "C= 0.05*10**-6 # in F\n", "R1= 20*10**3 # in \u03a9\n", "Rf= 60*10**3 # in \u03a9\n", "# Low cut-off frequency,\n", "f_L= 1/(2*pi*R*C) # in Hz\n", "f_L= f_L*10**-3 # in kHz\n", "print \"The cut-off frequency = %0.3f kHz\" %f_L" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The cut-off frequency = 1.516 kHz\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.8 - Page 225" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "from __future__ import division\n", "# Given data\n", "R1= 2*10**3 # in \u03a9\n", "R2= 2/3*10**3 # in \u03a9\n", "R3= 200*10**3 # in \u03a9\n", "C= 0.1*10**-6 # in F\n", "Af= R3/(2*R1) # gain\n", "print \"The value of Af = %0.f\" %Af\n", "# R1= Q/(2*pi*f_C*C*Af) (i)\n", "# R2= Q/(2*pi*f_C*C*(2*Q**2-Af)) (ii)\n", "# R3= Q/(pi*f_C*C) (iii)\n", "Q= math.sqrt((R3/(2*R2)+Af)/2) # from (ii) and (iii)\n", "print \"The value of Q = %0.f\" %Q\n", "f_C= Q/(R3*pi*C) # in Hz (from (iii))\n", "print \"The value of f_C = %0.f Hz\" %f_C\n", "omega_0= 2*pi*f_C # in radians/second\n", "print \"The value of omega_0 = %0.f radians/seconds\" %omega_0" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of Af = 50\n", "The value of Q = 10\n", "The value of f_C = 159 Hz\n", "The value of omega_0 = 1000 radians/seconds\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.10 - Page 227" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_L= 2*10**3 # in Hz\n", "f_H= 2.5*10**3 # in Hz\n", "Af= -5 \n", "f_C= math.sqrt(f_L*f_H) # centre frequency in Hz\n", "del_f= f_H-f_L #bandwidth in Hz\n", "Q= f_C/del_f # selectivity\n", "# Assume C1= C2= C= 0.01\u00b5F\n", "C= 0.01*10**-6 # in F\n", "R3= 1/(pi*del_f*C) # in \u03a9\n", "R3= R3*10**-3 # in k\u03a9\n", "print \"The value of R3 = %0.2f k\u03a9 (standard value 64 k\u03a9)\" %R3\n", "R3= 64 # in k\u03a9\n", "R3= R3*10**3 # in \u03a9\n", "R1= -R3/(2*Af) #in \u03a9\n", "R2= R1/(4*pi**2*f_C**2*R1*R3*C**2-.1)\n", "R1= R1*10**-3 # in k\u03a9\n", "C=C*10**6 # in \u00b5F\n", "print \"The value of R1 = %0.1f k\u03a9 \" %R1\n", "print \"The value of R2 = %0.f k\u03a9 (standard value 800\u03a9)\" %R2\n", "print \"The value of C = %0.2f \u00b5F \" %C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R3 = 63.66 k\u03a9 (standard value 64 k\u03a9)\n", "The value of R1 = 6.4 k\u03a9 \n", "The value of R2 = 801 k\u03a9 (standard value 800\u03a9)\n", "The value of C = 0.01 \u00b5F \n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.11 - Page 228 " ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_C= 1*10**3 #centre frequency in Hz\n", "f_C_desh= 2*10**3 #new centre frequency in Hz\n", "Q= 5 # selectivity\n", "Af= -8 \n", "C= 0.01*10**-6 # in F (assume)\n", "R3= Q/(pi*f_C*C) #in \u03a9\n", "R3= R3*10**-3 # in k\u03a9\n", "print \"The value of R3 = %0.1f k\u03a9 (160 k\u03a9 (approx))\" %R3\n", "R1= round(-R3/(2*Af)) # in k\u03a9\n", "print \"The value of R1 = %0.f k\u03a9\" %R1\n", "R2= R1*10**3/(4*pi**2*f_C**2*R1*10**3*R3*10**3*C**2-1) # in \u03a9\n", "R2= R2*10**-3 # in k\u03a9\n", "print \"The value of R2 = %0.2f k\u03a9 (2 k\u03a9 (approx))\" %R2\n", "R2= 2 # in k\u03a9 (approx)\n", "R2_desh= R2*(f_C/f_C_desh)**2 # in k\u03a9\n", "R2_desh= R2_desh*10**3 # in \u03a9\n", "print \"The value of R2' = %0.f \u03a9\" %R2_desh" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R3 = 159.2 k\u03a9 (160 k\u03a9 (approx))\n", "The value of R1 = 10 k\u03a9\n", "The value of R2 = 1.89 k\u03a9 (2 k\u03a9 (approx))\n", "The value of R2' = 500 \u03a9\n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.12 - Page 229" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "R= 10*10**3 # in \u03a9\n", "C1= 0.1*10**-6 # in F \n", "C2= 0.0025*10**-6 # in F \n", "f_H= 1/(2*pi*R*C2) #higher cut-off frequency in Hz\n", "f_H= f_H*10**-3 # in kHz\n", "f_L= 1/(2*pi*R*C1) #lower cut-off frequency in Hz\n", "BW= f_H-f_L*10**-3 # bandwidth in kHz\n", "print \"The higher cut-off frequency = %0.3f kHz\" %f_H\n", "print \"The lower cut-off frequency = %0.2f Hz\" %f_L\n", "print \"The bandwidth = %0.1f kHz\" %BW" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The higher cut-off frequency = 6.366 kHz\n", "The lower cut-off frequency = 159.15 Hz\n", "The bandwidth = 6.2 kHz\n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.13 - Page 230" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_L= 200 # in Hz\n", "f_H= 1*10**3 # in Hz\n", "alpha=4 # passband gain\n", "C_desh= 0.01*10**-6 # in F (assume)\n", "R_desh= 1/(2*pi*f_H*C_desh) # in \u03a9\n", "R_desh= R_desh*10**-3 # in k\u03a9\n", "print \"The value of R' = %0.1f k\u03a9 (Standard value 20 k\u03a9)\" %R_desh\n", "R_desh= 20 # in k\u03a9 (standard value)\n", "# First Order High-Pass Filter\n", "C= 0.05*10**-6 # in F (assume)\n", "R= 1/(2*pi*f_L*C) # in \u03a9\n", "R= R*10**-3 # in k\u03a9\n", "R1= 10 # in k\u03a9\n", "Rf= R1 # in k\u03a9\n", "C_desh= C_desh*10**6 # in \u00b5F\n", "C= C*10**6 # in \u00b5F\n", "print \"The value of R = %0.1f k\u03a9 (Standard value 20 k\u03a9)\" %R\n", "R= 20 # in k\u03a9 (standard value)\n", "print \"The value of R1 and Rf = %0.f k\u03a9\" %R1\n", "print \"The value of C' = %0.2f \u00b5F\" %C_desh\n", "print \"The value of C = %0.2f \u00b5F\" %C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R' = 15.9 k\u03a9 (Standard value 20 k\u03a9)\n", "The value of R = 15.9 k\u03a9 (Standard value 20 k\u03a9)\n", "The value of R1 and Rf = 10 k\u03a9\n", "The value of C' = 0.01 \u00b5F\n", "The value of C = 0.05 \u00b5F\n" ] } ], "prompt_number": 25 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.14 - Page 231" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "f_H= 200 # in Hz\n", "f_L= 2*10**3 # in Hz\n", "C= 0.05*10**-6 # in F\n", "# For low-pass filter,\n", "R_desh= 1/(2*pi*f_H*C) # in \u03a9\n", "R_desh= R_desh*10**-3 # in k\u03a9\n", "print \"The value of R' = %0.1f k\u03a9 (standard value 20 k\u03a9)\" %R_desh\n", "# For high-pass filter,\n", "R= 1/(2*pi*f_L*C) # in \u03a9\n", "R= R*10**-3 # in k\u03a9\n", "print \"The value of R = %0.2f k\u03a9 (standard value 2 k\u03a9)\" %R" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R' = 15.9 k\u03a9 (standard value 20 k\u03a9)\n", "The value of R = 1.59 k\u03a9 (standard value 2 k\u03a9)\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.15 - Page 232" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from numpy import pi\n", "# Given data\n", "C= 0.068*10**-6 # in F\n", "f_N= 50 # in Hz\n", "R= 1/(2*pi*f_N*C) # in \u03a9\n", "R= R*10**-3 # in k\u03a9\n", "print \"The value of R = %0.1f k\u03a9 (standard value 50 k\u03a9)\" %R" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The value of R = 46.8 k\u03a9 (standard value 50 k\u03a9)\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.16 - Page 233" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "# Given data\n", "R= 15*10**3 # in \u03a9\n", "C= 0.01*10**-6 # in F\n", "f= 2*10**3 # in Hz\n", "PhaseShift= -2*(math.atan(2*pi*f*R*C))*180/pi # in \u00b0\n", "print \"The phase shift = %0.f\u00b0\" %PhaseShift\n", "print \"i.e. %0.f\u00b0 (lagging)\" %abs(PhaseShift)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The phase shift = -124\u00b0\n", "i.e. 124\u00b0 (lagging)\n" ] } ], "prompt_number": 45 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 7.18 - Page 240" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# Given data\n", "R_A= 2.2*10**3 # in \u03a9\n", "R_B= 1.2*10**3 # in \u03a9\n", "Rf= 4.7*10**3 # in \u03a9\n", "C= 0.01*10**-6 # in F\n", "k_lp= 1.238 \n", "k_hp= 1/k_lp \n", "# Part (i)\n", "alpha= 3*R_B/(R_A+R_B) \n", "print \"Part (i) : The value of alpha = %0.3f\" %alpha \n", "print \"Given filter is 1db peak Chebyshev\" \n", "\n", "# Part (ii)\n", "f_0= 1/(2*pi*Rf*C) #critical frequency in Hz\n", "f_0= f_0*10**-3 # in kHz\n", "f_low_pass= f_0*k_lp # in kHz\n", "print \"\\nPart (ii) : The low-pass frequency = %0.3f kHz\" %f_low_pass\n", "f_high_pass= f_0*k_hp # in kHz\n", "print \"The high-pass frequency = %0.3f kHz\" %f_high_pass\n", "\n", "# Part (iii)\n", "fc= f_0 # bandpass centre frequency in kHz\n", "print \"Part (iii) : The bandpass centre frequency = %0.3f kHz\" %fc\n", "\n", "# Part (iv)\n", "# Formula used : delta_f= fc/Q= fc/(1/alpha)\n", "delta_f= fc/(1/alpha) # in kHz\n", "print \"Part (iv) : The bandpass width = %0.3f kHz\" %delta_f\n", "\n", "# Part (v)\n", "A0= 1/alpha # bandpass gain at centre frequency\n", "print \"Part (v) : The bandpass gain at centre frequency = %0.4f\" %A0" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Part (i) : The value of alpha = 1.059\n", "Given filter is 1db peak Chebyshev\n", "\n", "Part (ii) : The low-pass frequency = 4.192 kHz\n", "The high-pass frequency = 2.735 kHz\n", "Part (iii) : The bandpass centre frequency = 3.386 kHz\n", "Part (iv) : The bandpass width = 3.585 kHz\n", "Part (v) : The bandpass gain at centre frequency = 0.9444\n" ] } ], "prompt_number": 47 } ], "metadata": {} } ] }