{
 "metadata": {
  "name": "",
  "signature": "sha256:615d7f0f6b3e955a50e2f9605f0b653dcb4d15c58dac91605793187b40e98aa3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16 : Communication link analysis and Design"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.1  Page No : 518"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "c = 3.*10**8;  #speed of light\n",
      "Pt = 5.    #W\n",
      "GtdB = 13.;  #dB\n",
      "GrdB = 17.;  #dB\n",
      "d = 80.*10**3;  #metre\n",
      "f = 3.*10**9;   #frequency\n",
      "\n",
      "# Calculations and Results\n",
      "lembda = c/f;   #wavelength\n",
      "print 'The wavelength is,  =  %.1f m'%(lembda);\n",
      "\n",
      "Gt = 10**(GtdB/10);\n",
      "Gr = 10**(GrdB/10);\n",
      "print ' Gt = %.2f  '%(Gt);\n",
      "print ' Gr = %.2f  '%(Gr);\n",
      "Pr = lembda**2*Gt*Gr*Pt/((4*math.pi)**2*d**2);\n",
      "print ' Pr = %.1f pW '%(Pr*10**12);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength is,  =  0.1 m\n",
        " Gt = 19.95  \n",
        " Gr = 50.12  \n",
        " Pr = 49.5 pW \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.2  Page No : 520"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "# Variables\n",
      "c = 3.*10**8;  #speed of light\n",
      "Pt = 5.    #W\n",
      "GtdB = 13.;  #dB\n",
      "GrdB = 17.;  #dB\n",
      "d = 80.;  #in km\n",
      "f = 3.;   #frequency in GHz\n",
      "\n",
      "# Calculations and Results\n",
      "PtdBW = 10*math.log10(Pt);\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print 'The path loss is, (alfa_1dB)  =  %.2f dB'%(alfa1_dB);\n",
      "\n",
      "PrdBW = PtdBW+GtdB+GrdB-alfa1_dB;   #calculation of recieved power in dB\n",
      "print ' PrdBW) = %.2f  dBW'%(PrdBW)\n",
      " \n",
      "Pr = 10**(PrdBW/10);   #recieved power in Watts\n",
      "print ' Pr = %.1f pW '%(Pr*10**12);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The path loss is, (alfa_1dB)  =  140.04 dB\n",
        " PrdBW) = -103.05  dBW\n",
        " Pr = 49.5 pW \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.3  Page No : 521"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "d = 240000.*1.609;  #in km\n",
      "#part a\n",
      "f = 100.;   #frequency in MHz\n",
      "\n",
      "# Calculations and Results\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+32.44;  #dB\n",
      "print 'a) The path loss is %.2f dB'%(alfa1_dB);\n",
      "#part b\n",
      "f = 1;   #frequency in GHz\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print ' b) The path loss is %.2f dB'%(alfa1_dB);\n",
      "#part c\n",
      "f = 10;   #frequency in GHz\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print ' c) The path loss is %.2f dB'%(alfa1_dB);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The path loss is 184.18 dB\n",
        " b) The path loss is 204.18 dB\n",
        " c) The path loss is 224.18 dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.4  Page No : 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "f = 1.;  #in GHz\n",
      "#part a\n",
      "d = 1.;   #in Km\n",
      "\n",
      "# Calculations and Results\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print 'a) The path loss is %.2f dB'%(alfa1_dB);\n",
      "#part b\n",
      "d = 10;   #in km\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print ' b) The path loss is %.2f dB'%(alfa1_dB);\n",
      "#part c\n",
      "d = 100;   #in km\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #dB\n",
      "print ' c) The path loss is %.2f dB'%(alfa1_dB);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) The path loss is 92.44 dB\n",
        " b) The path loss is 112.44 dB\n",
        " c) The path loss is 132.44 dB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.5  Page No : 522"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Pr = 50*10**-12;  #in Watts\n",
      "GtdB = 3;  #dB\n",
      "GrdB = 4;  #dB\n",
      "d = 80;  #kilo-metre\n",
      "f = 500;   #frequency in MHz\n",
      "\n",
      "# Calculations and Results\n",
      "PrdBW = 10*math.log10(Pr);   #in dB conversion\n",
      "print 'PrdBW) = %.2f  dBW'%(PrdBW)\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+32.44;  #path loss in dB\n",
      "print ' The path loss is, %.2f dB'%(alfa1_dB);\n",
      "PtdBW = PrdBW+alfa1_dB-GtdB-GrdB;   #calculation of transmitted  power in dB\n",
      "print ' PtdBW) = %.2f  dBW'%(PtdBW)\n",
      "Pt = 10**(PtdBW/10);   #transmitted power in Watts\n",
      "print ' Pt = %.1f W '%(Pt);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "PrdBW) = -103.01  dBW\n",
        " The path loss is, 124.48 dB\n",
        " PtdBW) = 14.47  dBW\n",
        " Pt = 28.0 W \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.6  Page No : 523"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Pr = 200.;  #in f-Watts\n",
      "GtdB = 30.;  #dB\n",
      "GrdB = 20.;  #dB\n",
      "d = 40000.;  #kilo-metre\n",
      "f = 4.;   #frequency in GHz\n",
      "\n",
      "# Calculations and Results\n",
      "PrdBf = 10*math.log10(Pr);   #in dBf conversion\n",
      "print 'PrdBf) = %.2f  dBf'%(PrdBf)\n",
      "alfa1_dB = 20*math.log10(f)+20*math.log10(d)+92.44;  #path loss in dB\n",
      "print ' The path loss is, %.2f dB'%(alfa1_dB);\n",
      "PtdBf = PrdBf+alfa1_dB-GtdB-GrdB;   #calculation of transmitted  power in dBf\n",
      "PtdBW = PtdBf-150;   #calculation of transmitted  power in dBW\n",
      "print ' PtdBf) = %.2f  dBf OR %.2f dBW'%(PtdBf,PtdBW)\n",
      "Pt = 10**(PtdBW/10);   #transmitted power in Watts\n",
      "print ' Pt = %.2f W '%(Pt);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "PrdBf) = 23.01  dBf\n",
        " The path loss is, 196.52 dB\n",
        " PtdBf) = 169.53  dBf OR 19.53 dBW\n",
        " Pt = 89.80 W \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.7  Page No : 525"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "hT = 50.;  #m\n",
      "hR = 5.;   #m\n",
      "\n",
      "# Calculations\n",
      "d_km = math.sqrt(17*hT)+math.sqrt(17*hR);   #in km\n",
      "\n",
      "# Results\n",
      "print ' dkm) = %.2f Km '%(d_km);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " dkm) = 38.37 Km \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.8  Page No : 528"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "Pt = 10000.;  #Watts\n",
      "Gt = 25.;     #dB\n",
      "f = 3;        #GHz\n",
      "d = 50;     #km\n",
      "sigma = 20   #radar cross section in m**2\n",
      "\n",
      "# Calculations and Results\n",
      "alfa2_dB = 20*math.log10(f)+40*math.log10(d)+163.43-10*math.log10(sigma);   #alfa2(dB) calculation\n",
      "print ' The two way path loss is (alfa2dB) =  %.2f dB'%(alfa2_dB);\n",
      "PtdBW = 10*math.log10(Pt);   #transmitted  power in dB\n",
      "print ' PtdBW) = %i  dBW'%(PtdBW)\n",
      "PrdBW = PtdBW+2*Gt-alfa2_dB   #dBW\n",
      "print ' PrdBW) = %.2f dBW '%(PrdBW);\n",
      "Pr = 10**(PrdBW/10);\n",
      "print ' Pr = %.2f fW'%(Pr*10**15);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The two way path loss is (alfa2dB) =  227.92 dB\n",
        " PtdBW) = 40  dBW\n",
        " PrdBW) = -137.92 dBW \n",
        " Pr = 16.14 fW\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.9  Page No : 530"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 3*10**8;    #speed of light in m/s\n",
      "Td = 400*10**-6     #s\n",
      "\n",
      "# Calculations\n",
      "d = c*Td/2.       #in m\n",
      "\n",
      "# Results\n",
      "print ' d = %.0f Km '%(d*10**-3);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " d = 60 Km \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.10  Page No : 530"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 3.*10**8;    #speed of light in m/s\n",
      "fp = 2.*10**3;   #Hz\n",
      "\n",
      "# Calculations and Results\n",
      "T = 1./fp     #s\n",
      "dmax = c*T/2       #in m\n",
      "print 'a) d max = %.0f Km '%(dmax*10**-3);\n",
      "tau = 6.*10**-6;   #s\n",
      "dmin = c*tau/2   #m\n",
      "print 'b) d min = %.0f m '%(dmin);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) d max = 75 Km \n",
        "b) d min = 900 m \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.11  Page No : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 3.*10**8;    #speed of light in m/s\n",
      "fc = 15.*10**9;   #Hz\n",
      "v = 25.     # speed in m/s\n",
      "\n",
      "# Calculations\n",
      "fD = 2*v/c*fc;    #Hz\n",
      "\n",
      "# Results\n",
      "print 'Doppler shift , fD = %.0f Hz '%(fD);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Doppler shift , fD = 2500 Hz \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.12  Page No : 532"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "c = 186000.;    #speed of light in mi/s\n",
      "fc = 10.*10**9;   #Hz\n",
      "fD = 2.*10**3;    #frequency shift in Hz\n",
      "\n",
      "# Calculations and Results\n",
      "v = c*fD/(2*fc);  #speed in mi/s\n",
      "print 'Speed of automobile , v = %.2f*10**-3 mi/s '%(v*10**3);\n",
      "v = 3600*v;\n",
      "print ' v = %.1f mi/hr '%(v);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Speed of automobile , v = 18.60*10**-3 mi/s \n",
        " v = 67.0 mi/hr \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16.13  Page No : 535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variables\n",
      "n1 = 1.;    #refraction index of air\n",
      "E2 = 4.     #material dielectric consmath.tant\n",
      "theta_i = 50.   #angle of incidence in degree  (misprinted in the solution)\n",
      "\n",
      "# Calculations\n",
      "n2 = math.sqrt(E2);\n",
      "theta_r = math.asin(n1/n2*math.sin(theta_i*math.pi/180));\n",
      "\n",
      "# Results\n",
      "print ' The angle of refraction is %.2f  using angle of incidence  = 50)'%(theta_r*180/math.pi);\n",
      "#misprinted angle \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The angle of refraction is 22.52  using angle of incidence  = 50)\n"
       ]
      }
     ],
     "prompt_number": 15
    }
   ],
   "metadata": {}
  }
 ]
}