{
 "metadata": {
  "name": "",
  "signature": "sha256:c60efd914206d08126f8218f1e88325a1f0fb8a6ee971af39fa988bc26907f7c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 - Angle Modulation"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - pg 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier frequency, modulation frequency and max. frequency deviation, power dissipation\n",
      "import math\n",
      "#given\n",
      "t=10 #sec\n",
      "R = 10.#resistance in ohms\n",
      "print \"v(t) = 12*cos(6*10**8*t + 5*sin(1250*t));\"\n",
      "print \"v(t) = A*cos(w_c*t + m_f*sin(w_m*t))\"\n",
      "#by comparing with standard \n",
      "A = 12. #amplitude voltage in volts\n",
      "w_c= 6*10**8 #angular carrier frequency in rad/sec\n",
      "w_m = 1250. #angular modulating frequency in rad/sec\n",
      "m_f = 5. #modulation index\n",
      "\n",
      "#calculations\n",
      "f_c =  w_c/(2*math.pi)#carrier frequency\n",
      "f_m = w_m/(2*math.pi)#modulating frequency\n",
      "deltaf = m_f*f_m#maximum deviation\n",
      "V_rms = (A/math.sqrt(2))**2#rms volatage\n",
      "P = V_rms/R#power dissipatted\n",
      "\n",
      "#results\n",
      "print \" i. Carrier frequency (MHz) = \",round(f_c/10**6,1)\n",
      "print \"ii. Modulation frequency (Hz) = \",round(f_m,0)\n",
      "print \"iii. Modulation index = \",m_f\n",
      "print \"iv.Maximum frequency deviation (Hz) = \", round(deltaf,0)\n",
      "print \"v.Power dissipated (W) = \",P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "v(t) = 12*cos(6*10**8*t + 5*sin(1250*t));\n",
        "v(t) = A*cos(w_c*t + m_f*sin(w_m*t))\n",
        " i. Carrier frequency (MHz) =  95.5\n",
        "ii. Modulation frequency (Hz) =  199.0\n",
        "iii. Modulation index =  5.0\n",
        "iv.Maximum frequency deviation (Hz) =  995.0\n",
        "v.Power dissipated (W) =  7.2\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - pg 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier frequency, highest and lowest frequencies and modulating index\n",
      "\n",
      "#given\n",
      "f_c = 107.6*10**6#carrier frequency\n",
      "f_m = 7.*10**3#modulating frequency\n",
      "deltaf = 50.*10**3#frequency deviation\n",
      "\n",
      "#calculations\n",
      "cs = 2*deltaf#carrier swing\n",
      "f_H = f_c + deltaf#highest frequency \n",
      "f_L = f_c - deltaf#lowest frequency \n",
      "m_f = deltaf/f_m#modulating index\n",
      "\n",
      "#results\n",
      "print \"i.Carrier frequency (kHz) = \",cs/1000.\n",
      "print \"ii.a.Highest frequency attained by the modulating signal (MHz) = \",round(f_H/10**6,2)\n",
      "print \"   b.Lowest frequency attained by the modulating signal (MHz) = \",round(f_L/10**6,2)\n",
      "print \"iii.modulating index of the FM wave = \",round(m_f,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Carrier frequency (kHz) =  100.0\n",
        "ii.a.Highest frequency attained by the modulating signal (MHz) =  107.65\n",
        "   b.Lowest frequency attained by the modulating signal (MHz) =  107.55\n",
        "iii.modulating index of the FM wave =  7.143\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - pg 199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency deviation,carrier swing and lower frequency\n",
      "\n",
      "#given\n",
      "f_c = 105*10**6#carrier frequency \n",
      "f_H = 105.007*10**6#highest frequency or upper frequency\n",
      "#calculations\n",
      "deltaf = f_H - f_c#frequency deviation\n",
      "cs = 2*deltaf#carrier swing\n",
      "f_L = f_c - deltaf#lower frequency\n",
      "#results\n",
      "print \"i.Frequency deviation (kHz) = \",deltaf/1000.\n",
      "print \"ii.Carrier swing (kHz) = \",cs/1000.\n",
      "print \"iii.Lower frequency reached by the modulated wave (MHz) = \",round(f_L/10**6,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Frequency deviation (kHz) =  7.0\n",
        "ii.Carrier swing (kHz) =  14.0\n",
        "iii.Lower frequency reached by the modulated wave (MHz) =  104.993\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - pg 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index\n",
      "\n",
      "#given\n",
      "cs = 100.*10**3#carrier swing\n",
      "f_m = 8.*10**3#modulating frequency\n",
      "\n",
      "#calculations\n",
      "deltaf = cs/2.#frequency deviation\n",
      "m_f = deltaf/f_m#modulation index\n",
      "#results \n",
      "print \"Modulation index = \",m_f\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Modulation index =  6.25\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - pg 200"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Percentage modulation index\n",
      "\n",
      "#given\n",
      "deltaf = 20.*10**3#frequency deviation\n",
      "deltaf_actual = deltaf#since deltaf_actual equals to deltaf\n",
      "deltaf_max1 = 75.*10**3#maximum frequency deviation deltaf_max permittedfor the first case is 75KHz\n",
      "deltaf_max2 = 25.*10**3#maximum frequency deviation deltaf_max permitted for the second case is 25KHz\n",
      "\n",
      "#calculations\n",
      "M1 = (deltaf_actual/deltaf_max1)*100#persentage modulation index for first case\n",
      "M2 = (deltaf_actual/deltaf_max2)*100#persentage modulation index for second case\n",
      "\n",
      "#results\n",
      "print \"i.Percentage modulation index for first case (percent) = \",round(M1,2)\n",
      "print \"ii.Percentage modulation index for second case (percent) = \",M2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Percentage modulation index for first case (percent) =  26.67\n",
        "ii.Percentage modulation index for second case (percent) =  80.0\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - pg 210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth of a commercial FM transmission\n",
      "\n",
      "#given\n",
      "deltaf = 75.*10**3#frequency deviation\n",
      "f_m = 15.*10**3#modulating frequency\n",
      "\n",
      "#calculation\n",
      "BW = 2*(deltaf+f_m)#bandwidth \n",
      "\n",
      "#result\n",
      "print \"Bandwidth of a commercial FM transmission (kHz) = \",BW/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth of a commercial FM transmission (kHz) =  180.0\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - pg 210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth of a narrowband FM signal\n",
      "\n",
      "#given\n",
      "f_m = 4.*10**3#modulation frequency\n",
      "f_c = 125.*10**3#carrier frequency\n",
      "\n",
      "#claculation\n",
      "BW = 2*f_m#bandwidth\n",
      "\n",
      "#result\n",
      "print \"Bandwidth of a narrowband FM signal (kHz) = \",BW/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth of a narrowband FM signal (kHz) =  8.0\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - pg 210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth of a signal under required conditions\n",
      "\n",
      "#given\n",
      "deltaf1 = 75.*10**3#frequency deviation \n",
      "f_m = 8.*10**3#modulation frequency\n",
      "deltaf2 = 2*deltaf1#if modulation signal amplitude is doubled, the frequency deviation becomes  double\n",
      "\n",
      "#calculation\n",
      "BW1 = 2*(deltaf1 +f_m)#bandwidth\n",
      "BW2 =  2*(deltaf2 +f_m)#new bandwidth\n",
      "\n",
      "#result\n",
      "print \"Bandwidth of a signal when modulating signal amplitude is doubled (kHz) = \",BW2/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth of a signal when modulating signal amplitude is doubled (kHz) =  316.0\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9 - pg 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index and bandwidth\n",
      "\n",
      "#given\n",
      "f_m = 5.*10**3#modulating frequency\n",
      "f_c = 50.*10**6#carrier frequency\n",
      "deltaf = 20.*10**3#frequency deviation\n",
      "\n",
      "#calculations\n",
      "m_f = deltaf/f_m#modulation index\n",
      "BW = deltaf*3.8#referring to the Schwartz bandwidth curve \n",
      "\n",
      "#results \n",
      "print \"i.Modulation index = \",m_f\n",
      "print \"ii.Bandwidth of the FM signal (kHz) = \",BW/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Modulation index =  4.0\n",
        "ii.Bandwidth of the FM signal (kHz) =  76.0\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10 - pg 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulating frequency\n",
      "\n",
      "#given\n",
      "BW = 50.*10**3#bandwidth\n",
      "deltaf = 10.*10**3#frequency deviation\n",
      "\n",
      "#calculation\n",
      "x = BW/deltaf#variable\n",
      "m_f = 2#by referring to the Schwartz bandwidth curve with 'x'\n",
      "f_m = deltaf/m_f#modulating frequency\n",
      "\n",
      "#results\n",
      "print \"Modulating frequency (kHz) = \",f_m/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Modulating frequency (kHz) =  5.0\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11 - pg 217"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index and bandwidth in all cases\n",
      "print (\"EXAMPLE 5.11(PAGENO 217)\");\n",
      "#given\n",
      "#x(t) = 5*cos(2*%pi*15*10**3*t)\n",
      "V_m = 5.#amplitude of voltage\n",
      "f_m = 15.*10**3#modulation frequency\n",
      "k_f = 15.*10**3#frequency sensitivity\n",
      "k_p = 15.*10**3#phase sensitivity\n",
      "\n",
      "#calculations\n",
      "#first case\n",
      "#for FM system\n",
      "delta_f1 = k_f * V_m;#frequency deviation for FM system\n",
      "m_f1 = delta_f1/f_m; #modulation index in FM system\n",
      "BW1 = 2*(delta_f1+f_m);#bandwidth for FM system\n",
      "#for PM system\n",
      "delta_f2 = k_f * V_m*f_m;#frequency deviation for PM system\n",
      "BW2 = 2*(delta_f2 + f_m);#bandwidth for PM system\n",
      "m_p1 = k_p * V_m#modulation index in PM system\n",
      "\n",
      "#second case\n",
      "f_m1 = 5*10**3#modulating frequency for second case\n",
      "#for FM system\n",
      "delta_f3 = k_p * V_m;#frequency deviation for FM system\n",
      "m_f2 = delta_f3/f_m1; #modulation index in FM system\n",
      "BW3 = 2*(delta_f3+f_m1);#bandwidth for FM system\n",
      "#for PM system\n",
      "delta_f4 = k_p * V_m*f_m1;#frequency deviation for PM system\n",
      "BW4 = 2*(delta_f4 + f_m1);#bandwidth for PM system\n",
      "m_p2 = k_p * V_m#modulation index in PM system\n",
      "\n",
      "#results\n",
      "print \"i.a.Modulation index of FM system for first case =\",m_f1\n",
      "print \"  b.Bandwidth of FM system for first case (kHz) = \",BW1/1000.\n",
      "print \"ii.a.Modulation index of PM system for first case = \",m_p1\n",
      "print \"  b.Bandwidth of PM system for first case (MHz) = \",round(BW2/10**6,0)\n",
      "print \"iii.a.Modulation index of FM system for second case = \",m_f2\n",
      "print \"  b.Bandwidth of FM system for second case (kHz) = \",BW3/1000.\n",
      "print \"iv.a.Modulation index of PM system for second case (kHz) = \",m_p2/1000.\n",
      "print \"  b.Bandwidth of PM system for second case (MHz) = \",round(BW4/10**6,0)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "EXAMPLE 5.11(PAGENO 217)\n",
        "i.a.Modulation index of FM system for first case = 5.0\n",
        "  b.Bandwidth of FM system for first case (kHz) =  180.0\n",
        "ii.a.Modulation index of PM system for first case =  75000.0\n",
        "  b.Bandwidth of PM system for first case (MHz) =  2250.0\n",
        "iii.a.Modulation index of FM system for second case =  15.0\n",
        "  b.Bandwidth of FM system for second case (kHz) =  160.0\n",
        "iv.a.Modulation index of PM system for second case (kHz) =  75.0\n",
        "  b.Bandwidth of PM system for second case (MHz) =  750.0\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12 - pg 219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier frequency, modulating frequency and index, deviation and power\n",
      "import math\n",
      "#given\n",
      "#given that v = 10*sin((5 * 10**8 *t) + 4*sin(1250*t))\n",
      "#by comparing with standard eqn i.e v = V_c*sin((w_c * t) + m_f*sin(w_m*t)) we get\n",
      "w_c = 5.*10**8#angular carrier frequency\n",
      "w_m = 1250.#angular modulating frequency\n",
      "m_f = 4. #modulating index\n",
      "V_c = 10. #carrier voltage in volts\n",
      "R = 5. #resistance in ohms\n",
      "\n",
      "#calculations\n",
      "f_c = w_c/(2*math.pi)#carrier frequency\n",
      "f_m = w_m/(2*math.pi)#modulating frequency\n",
      "deltaf = m_f * f_m#maximum deviation\n",
      "V_rms = (V_c/math.sqrt(2))**2#RMS value of FM wave\n",
      "P = V_rms/R#power dissipated\n",
      "\n",
      "#results\n",
      "print \"i.a.Carrier frequency (MHz) = \",round(f_c/10**6,2)\n",
      "print \"  b.Modulating frequency (Hz) = \",round(f_m,0)\n",
      "print \"ii.a.Modulation index = \",m_f\n",
      "print \"   b.Maximum deviation (Hz) = \",round(deltaf,0)\n",
      "print \"iii.Power dissipated in 5 ohms resistance (W) = \",P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Carrier frequency (MHz) =  79.58\n",
        "  b.Modulating frequency (Hz) =  199.0\n",
        "ii.a.Modulation index =  4.0\n",
        "   b.Maximum deviation (Hz) =  796.0\n",
        "iii.Power dissipated in 5 ohms resistance (W) =  10.0\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13 - pg 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency deviation for modulating voltage\n",
      "\n",
      "#given\n",
      "f_m = 1.*10**3#modulating frequency\n",
      "V_m = 2.#modulating voltage in volts\n",
      "deltaf = 6.*10**3#frequency deviation\n",
      "V_m1 = 4.#increased modulation voltage for first case\n",
      "V_m2 = 8.#increased modulation voltage for second case\n",
      "\n",
      "#calculations\n",
      "k_f = deltaf/V_m#proportion constant\n",
      "#first case\n",
      "deltaf1 = k_f*V_m1#frequency deviation for first case\n",
      "#second case\n",
      "deltaf2 = k_f*V_m2#frequency deviation for second case\n",
      "\n",
      "#results\n",
      "print \"i.Frequency deviation for modulating voltage 4V (kHz) = \",deltaf1/1000.\n",
      "print \"ii.Frequency deviation for modulating voltage 8V (kHz) = \",deltaf2/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Frequency deviation for modulating voltage 4V (kHz) =  12.0\n",
        "ii.Frequency deviation for modulating voltage 8V (kHz) =  24.0\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14 - pg 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index\n",
      "\n",
      "#given\n",
      "deltaf = 6.*10**3#frequency deviation from the question of EXAMPLE 5.13(PAGENO 220)\n",
      "f_m = 1.*10**3#modulating frequency from the question of EXAMPLE 5.13(PAGENO 220)\n",
      "deltaf1 = 12.*10**3#frequency deviation from the  EXAMPLE 5.13(PAGENO 220) of first case\n",
      "deltaf2 = 24.*10**3#frequency deviation from the  EXAMPLE 5.13(PAGENO 220) of second case\n",
      "f_m1 = f_m#modulating frequency from the EXAMPLE 5.13(PAGENO 220) of first case\n",
      "f_m2 = 500.#modulating frequency from the EXAMPLE 5.13(PAGENO 220) ofsecond case\n",
      "\n",
      "#calculation\n",
      "m_f = deltaf/f_m#modulation index for the initial conditions given in the problem 5.13\n",
      "m_f1 = deltaf1/f_m1#modulation index for the first case\n",
      "m_f2 = deltaf2/f_m2#modulation index for the second case\n",
      "\n",
      "#results\n",
      "print \"a.Modulation index for initial conditions given in the problem 5.13 = \",m_f\n",
      "print \"b.Modulation index for the first case = \",m_f1\n",
      "print \"c.Modulation index for the second case = \",m_f2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a.Modulation index for initial conditions given in the problem 5.13 =  6.0\n",
        "b.Modulation index for the first case =  12.0\n",
        "c.Modulation index for the second case =  48.0\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15 - pg 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth of FM signal\n",
      "\n",
      "#given\n",
      "deltaf = 10.*10**3#frequency deviation\n",
      "f_m = 1.*10**3#modulating frequency\n",
      "\n",
      "#calculations\n",
      "BW = 2*(deltaf + f_m)#bandwidth of FM signal\n",
      "BW_DSB = 2*f_m#bandwidth of DSB FC(AM)\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth of FM signal (kHz) = \",BW/1000.\n",
      "print \"ii.Bandwidth of DSB FC(AM) signal (kHz) = \",BW_DSB/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth of FM signal (kHz) =  22.0\n",
        "ii.Bandwidth of DSB FC(AM) signal (kHz) =  2.0\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16 - pg 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the wave equations\n",
      "import math\n",
      "#given\n",
      "#first case\n",
      "f_c1 = 20.*10**6#carrier frequency\n",
      "f_m1 = 400.#modulation frequency\n",
      "V_c = 5.#carrier voltage in volts\n",
      "deltaf = 10.*10**3#frequency deviation\n",
      "#second case\n",
      "f_m2 = 2.*10**3#modulation frequency\n",
      "\n",
      "#calculations\n",
      "w_c1 = 2 *math.pi *f_c1#angular carrier freqency\n",
      "w_m1 = 2 *math.pi *f_m1#angular carrier freqency\n",
      "m_f1 = deltaf/f_m1#modulation index for first case\n",
      "m_f2 = deltaf/f_m2#modulation index for second case\n",
      "\n",
      "#results\n",
      "#standard format of fm and pm equations are\n",
      "#s(t) = V_c8sin(w_c*t + m_f*sin(w_m*t))\n",
      "print \"(i)FM wave:s(t) =\",m_f2,\"*sin(1.25*10**8*t +\",m_f1,\"*sin(2513*t)\"\n",
      "print \"(ii)PM wave:s(t) =\",m_f2,\"*sin(1.25*10**8*t +\",m_f1,\"*sin(2513*t)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)FM wave:s(t) = 5.0 *sin(1.25*10**8*t + 25.0 *sin(2513*t)\n",
        "(ii)PM wave:s(t) = 5.0 *sin(1.25*10**8*t + 25.0 *sin(2513*t)\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17 - pg 221"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier amplitude, maximum and minimum frequencies\n",
      "\n",
      "#given\n",
      "V_m = 5.#modulating voltage\n",
      "f_m = 200.*10**3#modulating frequency\n",
      "V_c = 10.#carrier voltage\n",
      "f_c = 100.*10**6#carrier frequency\n",
      "delta_f = 2.*10**3#frequeny deviation in hertz per volt\n",
      "\n",
      "#calculations\n",
      "m_a = delta_f/f_m#modulation index\n",
      "print \"for m_a = .5 the approximate values of j coefficients are\"\n",
      "print \"J_0 = .94   J_1 = .24   J_2 =.03\"\n",
      "J_0 = .94\n",
      "J_1 = .24\n",
      "J_2 =.03\n",
      "A_c = V_c*J_0;#carrier amplitude\n",
      "A_1 = V_c*J_1;#amplitude of first pair of sideband\n",
      "A_2 = V_c*J_2;#amplitude of second pair of sideband\n",
      "f_1 = f_c + f_m#maximum frequency of first pair of sideband \n",
      "f_1a = f_c - f_m#minimum frequency of first pair of sideband \n",
      "f_2 = f_c + (2*f_m)#maximum frequency of second pair of sideband \n",
      "f_2a = f_c - (2*f_m)#minimum frequency of second pair of sideband\n",
      "\n",
      "#results\n",
      "print \"i.Carrier amplitude (V) = \",A_c\n",
      "print \"ii.Amplitude of first pair of sideband (V) = \",A_1\n",
      "print \"iii.Amplitude of second pair of sideband (V) = \",A_2\n",
      "print \"iV.a.Maximum frequency of first pair of sideband (MHz) = \",round(f_1/10**6,2)\n",
      "print \"    .b.Minimum frequency of first pair of sideband (MHz) = \",round(f_1a/10**6,2)\n",
      "print \"V.a.Maximum frequency of second pair of sideband (MHz) = \",round(f_2/10**6,2)\n",
      "print \"   .b.Minimum frequency of second pair of sideband (MHz) = \",round(f_2a/10**6,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "for m_a = .5 the approximate values of j coefficients are\n",
        "J_0 = .94   J_1 = .24   J_2 =.03\n",
        "i.Carrier amplitude (V) =  9.4\n",
        "ii.Amplitude of first pair of sideband (V) =  2.4\n",
        "iii.Amplitude of second pair of sideband (V) =  0.3\n",
        "iV.a.Maximum frequency of first pair of sideband (MHz) =  100.2\n",
        "    .b.Minimum frequency of first pair of sideband (MHz) =  99.8\n",
        "V.a.Maximum frequency of second pair of sideband (MHz) =  100.4\n",
        "   .b.Minimum frequency of second pair of sideband (MHz) =  99.6\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18 - pg 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the maximum frequency deviation for first case and modulation index for second case\n",
      "\n",
      "#given\n",
      "f_m1 = 400.#modulating frequency for first case\n",
      "V_m1 = 2.4#modulating voltage for first case\n",
      "f_m2 = 250.#modulating frequency for second case\n",
      "V_m2 = 3.2#modulating voltage for second case\n",
      "m_f1 = 60.#modulation index for first case\n",
      "\n",
      "#calculations\n",
      "delta_f1 = m_f1*f_m1#maximum frequency deviation for first case\n",
      "k = delta_f1/V_m1#constant\n",
      "delta_f2 = k*V_m2#frequency deviation for second case\n",
      "m_f2 = delta_f2/f_m2#modulation index for second case\n",
      "\n",
      "#results\n",
      "print \"i.Maximum frequency deviation for first case (kHz) = \",round(delta_f1/1000.,0)\n",
      "print \"ii.Modulation index for second case = \",m_f2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Maximum frequency deviation for first case (kHz) =  24.0\n",
        "ii.Modulation index for second case =  128.0\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19 - pg 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index and bandwidth for both cases\n",
      "\n",
      "#given\n",
      "f_m1 = 1.*10**3#modulating frequency for first case\n",
      "f_m2 = 500.#modulating frequency for second case\n",
      "V_m1 = 2.#modulating voltage for first case\n",
      "V_m2 = 8.#modulating volatge for second case\n",
      "delta_f1 = 4.*10**3#frequency deviation for first case\n",
      "\n",
      "#calculations \n",
      "k = delta_f1/V_m1#constant\n",
      "delta_f2 = k*V_m2#frequency deviation for second case\n",
      "m_f1 = delta_f1/f_m1#modulation index for first case\n",
      "m_f2 = delta_f2/f_m2#modulation index for second case\n",
      "BW1 = 2*(delta_f1 + f_m1)#bandwidth for first case\n",
      "BW2 = 2*(delta_f2 + f_m2)#bandwidth for second case\n",
      " \n",
      "#results\n",
      "print \"i.a.Modulation index for first case = \",m_f1\n",
      "print \"  b.Bandwidth for first case (kHz) = \",BW1/1000.\n",
      "print \"ii.a.Modulation index for second case = \",m_f2\n",
      "print \" b .Bandwidth for second case (kHz) = \",BW2/1000.\n",
      "print \"Note: Their is error in textbook in the calculation of second case bandwidth \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Modulation index for first case =  4.0\n",
        "  b.Bandwidth for first case (kHz) =  10.0\n",
        "ii.a.Modulation index for second case =  32.0\n",
        " b .Bandwidth for second case (kHz) =  33.0\n",
        "Note: Their is error in textbook in the calculation of second case bandwidth \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20 - pg 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the capacitive reactance\n",
      "#given\n",
      "g_m = 10*10**-3#transconductance \n",
      "n = 8\n",
      "f= 5*10**6#operating frequency\n",
      "\n",
      "#calculation\n",
      "X_Ceq = n/g_m#capacitive reactance\n",
      "\n",
      "#result\n",
      "print \"Capacitive reactance (ohms) = \",X_Ceq\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Capacitive reactance (ohms) =  800.0\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21 - pg 233"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier frequency and deviation, modulation index\n",
      "\n",
      "#given data from block diagram\n",
      "f_c = 10.*10**6#carrier frequency \n",
      "delta_f = 10.*10**3#frequency deviation\n",
      "m_f = 5.#modulation index\n",
      "\n",
      "#calculations\n",
      "#first stage\n",
      "f_cA = 3 * f_c#carrier frequency at point A\n",
      "delta_fA = 3 * delta_f#frequency deviation at point A\n",
      "m_fA = 3 * m_f#modulation index at point A\n",
      "f_maxA = f_cA + delta_fA#maximum frequency at point A\n",
      "f_minA = f_cA - delta_fA#minimum frequency at point A\n",
      "#second stage\n",
      "f_cB = f_cA + f_c#carrier frequency at point B\n",
      "f_maxB = f_maxA  +f_c#maximum frequency at point B\n",
      "f_minB = f_minA + f_c#minimum frequency at point B\n",
      "delta_fB = f_maxB - f_cB#frequency deviation at point B\n",
      "#their will no change in modulation index \n",
      "\n",
      "#results\n",
      "print \"i.a.Carrier frequency at point A (MHz) = \",f_cA/10**6\n",
      "print \" b.Frequency deviation at point A (kHz) = \",delta_fA/10**3\n",
      "print \" c.Modulation index at point A =  \",m_fA\n",
      "print \" d.Maximum frequency at point A (MHz) = \",round(f_maxA/10**6,3)\n",
      "print \" e.Minimum frequency at point A (MHz) = \",round(f_minA/10**6,3)\n",
      "print \"ii.a.Carrier frequency at point B (MHz) = \",f_cB/10**6\n",
      "print \" b.Frequency deviation at point B (kHz) = \",delta_fB/10**3\n",
      "print \" c.Modulation index at point B = \",m_fA\n",
      "print \" d.Maximum frequency at point B (MHz) = \",round(f_maxB/10**6,3)\n",
      "print \" e.Minimum frequency at point B (MHz) = \",round(f_minB/10**6,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Carrier frequency at point A (MHz) =  30.0\n",
        " b.Frequency deviation at point A (kHz) =  30.0\n",
        " c.Modulation index at point A =   15.0\n",
        " d.Maximum frequency at point A (MHz) =  30.03\n",
        " e.Minimum frequency at point A (MHz) =  29.97\n",
        "ii.a.Carrier frequency at point B (MHz) =  40.0\n",
        " b.Frequency deviation at point B (kHz) =  30.0\n",
        " c.Modulation index at point B =  15.0\n",
        " d.Maximum frequency at point B (MHz) =  40.03\n",
        " e.Minimum frequency at point B (MHz) =  39.97\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22 - pg 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index\n",
      "#given\n",
      "#first case\n",
      "#The maximum deviation in commerical FM is given as\n",
      "delta_f1 = 75.*10**3#frequency deviation in commerical FM\n",
      "f_m1 = 30.#maximum modulating frequency\n",
      "f_m2 = 15.*10**3#minimum modulating frequency\n",
      "#second case\n",
      "delta_f2 = 10.*10**3#frequency deviation for narrowband FM\n",
      "f_m3 = 100.#maximum modulating frequency\n",
      "f_m4 = 3.*10**3#minimum modulating frequency \n",
      " \n",
      "#calculations\n",
      "#first case\n",
      "m_f1 = delta_f1/f_m1#modulation index for maximum modulating frequency\n",
      "m_f2 = delta_f1/f_m2#modulation index for minimum modulating frequency \n",
      "#second case\n",
      "m_f3 = delta_f2/f_m3#modulation index for maximum modulating frequency \n",
      "m_f4 = delta_f2/f_m4#modulation index for minimum modulating frequency  \n",
      "\n",
      "#results\n",
      "print \" i.a.modulation index for maximum modulating frequency of commercial FM = \",m_f1\n",
      "print \"  b.modulation index for minimum modulating frequency of commercial FM = \",m_f2\n",
      "print \"ii.a.modulation index for maximum modulating frequency of narrowband FM = \",m_f3\n",
      "print \"   b.modulation index for minimum modulating frequency of commercial FM = \",round(m_f4,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " i.a.modulation index for maximum modulating frequency of commercial FM =  2500.0\n",
        "  b.modulation index for minimum modulating frequency of commercial FM =  5.0\n",
        "ii.a.modulation index for maximum modulating frequency of narrowband FM =  100.0\n",
        "   b.modulation index for minimum modulating frequency of commercial FM =  3.33\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 23 - pg 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index\n",
      "\n",
      "#given\n",
      "print ('modulated carrier waveform is given by s(t) = A*sin((2*pi*f_c*t)+m_f*sin(2*pi*f_m*t))');\n",
      "f_c = 100.*10**6#carrier frequency in hertz\n",
      "delta_f = 75.*10**3#frequency deviation in hertz\n",
      "f_m = 2.*10**3#modulating frequency\n",
      "A = 5#peak voltage of carrier wave\n",
      "\n",
      "#calculation\n",
      "m_f = delta_f/f_m;#modulation index\n",
      "\n",
      "#result\n",
      "print \" Modulation index = \",m_f\n",
      "print (\"Equation for modulated carrier waveform s(t) = 5*sin((2*pi*100*10**6*t)+37.5*sin(2*pi*2*10**3*t))\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "modulated carrier waveform is given by s(t) = A*sin((2*pi*f_c*t)+m_f*sin(2*pi*f_m*t))\n",
        " Modulation index =  37.5\n",
        "Equation for modulated carrier waveform s(t) = 5*sin((2*pi*100*10**6*t)+37.5*sin(2*pi*2*10**3*t))\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24 - pg 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency sensitivity and modulation index\n",
      "\n",
      "#given\n",
      "#we know that s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))\n",
      "f_c = 1.*10**6#modulation frequency\n",
      "A = 3.#carrier amplitude in volts\n",
      "#first case\n",
      "A_m = 1.#modulating amplitude in volts for first case\n",
      "delta_f = 1.*10**3#frequency deviation\n",
      "f_m1 = 1.#modulating frequencyof first case\n",
      "#second case\n",
      "f_m2 = 2.*10**3#modulating frequency for second case\n",
      "A_m2 = 5.#modulating amplitude for second case\n",
      "\n",
      "#calculations\n",
      "k_f  = delta_f/f_m1#frequency sensitivity in hertz per volt\n",
      "m_f = (delta_f*A_m2)/f_m2#modulating frequency\n",
      "#desired FM signal can be expressed by s(t) = A*cos((2*%pi*f_c*t) + m_f*sin(2*%pi*f_m*t ))\n",
      "#results\n",
      "#standard FM signal expression is as follows\n",
      "#s(t) = A*cos(2*%pi*f_c*t + m_f * sin(2*%pi*f_m*t))\n",
      "print \"Frequency sensitivity k_f (Hz/volt)= \",k_f\n",
      "print \"Modulation index m_f =\",m_f\n",
      "\n",
      "print (\"s(t)=3*cos(2*pi*10**6*t + 2.5*sin(2*pi*2*10**3*t)\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency sensitivity k_f (Hz/volt)=  1000.0\n",
        "Modulation index m_f = 2.5\n",
        "s(t)=3*cos(2*pi*10**6*t + 2.5*sin(2*pi*2*10**3*t)\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 29 - pg 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth and percentage of under estimation\n",
      "\n",
      "#given\n",
      "delta_f = 75.*10**3#frequency deviation\n",
      "f_m = 15.*10**3#modulating frequency\n",
      "\n",
      "#calculations\n",
      "D = delta_f/f_m#deviation ratio\n",
      "BW1 = 2*delta_f*(1+(1/D))#bandwidth of FM signal\n",
      "#using universal curve, replacing m_f by D,we get\n",
      "BW2 = 3.2*delta_f#for D = 5=3.2*75*10**3\n",
      "BW = (BW2-BW1)*100/BW2#percentage of under estimation of bandwidth by using carson's rule\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth of FM signal (kHz) = \",BW1/1000.\n",
      "print \"ii.Bandwidth obtained by replacing m_f by D (kHz) = \",BW2/1000.\n",
      "print \"iii.Percentage of under estimation of bandwidth by using Carson rule (percent) = \",BW\n",
      "print \"It means that cason s rule under estimates the band-width by 25% as compared with the result obtained from the universal curve.\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth of FM signal (kHz) =  180.0\n",
        "ii.Bandwidth obtained by replacing m_f by D (kHz) =  240.0\n",
        "iii.Percentage of under estimation of bandwidth by using Carson rule (percent) =  25.0\n",
        "It means that cason s rule under estimates the band-width by 25% as compared with the result obtained from the universal curve.\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 30 - pg 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the fraction of signal power \n",
      "\n",
      "#given\n",
      "m_f1 = 1.#modualtion index for first case\n",
      "m_f2 = 10.#modualtion index for second  case\n",
      "#let\n",
      "f_m = 1.*10**3#modulating frequency\n",
      "\n",
      "#calulations\n",
      "#the bandwidth for FM signal can be calculated on the basis of 98% power requirement given by Carson's rule\n",
      "BW1 = 2*(m_f1+1)*f_m#bandwidth for first case\n",
      "B1 = (2*m_f1 +1)*f_m#frequency band first case\n",
      "BW2 = 2*(m_f2+1)*f_m#bandwidth for second  case\n",
      "B2 = (2*m_f2 +1)*f_m#frequency band second  case\n",
      "P1 = (B1/BW1)*(98.)#fraction of signal power that is included in freuency band for 1st case\n",
      "P2 = (B2/BW2)*(98.)#fraction of signal power that is included in freuency band for 2nd case\n",
      "\n",
      "#results\n",
      "print \"i.Fraction of signal power that is included in freuency band for 1st case (percent) = \",P1\n",
      "print \"ii.Fraction of signal power that is included in freuency band for 2nd case (percent) = \",round(P2,1)\n",
      "print \"Note: Their is mistake in calculation of fraction of power of second case in text book\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Fraction of signal power that is included in freuency band for 1st case (percent) =  73.5\n",
        "ii.Fraction of signal power that is included in freuency band for 2nd case (percent) =  93.5\n",
        "Note: Their is mistake in calculation of fraction of power of second case in text book\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 31 - pg 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate te bandwidth of FM signal in both cases\n",
      "\n",
      "#given\n",
      "f_m1 = 2.*10**3#modulating frequency for first case\n",
      "delta_f1= 5.*10**3#frequency deviation for first case\n",
      "f_m2 = 1.*10**3#modulating frequency for second case\n",
      "delta_f2 = 3.*5*10**3#modulating frequency for second case\n",
      "\n",
      "#calculations\n",
      "BW1 = 2*(delta_f1 + f_m1)#bandwidth of the FM signal for first case\n",
      "BW2 = 2*(delta_f2 + f_m2)#bandwidth of the FM signal for secpnd case\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth of the FM signal for first case (kHz) = \",BW1/1000.\n",
      "print \"ii.Bandwidth of the FM signal for second case (kHz) = \",BW2/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth of the FM signal for first case (kHz) =  14.0\n",
        "ii.Bandwidth of the FM signal for second case (kHz) =  32.0\n"
       ]
      }
     ],
     "prompt_number": 46
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 32 - pg 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier power and in each side band\n",
      "\n",
      "#given\n",
      "m_f = .2#modulation index\n",
      "P = 10.*10**3#power of FM transmitter\n",
      "J_0m_f = 0.99#bessel function\n",
      "J_1m_f =0.099\n",
      "\n",
      "#calculations\n",
      "P_c = (J_0m_f)**2 * P#carrier power\n",
      "P_s1 = (J_1m_f)**2 * P#power in each side frequency\n",
      "P_s2 = P_s1\n",
      "\n",
      "#results\n",
      "print \"i.Carrier power (kW) = \",round(P_c/1000.,1)\n",
      "print \"ii.power in each side band (W) = \",round(P_s1,1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Carrier power (kW) =  9.8\n",
        "ii.power in each side band (W) =  98.0\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 33 - pg 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier swing, modulation index, highest and lowest frequencies attained\n",
      "\n",
      "#given\n",
      "f_m = 7.*10**3#modulating frequency\n",
      "delta_f = 50.*10**3#frequency deviation\n",
      "f_c = 107.6*10**6#carrier frequency\n",
      "\n",
      "#calculaitons\n",
      "CS = 2*delta_f#carrier swing\n",
      "m_f = delta_f/f_m#modulation index\n",
      "f_h = f_c + delta_f#upper or highest frequency\n",
      "f_l = f_c - delta_f#lower of lowest frequency\n",
      "\n",
      "#results\n",
      "print \"i.a.Carrier swing (kHz) = \",CS/10**3\n",
      "print \"  b.Modulation index = \",round(m_f,3)\n",
      "print \"ii.a.Highest frequency attained by the FM signal (MHz) = \",round(f_h/10**6,2)\n",
      "print \"   b.Lowest frequency attained by the FM signal (MHz) = \",round(f_l/10**6,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Carrier swing (kHz) =  100.0\n",
        "  b.Modulation index =  7.143\n",
        "ii.a.Highest frequency attained by the FM signal (MHz) =  107.65\n",
        "   b.Lowest frequency attained by the FM signal (MHz) =  107.55\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 34 - pg 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency deviation and carrier frequency\n",
      "\n",
      "#given\n",
      "f_c = 100.*10**6#carrier frequency\n",
      "f_u = 100.007*10**6#upper frequency\n",
      "\n",
      "#calculations\n",
      "delta_f = f_u - f_c#frequency deviation\n",
      "CS = 2*delta_f#carrier swing\n",
      "f_l = f_c - delta_f#lower frequency reached by the modulated FM wave \n",
      "\n",
      "#results\n",
      "print \"i.Frequency deviation (kHz) = \",delta_f/10**3\n",
      "print \"ii.Carrier frequency (kHz) = \",CS/10**3\n",
      "print \"iii.Lower frequency reached by the modulated FM wave (MHz) = \",round(f_l/10**6,3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Frequency deviation (kHz) =  7.0\n",
        "ii.Carrier frequency (kHz) =  14.0\n",
        "iii.Lower frequency reached by the modulated FM wave (MHz) =  99.993\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 35 - pg 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the Percentage modulation index\n",
      "\n",
      "#given\n",
      "CS = 125.*10**3#carrier swing\n",
      "\n",
      "#calculations\n",
      "delta_f = CS/2#frequency deviation\n",
      "#since,maximum frequency deviation for the FM broadcast band is 75 KHz, therefore \n",
      "f_m = 75.*10**3#modulating frequency\n",
      "m_f = delta_f*100/f_m#modulation index\n",
      "\n",
      "#result\n",
      "print \"Percentage modulation index (percent) = \",round(m_f,1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage modulation index (percent) =  83.3\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 36 - pg 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency deviation and modulation index for all cases\n",
      "\n",
      "#given\n",
      "#first case\n",
      "f_m1 = 500.#modulating frequency\n",
      "delta_f1 = 6.4*10**3#frequency deviation\n",
      "V_m1 = 3.2#modulating amplitude\n",
      "#second case\n",
      "V_m2 = 8.4#modulating amplitude\n",
      " #third case\n",
      "V_m3 = 20.#modulating amplitude\n",
      "f_m3 = 200.#modulating frequency\n",
      "\n",
      "#calculations\n",
      "k_f = delta_f1/V_m1#frequency sensitivity\n",
      "delta_f2 = k_f*V_m2#frequency deviation for second case\n",
      "delta_f3 = k_f*V_m3#frequency deviation for third  case\n",
      "m_1 = delta_f1/f_m1#modulation index for first case\n",
      "m_2 = delta_f2/f_m1#modulation index for second case\n",
      "m_3 = delta_f3/f_m3#modulation index for third case\n",
      "\n",
      "#results\n",
      "print \"i.a.Frequency deviation for first case (kHz) = \",delta_f1/10**3\n",
      "print \"  b.Modulation index for first case = \",m_1\n",
      "print \"ii.a.Frequency deviation for second case (kHz) = \",delta_f2/10**3\n",
      "print \"   b.Modulation index for second case = \",m_2\n",
      "print \"iii.a.Frequency deviation for third case (kHz) = \",delta_f3/10**3\n",
      "print \"    b.Modulation index for third case = \",m_3\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Frequency deviation for first case (kHz) =  6.4\n",
        "  b.Modulation index for first case =  12.8\n",
        "ii.a.Frequency deviation for second case (kHz) =  16.8\n",
        "   b.Modulation index for second case =  33.6\n",
        "iii.a.Frequency deviation for third case (kHz) =  40.0\n",
        "    b.Modulation index for third case =  200.0\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 37 - pg 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the carrier frequency, modulating frequency, modulation index, frequency deviation and power dissipated by the wave\n",
      "import math\n",
      "#given\n",
      "# s(t) = 20*sin(6*10**8*t + 7*sin(1250*t))\n",
      "#comparing with standard eqn s(t) = A*sin(w_c*t + m_f*sin(w_m*t))\n",
      "#we get \n",
      "w_c = 6.*10**8#carrier angular frequency in rad/sec\n",
      "w_m = 1250.#modulating angular frequency in rad/sec\n",
      "m_f = 7.#modualation index\n",
      "A = 20.#amplitude of modulated wave\n",
      "R = 100.#resistance\n",
      "\n",
      "#calculations\n",
      "f_c = w_c/(2*math.pi)#carrier frequency in hertz\n",
      "f_m = w_m/(2*math.pi)#modulating frequency in hertz\n",
      "delta_f = m_f*f_m#frequency deviation\n",
      "P = (A/math.sqrt(2))**2/R#power dissipated\n",
      "\n",
      "#results\n",
      "print \"i.Carrier frequency (MHz) = \",round(f_c/10**6,1)\n",
      "print \"ii.Modulating frequency (Hz) = \",round(f_m,0)\n",
      "print \"iii.Modulation index = \",m_f\n",
      "print \"iv.Frequency deviation (Hz) = \",round(delta_f,0)\n",
      "print \"v.Power dissipated by FM wave (W) = \",P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Carrier frequency (MHz) =  95.5\n",
        "ii.Modulating frequency (Hz) =  199.0\n",
        "iii.Modulation index =  7.0\n",
        "iv.Frequency deviation (Hz) =  1393.0\n",
        "v.Power dissipated by FM wave (W) =  2.0\n"
       ]
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 39 - pg 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the maximum frequency deviation\n",
      "import math\n",
      "#given\n",
      "#x_c(t) = 10*cos[(10**8*math.pi*t) + 5*sin(2*math.pi*10**3)t]\n",
      "#by comparing the given x_c(t) with standard FM wave equation\n",
      "t=10;\n",
      "w_c = 10**8#carreier frequency\n",
      "phi_t = 5*math.sin(2*math.pi*10**3*t);\n",
      "phi_1t = 5*2*math.pi*10**3*math.cos(2*math.pi*10**3*t)\n",
      "#Therefore, the maximum phase deviation will be\n",
      "phi_tmax = 5#radians\n",
      "\n",
      "#calculation\n",
      "delta_f = (5*10**3*2*math.pi)/(2*math.pi);#maximum frequency deviation\n",
      "\n",
      "#results\n",
      "print \"Maximum frequency deviation is (kHz) = \",delta_f/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum frequency deviation is (kHz) =  5.0\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 43 - pg 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth\n",
      "import math\n",
      "#given\n",
      "#x_c(t) = 10*cos(2*math.pi*10**8*t + 200*cos (2*math.pi*10**3*t))\n",
      "#instantaneous frequecy w_i = 2*math.pi*10**8 - 4*math.pi*10**6*sin(2*math.pi*10**3)\n",
      "delta_w = 4*math.pi*10**5#angular frequency deviation\n",
      "w_m = 2*math.pi*10**3#angulat modulating frequency\n",
      "\n",
      "#calculations \n",
      "beeta = delta_w/w_m;\n",
      "W_B1 = 2*(beeta + 1)*w_m;#angular bandwidth\n",
      "#since beeta >>1,therefore\n",
      "W_B1 = 2*delta_w#angular bandwidth\n",
      "#W_B==W_B1\n",
      "f_B = W_B1/(2*math.pi)#bandwidth in Hz\n",
      "\n",
      "#result\n",
      "print \"Bandwidth (kHz) = \",f_B/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bandwidth (kHz) =  400.0\n"
       ]
      }
     ],
     "prompt_number": 56
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 44 - pg 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the modulation index and bandwidth for all cases\n",
      "\n",
      "#given\n",
      "f_c  = 20.*10**6#carrier frequency\n",
      "delta_f = 100.*10**3#frequency deviation\n",
      "f_m1 = 1.*10**3#modulation index for first case\n",
      "f_m2 = 100.*10**3#modulation index for second case\n",
      "f_m3 = 500.*10**3#modulation index for third case \n",
      "\n",
      "#calculations\n",
      "beeta1 = delta_f/f_m1\n",
      "beeta2 = delta_f/f_m2\n",
      "beeta3 = delta_f/f_m3\n",
      "m_f1 = delta_f/f_m1#modulation index for first case\n",
      "m_f2 = delta_f/f_m2#modulation index for second case\n",
      "m_f3 = delta_f/f_m3#modulation index for third case\n",
      "f_B1 = 2*delta_f#bandwidth for first case since it is a WBFM signal\n",
      "f_B2 = 2*(beeta2 + 1)*f_m2#bandwidth for second case\n",
      "f_B3 = 2*f_m3#bandwidth for third case since it is a NBFM signal\n",
      "\n",
      "#results\n",
      "print \"i.a.Modulation index for first case = \",m_f1\n",
      "print \"  b.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
      "print \"ii.a.Modulation index for second case = \",m_f2\n",
      "print \"  b.Bandwidth for second case (kHz) = \",f_B2/1000.\n",
      "print \"iIi.a.Modulation index for third case = \",m_f3\n",
      "print \"  b.Bandwidth for third case (MHz) = \",f_B3/10**6\n",
      "print \"Note:Their is error in first case modulating frequency in text book\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.a.Modulation index for first case =  100.0\n",
        "  b.Bandwidth for first case (kHz) =  200.0\n",
        "ii.a.Modulation index for second case =  1.0\n",
        "  b.Bandwidth for second case (kHz) =  400.0\n",
        "iIi.a.Modulation index for third case =  0.2\n",
        "  b.Bandwidth for third case (MHz) =  1.0\n",
        "Note:Their is error in first case modulating frequency in text book\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 45 - pg 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth in all cases\n",
      "\n",
      "#given\n",
      "#x_c(t)  = 10*cos(w_c*t + 3*sin(w_m*t))\n",
      "#comparing with std eqn of PM signal x_PM(t) = A*cos(w_c*t + k_p*m(t))\n",
      "#m(t) = a_m*sin(w_m*t)\n",
      "#beeta = k_p*a_m\n",
      "beeta = 3;\n",
      "f_m1 = 1.*10**3#modulating frequency for first case\n",
      "f_m2 = 2.*10**3#modulating frequency for second case\n",
      "f_m3 = 500.#modulating frequency for third  case\n",
      "\n",
      "#calculations\n",
      "f_B1 = 2*(beeta + 1)*f_m1#bandwidth for first case\n",
      "f_B2 = 2*(beeta + 1)*f_m2#bandwidth for first case\n",
      "f_B3 = 2*(beeta + 1)*f_m3#bandwidth for first case\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
      "print \"ii.Bandwidth for second case (kHz) = \",f_B2/1000.\n",
      "print \"ii.Bandwidth for third case (kHz) = \",f_B3/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth for first case (kHz) =  8.0\n",
        "ii.Bandwidth for second case (kHz) =  16.0\n",
        "ii.Bandwidth for third case (kHz) =  4.0\n"
       ]
      }
     ],
     "prompt_number": 58
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 46 - pg 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth in all cases\n",
      "\n",
      "#given\n",
      "#x_cFM(t)  = 10*cos(w_c*t + 3*sin(w_m*t))\n",
      "#by omparing with standard equation i.e A*cos(w_c*t + beta*sin(w_m*t))\n",
      "#we get\n",
      "beta = 3.\n",
      "\n",
      "#calculations\n",
      "#first case\n",
      "f_m1 = 1.*10**3#modulating frequency for first case\n",
      "f_B1 = 2.*(beta +1)*f_m1#bandwidth for first case\n",
      "#second case\n",
      "beta2 = 3./2#beta for second case\n",
      "f_m2 = 2.*10**3#modulating frequency for second case\n",
      "f_B2 = 2.*(beta2 +1)*f_m2#bandwidth for second case\n",
      "#third case\n",
      "beta3 = 6.#beta for third case\n",
      "f_m3 = .5*10**3#modulating frequency for third case\n",
      "f_B3 = 2*(beta3 +1)*f_m3#bandwidth for third case\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth for first case (Hz) = \",f_B1/1000.\n",
      "print \"ii.Bandwidth for second case (Hz) = \",f_B2/1000.\n",
      "print \"ii.Bandwidth for third case (Hz) = \",f_B3/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth for first case (Hz) =  8.0\n",
        "ii.Bandwidth for second case (Hz) =  10.0\n",
        "ii.Bandwidth for third case (Hz) =  7.0\n"
       ]
      }
     ],
     "prompt_number": 59
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 47 - pg 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth, frequency deviation\n",
      "\n",
      "#given\n",
      "f_m = 2.*10**3#modulating frequency for first case\n",
      "delta_f1 = 5.*10**3#frequency deviation for first case\n",
      "f_m1 = 1.*10**3#modulating frequency for second case\n",
      "#beeta = (k_f*a_m)/(w_m) = delta_f/f_m\n",
      "\n",
      "#calculations\n",
      "beeta = delta_f1/f_m\n",
      "f_B1 = 2*(beeta + 1)*f_m#bandwidth for first case\n",
      "#beeta1 = (k_f*3*a_m)/(.5*w_m) = delta_f/f_m  therefore\n",
      "beeta1 = 6*beeta\n",
      "delta_f2 = beeta1 * f_m1 #frequency deviation for second case\n",
      "f_B2 = 2*(beeta1 + 1)*f_m1#bandwidth for second case\n",
      "\n",
      "#results\n",
      "print \"i.Bandwidth for first case (kHz) = \",f_B1/1000.\n",
      "print \"ii.a.Frequency deviation for second case (kHz) = \",delta_f2/1000.\n",
      "print \"   b.Bandwidth for second case (kHz) = \",f_B2/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth for first case (kHz) =  14.0\n",
        "ii.a.Frequency deviation for second case (kHz) =  15.0\n",
        "   b.Bandwidth for second case (kHz) =  32.0\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 48 - pg 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the bandwidth\n",
      "\n",
      "#given\n",
      "delta_f = 75.*10**3#frequency deviation\n",
      "f_M = 15.*10**3#modulating frequency\n",
      "\n",
      "#calculations\n",
      "#we have w_m = 2*%pi*f_M where f_M = 15KHz,we get\n",
      "D = delta_f/f_M#deviation ratio\n",
      "#by using thr given formula, the bandwidth will be\n",
      "f_B1 = 2*(D+2)*f_M\n",
      "#Using Carson's rule, the bandwidt will be \n",
      "f_B2 = 2*(D+1)*f_M\n",
      "\n",
      "#results \n",
      "print \"i.Bandwidth calculation using the given formula (kHz) = \",f_B1/1000.\n",
      "print \"ii.Bandwidth calculation using the carson rule (kHz) = \",f_B2/1000.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Bandwidth calculation using the given formula (kHz) =  210.0\n",
        "ii.Bandwidth calculation using the carson rule (kHz) =  180.0\n"
       ]
      }
     ],
     "prompt_number": 62
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 49 - pg 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency multiplication and maximum allowed frequency deviation\n",
      "\n",
      "#given\n",
      "#x_NBFM(t) = A*cos(w_c*t + sin(w_m*t))\n",
      "f_c = 200.*10**3#carrier frequency\n",
      "f_m_max = 15.*10**3#maximum modulating frequency\n",
      "f_m_min = 50.#minimum modulating frequency\n",
      "delta_f = 75.*10**3#maximum frequency deviation\n",
      "\n",
      "#calculations\n",
      "beeta_min = delta_f/f_m_max;\n",
      "beeta_max = delta_f/f_m_min;\n",
      "#if beeta_1 =.5, where beeta_1 is the input beeta, then the required frequency multiplication will be\n",
      "beeta_1 = .5\n",
      "n = beeta_max/beeta_1#frequency multiplication \n",
      "delta_f1 = delta_f/n#maximum allowed frequency deviation\n",
      "\n",
      "#results\n",
      "print \"i.Frequency multiplication = \",n\n",
      "print \"ii.Maximum allowed frequency deviation (Hz) = \",delta_f1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Frequency multiplication =  3000.0\n",
        "ii.Maximum allowed frequency deviation (Hz) =  25.0\n"
       ]
      }
     ],
     "prompt_number": 63
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 50 - pg 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the maximum frequency deviation and carrier frequency\n",
      "\n",
      "#given\n",
      "f_1 = 200.*10**3#frequency applied at first stage \n",
      "delta_f1 = 25.#frequency deviation at first stage\n",
      "n1 = 64.#frequency multiplication at first stage\n",
      "n2 = 48.#frequency multiplication at second stage\n",
      "f_LO = 10.8*10**6#frequency of oscillator as shown if block diagram\n",
      "\n",
      "#calculations\n",
      "delta_f = delta_f1*n1*n2#maximum frequency deviation\n",
      "f_2 = n1*f_1#frequency applied at second stage\n",
      "f_3a = f_2 + f_LO#frequency applied the third stage \n",
      "f_3b = f_2 - f_LO#frequency applied the third stage\n",
      "f_c1 = n2*f_3a#carrier frequency for maximun f_3\n",
      "f_c2 = n2*f_3b#carrier frequency for minimum f_3\n",
      "\n",
      "#results\n",
      "print \"i.Maximum frequency deviation (kHz) = \",delta_f/1000.\n",
      "print \"ii.a.Carrier frequency for maximum f_3 (MHz) = \",f_c1/1000000.\n",
      "print \"   b.Carrier frequency for minimum f_3 (MHz) = \",f_c2/1000000.\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Maximum frequency deviation (kHz) =  76.8\n",
        "ii.a.Carrier frequency for maximum f_3 (MHz) =  1132.8\n",
        "   b.Carrier frequency for minimum f_3 (MHz) =  96.0\n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 51 - pg 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the mixer oscillator frequency\n",
      "\n",
      "#given\n",
      "f_c = 108.*10**6#carrier frequency\n",
      "f_1 = 2.*10**5#crystal oscillator frequency\n",
      "beta = .2#phase deviation\n",
      "f_m = 50.#minimum frequency \n",
      "delta_f = 75.*10**3#frequency deviation\n",
      "n_2 = 150.\n",
      "\n",
      "#calculations\n",
      "delta_f1 = beta * f_m;\n",
      "n_12 = delta_f /delta_f1;\n",
      "#f_2 = n_1*f_1 = n_1 * 2*10**5Hz\n",
      "#assuming down convertions, we have\n",
      "#f_2 - f_LO = (f_c/n_2)\n",
      "#thus\n",
      "f_LO = ((n_12*f_1) - f_c)/n_2;\n",
      "n_1 = n_12/n_2\n",
      "\n",
      "#results\n",
      "print \" n_1 = \",n_1\n",
      "print \" Mixer oscillator frequency (MHz) = \",f_LO/10**6\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " n_1 =  50.0\n",
        " Mixer oscillator frequency (MHz) =  9.28\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 52 - pg 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the frequency multiplication for both PM and FM waves\n",
      "\n",
      "#given\n",
      "delta_f = 50.#frequency deviation\n",
      "delta_f2 = 20.*10**3#frequency deviation for sinusoidal FM wave i.e second case\n",
      "f_m1 = 120.#modualting frequency for first case\n",
      "f_m2 = 240.#modulating frquency for second case\n",
      "\n",
      "#calculations\n",
      "#first case\n",
      "delta_f1 = (f_m2/f_m1)*delta_f#frequency deviation for sinusoidal PM wave\n",
      "n1 = delta_f2/delta_f1#frequency multiplication for sinusoidal PM wave\n",
      "#second case\n",
      "n2 = delta_f2/delta_f#frequency multiplication for sinusoidal FM wave\n",
      "\n",
      "#results\n",
      "print \"i.Frequency multiplication for PM wave = \",n1\n",
      "print \"ii.Frequency multiplication for FM wave = \",n2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "i.Frequency multiplication for PM wave =  200.0\n",
        "ii.Frequency multiplication for FM wave =  400.0\n"
       ]
      }
     ],
     "prompt_number": 66
    }
   ],
   "metadata": {}
  }
 ]
}