{
 "metadata": {
  "name": "",
  "signature": "sha256:bcad4cfb691dedbc6343f0aa16a777a3c81354536e69fb16f52f5b492443bac9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 13 : Performance of Modulation systems with noise"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.1  Page No : 442"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Gb = 1.;\n",
      "print 'a) SSB:  Gb = %i  '%(Gb);\n",
      "print '   GbdB = %i  dB'%(10*math.log10(Gb));\n",
      "print 'b) DSB:  Gb = %i  '%(Gb);\n",
      "print '   GbdB = %i  dB'%(10*math.log10(Gb));\n",
      "m = 0.5;\n",
      "Gb = m**2/(2+m**2);\n",
      "print 'c) AMm = .5):  Gb = %.3f  '%(Gb);\n",
      "print '   GbdB = %.3f  dB'%(10*math.log10(Gb));\n",
      "m = 1.;\n",
      "Gb = m**2/(2+m**2);\n",
      "print 'd) AMm = 1):  Gb = %.3f  '%(Gb);\n",
      "print '   GbdB = %.3f  dB'%(10*math.log10(Gb));\n",
      "delta_phi = 5.;\n",
      "Gb = delta_phi**2/2;\n",
      "print 'e) FMdelta phi = 5)):  Gb = %.1f  '%(Gb);\n",
      "print '   GbdB = %.3f  dB'%(10*math.log10(Gb));\n",
      "D = 5.;\n",
      "Gb = 3.*D**2/2;\n",
      "print 'f) FMD = 5):  Gb = %.1f  '%(Gb);\n",
      "print '   GbdB = %.3f  dB'%(10*math.log10(Gb));\n",
      "Wf1 = 7.07;\n",
      "Gb = 3./2*D**2*math.pi/6*Wf1;\n",
      "print 'g) FMD = 5, W/f1 = 7.07):  Gb = %.1f  '%(Gb);\n",
      "print '   GbdB = %.2f  dB'%(10*math.log10(Gb));\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) SSB:  Gb = 1  \n",
        "   GbdB = 0  dB\n",
        "b) DSB:  Gb = 1  \n",
        "   GbdB = 0  dB\n",
        "c) AMm = .5):  Gb = 0.111  \n",
        "   GbdB = -9.542  dB\n",
        "d) AMm = 1):  Gb = 0.333  \n",
        "   GbdB = -4.771  dB\n",
        "e) FMdelta phi = 5)):  Gb = 12.5  \n",
        "   GbdB = 10.969  dB\n",
        "f) FMD = 5):  Gb = 37.5  \n",
        "   GbdB = 15.740  dB\n",
        "g) FMD = 5, W/f1 = 7.07):  Gb = 138.8  \n",
        "   GbdB = 21.42  dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.2  Page No : 443"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Calculations and Results\n",
      "GR = 1.;\n",
      "print 'a) SSB:  GR = %i  '%(GR);\n",
      "print '   GRdB = %i  dB'%(10*math.log10(GR));\n",
      "GR = 2.;\n",
      "print 'b) DSB:  GR = %i  '%(GR);\n",
      "print '   GRdB = %.2f  dB'%(10*math.log10(GR));\n",
      "m = 0.5;\n",
      "GR = 2*m**2/(2+m**2);\n",
      "print 'c) AMm = .5):  GR = %.4f  '%(GR);\n",
      "print '   GRdB = %.3f  dB'%(10*math.log10(GR));\n",
      "m = 1.;\n",
      "GR = 2*m**2/(2+m**2);\n",
      "print 'd) AMm = 1):  GR = %.3f  '%(GR);\n",
      "print '   GRdB = %.2f  dB'%(10*math.log10(GR));\n",
      "delta_phi = 5.;\n",
      "GR = (1+delta_phi)*delta_phi**2;\n",
      "print 'e) FMdelta phi = 5)):  GR = %.1f  '%(GR);\n",
      "print '   GRdB = %.3f  dB'%(10*math.log10(GR));\n",
      "D = 5.;\n",
      "GR = 3*D**2*(1+D);\n",
      "print 'f) FMD = 5):  GR = %.1f  '%(GR);\n",
      "print '   GRdB = %.3f  dB'%(10*math.log10(GR));\n",
      "Wf1 = 7.07;\n",
      "GR = 3*(1+D)*D**2*math.pi/6*Wf1;\n",
      "print 'g) FMD = 5, W/f1 = 7.07):  GR = %.1f  '%(GR);\n",
      "print '   GRdB = %.2f  dB'%(10*math.log10(GR));\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) SSB:  GR = 1  \n",
        "   GRdB = 0  dB\n",
        "b) DSB:  GR = 2  \n",
        "   GRdB = 3.01  dB\n",
        "c) AMm = .5):  GR = 0.2222  \n",
        "   GRdB = -6.532  dB\n",
        "d) AMm = 1):  GR = 0.667  \n",
        "   GRdB = -1.76  dB\n",
        "e) FMdelta phi = 5)):  GR = 150.0  \n",
        "   GRdB = 21.761  dB\n",
        "f) FMD = 5):  GR = 450.0  \n",
        "   GRdB = 26.532  dB\n",
        "g) FMD = 5, W/f1 = 7.07):  GR = 1665.8  \n",
        "   GRdB = 32.22  dB\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.3  Page No : 447"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "k = 1.38*10**-23;   #Boltzmann's const\n",
      "#Temperatures in K\n",
      "Ti = 150.;\n",
      "Te = 325.;\n",
      "\n",
      "# Calculations and Results\n",
      "Tsys = Ti+Te;\n",
      "print ' Tsys = %i K '%(Tsys);\n",
      "D = 5;\n",
      "W = 15;   #kHz\n",
      "B = 2*(1+D)*W;\n",
      "print '  B = %i  kHz'%(B);\n",
      "Nsys = k*Tsys*B*10**3;   #W\n",
      "print '  Nsys = %.3f fW'%(Nsys*10**15);\n",
      "PR = 50*10**-12;   #W\n",
      "SNsys = PR/Nsys; \n",
      "print '  S/N)sys = %i  '%(SNsys);\n",
      "GR = 3*(1+D)*D**2\n",
      "print '  GR = %.0f  '%(GR);\n",
      "SNoutput = GR*SNsys;\n",
      "print '  S/N)output = %.0f  '%(SNoutput);\n",
      "print '  S/N)out,dB = %.2f  dB'%(10*math.log10(SNoutput));\n",
      "print '  S/N)sys, dB = %.2f  dB'%(10*math.log10(SNsys));\n",
      "GRdb = 10*math.log10(GR);\n",
      "print '  GR, dB = %.2f dB '%(GRdb);\n",
      "print '  S/N)output ,dB = %.2f  dB'%(10*math.log10(SNoutput));\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Tsys = 475 K \n",
        "  B = 180  kHz\n",
        "  Nsys = 1.180 fW\n",
        "  S/N)sys = 42376  \n",
        "  GR = 450  \n",
        "  S/N)output = 19069413  \n",
        "  S/N)out,dB = 72.80  dB\n",
        "  S/N)sys, dB = 46.27  dB\n",
        "  GR, dB = 26.53 dB \n",
        "  S/N)output ,dB = 72.80  dB\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.4  Page No : 450"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "N = 16;  #bit\n",
      "\n",
      "# Calculations\n",
      "SNoutdB = 1.76+6.02*N;\n",
      "\n",
      "# Results\n",
      "print ' (S/N)output, dB = %.2f dB '%(SNoutdB);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " (S/N)output, dB = 98.08 dB \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.5  Page No : 450"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "SNoutdB = 53;\n",
      "\n",
      "# Calculations and Results\n",
      "N = (SNoutdB-1.76)/6.02;\n",
      "print ' N = %.2f bits '%(N);\n",
      "N = 9;   #roundup\n",
      "print ' N = %i bits '%(N);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " N = 8.51 bits \n",
        " N = 9 bits \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.6  Page No : 453"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "N = 6.;   #bits per word\n",
      "\n",
      "# Calculations and Results\n",
      "M = 2**N;\n",
      "print ' M = %i  '%(M);\n",
      "Pr = 200.*10**-15;   #W\n",
      "R = 2.*10**6;   #bits/s\n",
      "Eb = Pr/R;\n",
      "print ' Bit energy ,Eb = %.0f*10**-21  '%(Eb*10**21);\n",
      "k = 1.38*10**-23;   #Boltzmann cons\n",
      "Ti = 300.;  #K\n",
      "Te = 425.;  #K\n",
      "Tsys = Ti+Te;\n",
      "nsys = k*Tsys;                 \n",
      "print '  Noise power spectral density ,nsys = %.0f*10**-20 W/Hz '%(nsys*10**20);\n",
      "rho = Eb/nsys;\n",
      "print ' Bit energy , rho = %.0f  '%(rho);\n",
      "rhodB = 10*math.log10(rho);\n",
      "print ' Bit energy in db, rho,dB = %.0f dB '%(rhodB);\n",
      "#part a\n",
      "Pe = 4*10**-6;\n",
      "SNout = 1.5*M**2/(1+4*M**2*Pe);\n",
      "print ' a) S/N)output = %.0f or %0.2f  dB) '%(SNout,10*math.log10(SNout));\n",
      "#part b\n",
      "Pe = 2.3*10**-5;\n",
      "SNout = 1.5*M**2/(1+4*M**2*Pe);\n",
      "print ' b) S/N)output = %.0f or %0.2f  dB) '%(SNout,10*math.log10(SNout));\n",
      "#part c\n",
      "Pe = 8*10**-4;\n",
      "SNout = 1.5*M**2/(1+4*M**2*Pe);\n",
      "print ' c) S/N)output = %.1f or %0.2f  dB) '%(SNout,10*math.log10(SNout));\n",
      "#part d\n",
      "Pe = 3.5*10**-3;\n",
      "SNout = 1.5*M**2/(1+4*M**2*Pe);\n",
      "print ' d) S/N)output = %.1f or %0.2f  dB) '%(SNout,10*math.log10(SNout));\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " M = 64  \n",
        " Bit energy ,Eb = 100*10**-21  \n",
        "  Noise power spectral density ,nsys = 1*10**-20 W/Hz \n",
        " Bit energy , rho = 10  \n",
        " Bit energy in db, rho,dB = 10 dB \n",
        " a) S/N)output = 5766 or 37.61  dB) \n",
        " b) S/N)output = 4462 or 36.50  dB) \n",
        " c) S/N)output = 435.5 or 26.39  dB) \n",
        " d) S/N)output = 105.3 or 20.22  dB) \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.7  Page No : 455"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "#data from ex 13.6\n",
      "M = 2.**6;\n",
      "Pr = 200.*10**-15;   #W\n",
      "R = 8.*10**6;   #bits/s    (changed)\n",
      "Eb = Pr/R;\n",
      "\n",
      "# Calculations and Results\n",
      "k = 1.38*10**-23;   #Boltzmann cons\n",
      "Ti = 300;  #K\n",
      "Te = 425;  #K\n",
      "Tsys = Ti+Te;\n",
      "nsys = k*Tsys;                 \n",
      "#print '  Noise power spectral density %(nsys = %.0f*10**-20 W/Hz '%(nsys*10**20);\n",
      "rho = Eb/nsys;\n",
      "print ' Bit energy , rho = %.1f  '%(rho);\n",
      "rhodB = 10*math.log10(rho);\n",
      "print ' Bit energy in db, rho,dB = %.2f dB '%(rhodB);\n",
      "\n",
      "Pe = 1.3*10**-2;\n",
      "SNout = 1.5*M**2/(1+4*M**2*Pe);\n",
      "print '  S/N)output = %.2f or %0.2f  dB) '%(SNout,10*math.log10(SNout));\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Bit energy , rho = 2.5  \n",
        " Bit energy in db, rho,dB = 3.98 dB \n",
        "  S/N)output = 28.71 or 14.58  dB) \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.8  Page No : 455"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Pe = 10.**-5;\n",
      "R = 1*10**6;  #bits/s\n",
      "k = 1.38*10**-23;   #Boltzmann cons\n",
      "Ti = 475.;  #K\n",
      "Te = 250.;  #K\n",
      "Tsys = Ti+Te;\n",
      "nsys = k*Tsys;  #W/Hz  \n",
      "\n",
      "# Calculations\n",
      "def E(rhodb):    #function for Eb\n",
      "    rho = 10**(rhodb/10);\n",
      "    return nsys*rho;\n",
      "\n",
      "def P(E):      #function for Pr\n",
      "    return R*Eb;\n",
      "\n",
      "def lay(rhodb,pt):\n",
      "    Eb = E(rhodb);\n",
      "    print P(E);\n",
      "    print '%c)Bit energy , Eb = %.2f*10**-21 J '%(pt,Eb*10**21);\n",
      "    print ' Required reciver carrier power , Pr = %.2f fW '%(Pr*10**15);\n",
      "\n",
      "#Part a\n",
      "rhodb = 9.6;\n",
      "lay(rhodb,'a');\n",
      "\n",
      "#Part b\n",
      "rhodb = 10.3;\n",
      "lay(rhodb,'b');\n",
      "\n",
      "#Part c\n",
      "rhodb = 12.6;\n",
      "lay(rhodb,'c');\n",
      "\n",
      "#Part d\n",
      "rhodb = 13.4;\n",
      "lay(rhodb,'d');\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "2.5e-14\n",
        "a)Bit energy , Eb = 91.25*10**-21 J \n",
        " Required reciver carrier power , Pr = 200.00 fW \n",
        "2.5e-14\n",
        "b)Bit energy , Eb = 107.21*10**-21 J \n",
        " Required reciver carrier power , Pr = 200.00 fW \n",
        "2.5e-14\n",
        "c)Bit energy , Eb = 182.06*10**-21 J \n",
        " Required reciver carrier power , Pr = 200.00 fW \n",
        "2.5e-14\n",
        "d)Bit energy , Eb = 218.89*10**-21 J \n",
        " Required reciver carrier power , Pr = 200.00 fW \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13.9  Page No : 456"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#Data form ex13.8\n",
      "\n",
      "# Variables\n",
      "Pe = 10**-5;\n",
      "R = 2*10**6;  #bits/s  (changed)\n",
      "k = 1.38*10**-23;   #Boltzmann cons\n",
      "Ti = 475;  #K\n",
      "Te = 250;  #K\n",
      "Tsys = Ti+Te;\n",
      "nsys = k*Tsys;  #W/Hz  \n",
      "\n",
      "# Calculations\n",
      "def E(rhodb):    #function for Eb\n",
      "    rho = 10**(rhodb/10);\n",
      "    return nsys*rho;\n",
      "\n",
      "def P(E):      #function for Pr\n",
      "    return R*Eb;\n",
      "\n",
      "\n",
      "rhodb = 9.6;\n",
      "Eb = E(rhodb);\n",
      "Pr = P(E);\n",
      "\n",
      "# Results\n",
      "print 'Bit energy , Eb = %.2f*10**-21 J '%(Eb*10**21);\n",
      "print ' Required reciver carrier power , Pr = %.2f fW '%(Pr*10**15);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Bit energy , Eb = 91.25*10**-21 J \n",
        " Required reciver carrier power , Pr = 182.49 fW \n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}