{ "metadata": { "name": "", "signature": "sha256:c1b2528db2720418783c3dceac0aaa6b8c59f82b11d59cc3bcd5977ffc3ae345" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter06 : Active Filters" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.2 : page 250" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi\n", "# given data \n", "R=10 #in Kohm\n", "C=0.01 #in uF\n", "R1=4.7 #in Kohm\n", "RF=47 #in Kohm\n", "fc=1/(2*pi*R*1000*C*10**-6) #in Hz\n", "AF=1+RF/R1 #unitless\n", "print \"Cut-off frequency = %0.2f kHz\" %(fc/1E3)\n", "print \"Pass band gain =\",AF" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Cut-off frequency = 1.59 kHz\n", "Pass band gain = 11.0\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.3 : page 250" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi, ceil\n", "# given data \n", "fc=2 #in KHz\n", "AF=2 #unitless\n", "# let C=0.01 uF\n", "C=0.01 #in uF\n", "R=(1/(2*pi*fc*1E3*C*1E-6))/1E3 #in Kohm\n", "R=ceil(R) \n", "# Bias compensation Rbc\n", "# Rbc=R1*RF/(R1+RF) ohm\n", "# R=R1*RF/(R1+RF)=Rdash/2 ohm \n", "#Rdash=R1=RF=2*R #in ohm\n", "Rdash=2*R #in ohm\n", "R1=2*R #in ohm\n", "RF=2*R #in ohm\n", "R1=RF #in kohm\n", "print \"Component values are :\" \n", "print \"R1 = RF = %0.2f kohm\" %(R1)\n", "print \"R = %0.2f kohm\"%R" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Component values are :\n", "R1 = RF = 16.00 kohm\n", "R = 8.00 kohm\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.4 : page 251" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "# given data \n", "fc_original=2 #in KHz\n", "fc_new=3 #in KHz\n", "R_original=8 #in Kohm\n", "R_new=fc_original*R_original/fc_new #in Kohm\n", "print \"New value of resistance = %0.2f ohm\"%R_new" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "New value of resistance = 5.33 ohm\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.5 : page 254" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "fc=1 #in KHz\n", "AF=2 #unitless\n", "# let C=0.01 uF\n", "C=0.01 #in uF\n", "R=(1/(2*pi*fc*1000*C*10**-6))/1000 #in Kohm\n", "#For Bias compensation\n", "#Rbc=R1*RF/(R1+RF) ohm\n", "#R=R1*RF/(R1+RF)=Rdash/2 ohm\" \n", "#Rdash=R1=RF=2*R #in ohm\n", "Rdash=2*R #in ohm\n", "R1=2*R #in ohm\n", "RF=2*R #in ohm\n", "R1=RF #in kohm\n", "print \"Component values are :\" \n", "print \"R1 = RF = %0.1f kohm\" %(R1)\n", "print \"R = %0.1f kohm\"%R " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Component values are :\n", "R1 = RF = 31.8 kohm\n", "R = 15.9 kohm\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.6 : page 260" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# given data \n", "AF=5 #unitless\n", "fc=1 #in KHz\n", "alfa=1.414 #unitless\n", "# assume C2=0.1 uF\n", "C2=0.1 #in uF\n", "C3=(C2*alfa**2)/4 # in uF\n", "R=1/(2*pi*fc*10**3*sqrt(C2*10**-6*C3*10**-6)) #in ohm\n", "#Take RF=10 Kohm\n", "RF=10 #in Kohm\n", "R1=RF/(AF-1) #in Kohm\n", "print \"Value of R = %0.2f kohm\"%(R/1E3)\n", "print \"Value of RF = %0.2f kohm\" %(RF)\n", "print \"Value of R1 = %0.2f kohm\"%R1" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of R = 2.25 kohm\n", "Value of RF = 10.00 kohm\n", "Value of R1 = 2.50 kohm\n" ] } ], "prompt_number": 9 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.7 : page 261" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# given data \n", "C2=0.1 #in uF\n", "C3=0.0333 #in uF\n", "alfa=2*sqrt(C3/C2) #unitless\n", "print \"Value of alfa = %0.2f\" %alfa \n", "print \"This filter is situated between Butterworth and the Chebyshev, hence approximating Klp=1.1\" \n", "Klp=1.1 #unitless\n", "R=2.25 #in Kohm\n", "f3dB=Klp/(2*pi*R*sqrt(C2*C3)) #in KHz\n", "print \"f3dB = %0.2f kHz\" %f3dB\n", "#Note : Answer in the book is wrong" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of alfa = 1.15\n", "This filter is situated between Butterworth and the Chebyshev, hence approximating Klp=1.1\n", "f3dB = 1.35 kHz\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.8 : page 261" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi\n", "# given data \n", "Klp=1 #unitless# it is 1 for butterworth filter\n", "alfa=1.414 #unitless# it is 1.414 for butterworth filter\n", "fc=1 #in KHz\n", "R=15.9 #in Kohm\n", "# assume C=0.01 uF\n", "C=0.01 #in uF\n", "R=Klp/(2*pi*fc*1000*C*10**-6) # in ohm\n", "AF=3-alfa #unitless\n", "R1=2*R/0.369 #in Kohm\n", "RF=(AF-1)*R1 #in Kohm\n", "A2=5/AF #unitless\n", "print \"Value of RF = %0.2f kohm\" %(RF/1000)\n", "print \"Gain of this amplifier = %0.2f \"%A2 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of RF = 50.55 kohm\n", "Gain of this amplifier = 3.15 \n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.9 : page 262" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "from math import pi\n", "# given data \n", "R2=20 #in Kohm\n", "R3=20 #in Kohm\n", "R=R2 #in Kohm\n", "C2=0.47 #in uF\n", "C3=0.47 #in uF\n", "C=C2 #in uF\n", "RF=56 #in Kohm\n", "R1=56 #in Kohm\n", "AF=1+RF/R1 #unitless\n", "alfa=3-AF #unitless\n", "Klp=1.238 #unitless\n", "print \"Value of alfa = %0.2f\" %alfa \n", "print \"alfa=1 corresponds to chebyshev filter response.\" \n", "f3dB=Klp/(2*pi*R*1000*C*10**-6) #in Hz\n", "print \"Critical frequency = %0.2f Hz\" %(f3dB)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of alfa = 1.00\n", "alfa=1 corresponds to chebyshev filter response.\n", "Critical frequency = 20.96 Hz\n" ] } ], "prompt_number": 12 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.10 : page 263" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi\n", "# given data \n", "fc=2 #in kHz\n", "alfa=1.414 #unitless\n", "Klp=1 #unitless\n", "#assume C=0.01 uF\n", "C=0.01 #in uF\n", "R=Klp/(2*pi*fc*1000*C*10**-6) #in ohm\n", "AF=3-alfa #unitless\n", "R1=2*R/0.369 #in ohm\n", "RF=0.586*R1 #in ohm\n", "print \"Design components values are :\" \n", "print \"Value of R1 = %0.2f kohm\"%(R1/1000)\n", "print \"Value of RF = %0.2f kohm\"%(RF/1000)\n", "print \"Value of R2=R3=R= %0.2f kohm\" %(R/1000)\n", "print \"Value of C2=C3=C= %0.2f uF\" %(C)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Design components values are :\n", "Value of R1 = 43.13 kohm\n", "Value of RF = 25.28 kohm\n", "Value of R2=R3=R= 7.96 kohm\n", "Value of C2=C3=C= 0.01 uF\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.11 : page 267" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "C=0.1 #in uF\n", "R=11 #in Kohm\n", "RF=5.6 #in Kohm\n", "R1=10 #in Kohm\n", "AF=1+RF/R1 #unitless\n", "alfa=3-AF #unitless\n", "Klp=1 #unitless# for Butterworth filter\n", "Khp=1/Klp #unitless\n", "f3dB=Khp/(2*pi*R*1000*C*10**-6) #in Hz\n", "print \"3 dB frequency = %0.2f Hz\"%(f3dB)\n", "print \"Value of alfa = %0.2f\"%alfa \n", "print \"Value of alfa shows that it is a Butterworth flter.\" \n", "print \"Passband gain for a high pass filter = %0.2f\"%Khp" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "3 dB frequency = 144.69 Hz\n", "Value of alfa = 1.44\n", "Value of alfa shows that it is a Butterworth flter.\n", "Passband gain for a high pass filter = 1.00\n" ] } ], "prompt_number": 14 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.12 : page 267" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi\n", "# given data \n", "fc=2 #in KHz\n", "alfa=1.414 #unitless\n", "Klp=1 #unitless\n", "#assume C=0.01 uF\n", "C=0.01 #in uF\n", "R=Klp/(2*pi*fc*1000*C*10**-6) #in ohm\n", "AF=3-alfa #unitless\n", "R1=2*R/0.369 #in ohm\n", "RF=0.586*R1 #in ohm\n", "print \"Design components values are :\" \n", "print \"Value of R1 = %0.2f kohm\" %(R1/1000)\n", "print \"Value of RF = %0.2f kohm\" %(RF/1000)\n", "print \"Value of R2=R3=R= %0.2f kohm \" %(R/1000)\n", "print \"Value of C2=C3=C= %0.2f uF\" %(C)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Design components values are :\n", "Value of R1 = 43.13 kohm\n", "Value of RF = 25.28 kohm\n", "Value of R2=R3=R= 7.96 kohm \n", "Value of C2=C3=C= 0.01 uF\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.13 : page 270" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import pi, sqrt\n", "# given data \n", "fL=200 #in Hz\n", "fH=1 #in KHz\n", "AFBP=4 #unitless\n", "#for LP section design\n", "#assume C=0.01 uF\n", "C=0.01 #in uF\n", "R=1/(2*pi*fH*1000*C*10**-6) #in ohm\n", "print \"For low pass section design component values are :\" \n", "print \"Value of R = %0.1f kohm\" %(R/1000)\n", "print \"Value of C = %0.2f uF \"%C\n", "#for HP section design\n", "#assume C=0.05 uF\n", "C=0.05 #in uF\n", "R=1/(2*pi*fL*1000*C*10**-6) #in ohm\n", "print \"For high pass section design component values are :\" \n", "print \"Value of R = %0.1f kohm\" %R\n", "print \"Value of C = %0.2f uF\"%C\n", "print \"We have AFBP=AFHP*AFLP=4\" \n", "print \"R=10 kohm\" \n", "fc=sqrt(fH*fL*1000) #in Hz\n", "BW=fH*1000-fL #in Hz\n", "Q=fc/BW #unitless\n", "print \"Center frequency = %0.2f Hz\"%fc\n", "print \"BW = %0.2f Hz\"%BW\n", "print \"Selectivity = %0.2f\" %Q\n", "print \"As Q<10, hence the given filter is wide band pass filter.\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "For low pass section design component values are :\n", "Value of R = 15.9 kohm\n", "Value of C = 0.01 uF \n", "For high pass section design component values are :\n", "Value of R = 15.9 kohm\n", "Value of C = 0.05 uF\n", "We have AFBP=AFHP*AFLP=4\n", "R=10 kohm\n", "Center frequency = 447.21 Hz\n", "BW = 800.00 Hz\n", "Selectivity = 0.56\n", "As Q<10, hence the given filter is wide band pass filter.\n" ] } ], "prompt_number": 19 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.14 : page 274" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import sqrt, pi\n", "# given data \n", "fL=2 #in KHz\n", "fH=2.5 #in KHz\n", "AF=-5 #unitless\n", "fc=sqrt(fH*1000*fL*1000) #in Hz\n", "BW=fH*1000-fL*1000 #in Hz\n", "Q=fc/BW #unitless\n", "print \"Center frequency = %0.f Hz\"%fc\n", "print \"BW = %0.2f Hz\"%BW\n", "print \"Selectivity = %0.3f \" %Q \n", "#assume C=0.01 uF\n", "C=0.01 #in uF\n", "R2=2/(2*pi*C*10**-6*BW) #in Kohm\n", "R1=-R2/(2*AF) #in KOhm\n", "R3=R1/((4*pi*pi*R1*R2*fc*1000*fc*1000*C*C*10**-12)-1) #in Kohm\n", "print \"Value of R1 = %0.2f kohm \"%(R1/1000)\n", "print \"Value of R2 = %0.2f kohm \"%(R2/1000)\n", "print \"Value of R3 = %0.2f ohm \"%(R3*1000)\n", "print \"Value of C = %0.2f uF\" %C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Center frequency = 2236 Hz\n", "BW = 500.00 Hz\n", "Selectivity = 4.472 \n", "Value of R1 = 6.37 kohm \n", "Value of R2 = 63.66 kohm \n", "Value of R3 = 0.80 ohm \n", "Value of C = 0.01 uF\n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.15 : page 276" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# given data \n", "AF=-10 #unitless\n", "Q=20 #unitless\n", "fc=50 #in Hz\n", "fc1=fc #in Hz\n", "fc2=fc #in Hz\n", "fc3=fc #in Hz\n", "Q1=0.51*Q #unitless\n", "Q2=0.51*Q #unitless\n", "Q3=0.51*Q #unitless\n", "AF1=-(-AF)**(1/3) #unitless\n", "print \"A single op-amp band passed filter can be design with specifications :\" \n", "print \"Center frequency = %0.2f Hz\" %fc\n", "print \"AF1 = %0.2f \"%AF1 \n", "print \"Q1 = %0.2f \"%Q1 " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A single op-amp band passed filter can be design with specifications :\n", "Center frequency = 50.00 Hz\n", "AF1 = -2.15 \n", "Q1 = 10.20 \n" ] } ], "prompt_number": 23 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.16 : page 282" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from math import tan, pi\n", "# given data \n", "f=2 #in KHz\n", "fi_degree=-135 #in degree\n", "fi_radian=fi_degree*(pi/180) \n", "print \"A phase shift of -135 degree is achieved by an all pass phase lag filter.\" \n", "#assume C=0.1 uF and R1=RF=10 Kohm\n", "C=0.1 #in uF\n", "R1=10 #in Kohm\n", "RF=10 #in Kohm\n", "R=tan(-fi_radian/2)/(2*pi*f*1000*C*10**-6) \n", "print \"Component values are :\" \n", "print \"Value of R1 = %0.2f kohm \"%R1\n", "print \"Value of RF = %0.2f kohm\"%RF\n", "print \"Value of R = %0.2f kohm \" %(R/1000)\n", "print \"Value of C = %0.2f uF \"%C" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A phase shift of -135 degree is achieved by an all pass phase lag filter.\n", "Component values are :\n", "Value of R1 = 10.00 kohm \n", "Value of RF = 10.00 kohm\n", "Value of R = 1.92 kohm \n", "Value of C = 0.10 uF \n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Exa 6.17 : page 286" ] }, { "cell_type": "code", "collapsed": false, "input": [ " # given data \n", "R=10 #in Kohm\n", "R1=R #in Kohm\n", "R2=R #in Kohm\n", "R3=R #in Kohm\n", "Rf=5.6 #in Kohm\n", "R4=Rf #in Kohm\n", "R5=Rf #in Kohm\n", "RA=2.7 #in Kohm\n", "RB=1.5 #in Kohm\n", "C=0.01 #in uF\n", "C1=C #in uF\n", "C2=C #in uF\n", "alfa=3*RB/(RA+RB) \n", "print \"Value of alfa = %0.2f\"%alfa \n", "print \"This value correspondes to the chebyshev response.\" \n", "C=0.01 #in uF\n", "C1=C #in uF\n", "C2=C #in uF\n", "fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz\n", "Klp=1.238 #unitless\n", "fH=fc*Klp #in Hz\n", "Khp=1/Klp #unitless\n", "fL=fc*Khp#in Hz\n", "print \"Critical frequency = %0.2f kHz\"%(fc/1000)\n", "print \"High cut-off frequency = %0.2f kHz\" %(fH/1000)\n", "print \"Low cut-off frequency = %0.2f kHz \"%(fL/1000)\n", "C=0.01 #in uF\n", "C1=C #in uF\n", "C2=C #in uF\n", "fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz\n", "print \"Band pass center frequency = %0.2f kHz\" %(fc/1000)\n", "C=0.01 #in uF\n", "C1=C #in uF\n", "C2=C #in uF\n", "alfa=3*RB/(RA+RB) #unitless\n", "Q=1/alfa #unitless\n", "fc=1/(2*pi*Rf*1000*C*10**-6) #in Hz\n", "BW=fc/Q #in Hz\n", "print \"Band pass bandwidth = %0.2f kHz\" %(BW/1000)\n", "C=0.01 #in uF\n", "C1=C #in uF\n", "C2=C #in uF\n", "alfa=3*RB/(RA+RB) #in unitless\n", "Q=1/alfa #in unitless\n", "print \"The band pass gain at center frequency = %0.3f \"%Q " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Value of alfa = 1.07\n", "This value correspondes to the chebyshev response.\n", "Critical frequency = 2.84 kHz\n", "High cut-off frequency = 3.52 kHz\n", "Low cut-off frequency = 2.30 kHz \n", "Band pass center frequency = 2.84 kHz\n", "Band pass bandwidth = 3.05 kHz\n", "The band pass gain at center frequency = 0.933 \n" ] } ], "prompt_number": 27 } ], "metadata": {} } ] }