{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 11: Active Filters"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.1 Page No 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R=10       #Kohm\n",
      "C=0.001    #microF\n",
      "\n",
      "#Calculation\n",
      "wc=1/(R*10**3*C*10**-6)\n",
      "fc=wc/(6.28)\n",
      "\n",
      "#Result\n",
      "print\"The cut off frequency is\",round(fc/1000,2),\"Khz\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cut off frequency is 15.92 Khz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.2 Page No 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=2             #Frequency, khz\n",
      "C=0.005         #MicroF\n",
      "\n",
      "#Calculation\n",
      "R=1/(6.28*2*10**3*C*10**-6)\n",
      "\n",
      "#Result\n",
      "print\"The value of R is\",round(R/1000,1),\"Kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R is 15.9 Kohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.3 Page No 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=30            #rad/s, frequency\n",
      "C=0.01          #microF\n",
      "R=1/(f*10**3*C*10**-6)\n",
      "\n",
      "#Result\n",
      "print\"The value of R is\",round(R/1000,1),\"Kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R is 3.3 Kohm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.4 Page No 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=1             #Khz, cut off frequency\n",
      "C1=0.01         #MicroF\n",
      "\n",
      "#Calculation\n",
      "C2=2*C1\n",
      "R=0.707/(6.28*f*10**3*C1*10**-6)\n",
      "Rf=2*R\n",
      "\n",
      "#Result\n",
      "print\"The value of R is\",round(R,0),\"ohm\"\n",
      "print\"The value of Rf is\",round(Rf,0),\"ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R is 11258.0 ohm\n",
        "The value of Rf is 22516.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.5 Page No 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "C3=0.01         #microF, from fig 11.5 (a)\n",
      "f=1.0             #Khz, cut off frequency\n",
      "\n",
      "#Calculation\n",
      "C1=C3/2.0\n",
      "C2=2*C3\n",
      "R=1/(6.28*f*10**3*C3*10**-6)\n",
      "\n",
      "#Result\n",
      "print\"The value of C1=\",C1,\"microF\"\n",
      "print\"The value of C2=\",C2,\"microF\"\n",
      "print\"The value of R=\",round(R),\"ohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of C1= 0.005 microF\n",
        "The value of C2= 0.02 microF\n",
        "The value of R= 15924.0 ohm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.6 Page No 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "C=0.002        #microF, capacitance\n",
      "fc=10          #Khz, frequency\n",
      "\n",
      "#Calculation\n",
      "R=1/(6.28*f*10**3*C*10**-6)\n",
      "\n",
      "#Result\n",
      "print\"The value of R=\",round(R/10000),\"kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R= 8.0 kohm\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.7 Page No 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R=22.0            #kohm\n",
      "C=0.001         #microF\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "wc=1/(R*10**3*C*10**-6)\n",
      "fc=wc/(2*math.pi)\n",
      "\n",
      "#Result\n",
      "print\"The value of wc is\",round(wc/10000,2),\"krad/s\"\n",
      "print\"The value of fc is\",round(fc/10,1),\"Hz\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of wc is 4.55 krad/s\n",
        "The value of fc is 723.4 Hz\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.8 Page No 309"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "C1=0.01         #microF\n",
      "C2=C1\n",
      "f=1             #KHz, frequency\n",
      "\n",
      "#Calculation\n",
      "#From eq 11.9\n",
      "R1=1.414/(6.28*f*10**3*C1*10**-6)\n",
      "R2=R1/2.0\n",
      "\n",
      "#result\n",
      "print\"The value of R1 is\",round(R1/1000,1),\"kohm\"\n",
      "print\"The value of R2 is\",round(R2/1000,1),\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R1 is 22.5 kohm\n",
        "The value of R2 is 11.3 kohm\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.9 Page No 309"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "C1=125          #pF\n",
      "C2=C1           #KHz,cut off frequency\n",
      "f=80            #Krad/s  cutoff frequency\n",
      "\n",
      "#Calculation\n",
      "#From eq 11.9\n",
      "R1=1.414/(f*10**3*C1*10**-12)\n",
      "R2=R1/2.0\n",
      "\n",
      "#result\n",
      "print\"The value of R1 is\",round(R1/1000,0),\"kohm\"\n",
      "print\"The value of R2 is\",round(R2/1000,1),\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of R1 is 141.0 kohm\n",
        "The value of R2 is 70.7 kohm\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.10 Page No 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=159.0            #Hz, cut off frequency\n",
      "C=0.1            #microF\n",
      "C1=C\n",
      "C2=C\n",
      "C3=C\n",
      "wc=1\n",
      "\n",
      "#calculation\n",
      "R3=1/(wc*10**3*C*10**-6)\n",
      "R1=2*R3\n",
      "R2=R3/2.0\n",
      "\n",
      "#Result\n",
      "print\"(a)The value of R3 is\",round(R3/1000),\"kohm\"\n",
      "print\"(b)The value of R1 is\",round(R1/1000),\"kohm\"\n",
      "print\"(c)The value of R2 is\",round(R2/1000,0),\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The value of R3 is 10.0 kohm\n",
        "(b)The value of R1 is 20.0 kohm\n",
        "(c)The value of R2 is 5.0 kohm\n"
       ]
      }
     ],
     "prompt_number": 42
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.11 Page No 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f=60            #kHz, cut off frequency\n",
      "C=220           #pF\n",
      "C1=C\n",
      "C2=C\n",
      "C3=C\n",
      "\n",
      "#calculation\n",
      "R3=1/(6.28*f*10**3*C*10**-12)\n",
      "R1=2*R3\n",
      "R2=R3/2.0\n",
      "\n",
      "#Result\n",
      "print\"(a)The value of R3 is\",round(R3/1000,0),\"kohm\"\n",
      "print\"(b)The value of R1 is\",round(R1/1000),\"kohm\"\n",
      "print\"(c)The value of R2 is\",round(R2/1000),\"kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The value of R3 is 12.0 kohm\n",
        "(b)The value of R1 is 24.0 kohm\n",
        "(c)The value of R2 is 6.0 kohm\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.12 Page No 313"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "f1=300      # Hz, lower cutoff frequency\n",
      "f2=3000     #Hz, upper cutoff  frequency\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "B=f2-f1\n",
      "f=math.sqrt(f1*f2)\n",
      "\n",
      "#Result\n",
      "print\"The bandwidth is\",B,\"Hz\"\n",
      "print\"The frequency is\",round(f,1),\"Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The bandwidth is 2700 Hz\n",
        "The frequency is 948.7 Hz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.13 Page No 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "fr=950     #Hz, resonant frequency\n",
      "B=2700     #Hz\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "fl=math.sqrt(B**2/4.0+fr**2)-B/2.0\n",
      "fh=fl+B\n",
      "\n",
      "#Result\n",
      "print\"The lower cutoff frequency is\",round(fl,1),\"Hz\"\n",
      "print\"The upper cutoff frequency is\",round(fh,1),\"Hz\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The lower cutoff frequency is 300.8 Hz\n",
        "The upper cutoff frequency is 3000.8 Hz\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.14 Page No 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "B=2700.0     #Hz\n",
      "fr=950     #Hz  resonant frequency\n",
      "\n",
      "#calculation\n",
      "Q=fr/B\n",
      "\n",
      "#Result\n",
      "print\"The quality factor\",round(Q,2)\n",
      "\n",
      "if Q<0.5:\n",
      "    print\"This filter is classified\"\n",
      "else:\n",
      "    print\"This filter is not classified\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quality factor 0.35\n",
        "This filter is classified\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.15 Page No 318"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "fr=1000         #Hz, resonant frequency\n",
      "fl=80           #From eq 11.16\n",
      "fh=1280         #upper frequency\n",
      "C=0.015         #microF\n",
      "Q=2.0           #Quality factor\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "B=fr/Q\n",
      "fl=math.sqrt(B**2/4.0+fr**2)-B/2.0\n",
      "fh=fl+B\n",
      "\n",
      "R=0.1591/(B*C*10**-6)\n",
      "Rr=R/(2*Q**2-1)\n",
      "\n",
      "#Result\n",
      "print\"The Rr is\",round(Rr/1000,2),\"kohm\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The Rr is 3.03 kohm\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.16 Page No 319"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R=21.21*10**3       #ohm,  resiatance\n",
      "Rr=3.03*10**3      \n",
      "C=0.015*10**-6      #F,  capacitance\n",
      "\n",
      "#Calculation\n",
      "import math\n",
      "#From eq 11.12\n",
      "fr=0.1125*math.sqrt(1+R/Rr)/(R*C)\n",
      "B=0.1591/(R*C)\n",
      "\n",
      "#Result\n",
      "print\"The resonant frequency is\",round(fr,0),\"Hz\"\n",
      "print\"Bandwidth is\",round(B,0),\"Hz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resonant frequency is 1000.0 Hz\n",
        "Bandwidth is 500.0 Hz\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 11.17 Page No 321"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "fr=120       #Hz  resonant frequency\n",
      "B=12         #Hz\n",
      "Q=10         #Quality factor\n",
      "\n",
      "#Calculation\n",
      "C=0.33      #MicroF\n",
      "R=0.1591/(B*C*10**-6)\n",
      "Rr=R/(2*Q**2-1)\n",
      "\n",
      "#Result\n",
      "print\"The value of resistance is\",round(R/1000,1),\"kohm\"\n",
      "print\"The value of Rr is\",round(Rr,1),\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of resistance is 40.2 kohm\n",
        "The value of Rr is 201.9 kohm\n"
       ]
      }
     ],
     "prompt_number": 64
    }
   ],
   "metadata": {}
  }
 ]
}