{
 "metadata": {
  "name": "",
  "signature": "sha256:b50fbda5069b9b2f766870fdc83a2feaf1f182dfb36d43f632160c82ec149201"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Frequency Response Filters and Resonance"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2  Page No : 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "#Problem 13.2\")\n",
      "\n",
      "# Given\n",
      "#|Hv| = 1/math.sqrt(2)             (1)\")\n",
      "#resistance R1 = 5kohm\")\n",
      "R1 = 5000;\n",
      "#Hv(w) = 1/1+%i*(w/wx)        (2)\")\n",
      "#wx = 1/(R1*C2)\n",
      "#On solving we get\n",
      "#wx = 2*10**-4/C2              (3)\")\n",
      "\n",
      "#a)\")\n",
      "C2 = 10*10**-9;\n",
      "#Taking modulus of (2)\n",
      "#|Hv(w)| = 1/math.sqrt(1+(w/wx)**2)\")\n",
      "#Equating (1) and (2)\n",
      "wx = 2*10**-4/C2;\n",
      "fx = (wx/(2*math.pi))*10**-3\n",
      "print \"Frequencya) is %3.2fkHz\"%(fx)\n",
      "\n",
      "#b)\")\n",
      "C2b = 1*10**-9;\n",
      "#As frequency is inversely proportional to C2 (from (3))\n",
      "fx1 = (C2/C2b)*fx\n",
      "print \"Frequencyb) is %3.2fkHz\"%(fx1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequencya) is 3.18kHz\n",
        "Frequencyb) is 31.83kHz\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.7  Page No : 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given\n",
      "#From the above transfer function\n",
      "#Comparing the denominator with s**2+a*s+b with w = math.sqrt(b)\n",
      "a = 300;b = 10**6;\n",
      "#Therefore center frequency is\n",
      "w0 = math.sqrt(10**6)\n",
      "#The lower and upper frequencies are\n",
      "wl = math.sqrt(a**2/4+b)-a/2\n",
      "wh = math.sqrt(a**2/4+b)+a/2\n",
      "B = wh-wl        #It can be inferred that B = a\n",
      "Q = math.sqrt(b)/a\n",
      "print \"Center frequency =  %drad/s\"%(w0);\n",
      "print \"Low power frequency  =  %3.2frad/sHigh power frequency  =  %3.2frad/s\"%(wl,wh);\n",
      "print \"Bandwidth =  %drad/sQuality factor  = %3.2f\"%(B,Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Center frequency =  1000rad/s\n",
        "Low power frequency  =  861.19rad/sHigh power frequency  =  1161.19rad/s\n",
        "Bandwidth =  300rad/sQuality factor  = 3.33\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.8  Page No : 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Given\n",
      "#From the above transfer function\n",
      "#Comparing the denominator with s**2+a*s+b with w = math.sqrt(b)\n",
      "a = 30;\n",
      "b = 10**6;\n",
      "#Therefore center frequency is\n",
      "w0 = math.sqrt(10**6)\n",
      "#The lower and upper frequencies are\n",
      "wl = math.sqrt(a**2/4+b)-a/2\n",
      "wh = math.sqrt(a**2/4+b)+a/2\n",
      "B = wh-wl\n",
      "Q = math.sqrt(b)/a\n",
      "print \"Center frequency =  %drad/s\"%(w0);\n",
      "print \"Low power frequency  =  %3.2frad/sHigh power frequency  =  %3.2frad/s\"%(wl,wh);\n",
      "print \"Bandwidth =  %drad/sQuality factor  = %3.2f\"%(B,Q)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Center frequency =  1000rad/s\n",
        "Low power frequency  =  985.11rad/sHigh power frequency  =  1015.11rad/s\n",
        "Bandwidth =  30rad/sQuality factor  = 33.33\n"
       ]
      }
     ],
     "prompt_number": 5
    }
   ],
   "metadata": {}
  }
 ]
}