{
 "metadata": {
  "name": "",
  "signature": "sha256:96a38b155c26c97063e77fe8577e3f296680b817f9d32a51b849112570ac20e9"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER 2 - 2 Mobile Communication Engineering "
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.1- PG NO.38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 38\n",
      "import math\n",
      "r1=1.\n",
      "y=20.*math.log10(r1/(2.*r1))\n",
      "Delc1=y#change in recieved signal strengths\n",
      "print'%s %d %s' %('\\ndel when r2=2r1 =',Delc1,'dB')\n",
      "Delc2=20.*math.log10(r1/(10.*r1))##change in recieved signal strengths\n",
      "print'%s %d %s' %('\\ndel when r2=10r1 =',Delc2,'dB')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "del when r2=2r1 = -6 dB\n",
        "\n",
        "del when r2=10r1 = -20 dB\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.2 - PG NO. 39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 39\n",
      "import math\n",
      "r1=1.\n",
      "y=40.*math.log10(r1/(2.*r1))\n",
      "Delc1=round(y)#change in recieved signal strengths\n",
      "print '%s %d %s' %('del when r2=2r1 is =',Delc1,'dB')\n",
      "Delc2=40.*math.log10(r1/(10.*r1))#change in recieved signal strengths\n",
      "print '%s %d %s' %('delc when r2=10r1 is =',Delc2,'dB')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "del when r2=2r1 is = -12 dB\n",
        "delc when r2=10r1 is = -40 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.3 - PG NO. 41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 41 \t\n",
      "import math\n",
      "fc=900.*10.**6. \n",
      "c=3.*10.**8. \n",
      "yc=c/fc#wavelength of transmission\n",
      "ddir=1000.\n",
      "dref=1000.\n",
      "Angle=120.\n",
      "Q=120./2.\n",
      "tdir=ddir/c#time taken by direct path\n",
      "tref=dref/(c*math.sin(Q*math.pi/180.))#time taken by reflected path\n",
      "delay=tref-tdir\n",
      "print'%s %.2f %s' %('delay is =',delay*10**6,'microsec')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "delay is = 0.52 microsec\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.4 - PG NO. 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 47\n",
      "Vm=60.*5./18.#speed of mobile in m/s\n",
      "fc1=900.*10.**6.#frequency of operation\n",
      "fc2=1900.*10.**6.#frequency of operation\n",
      "c=3.*10.**8.#speed of radio waves\n",
      "Tf1=c/(2.*fc1*Vm)\n",
      "Tf2=c/(2.*fc2*Vm)\n",
      "print '%s %.f %s' %('time between fades at 900 Mhz=',Tf1*10**(3),' ms')\n",
      "print '%s %.1f %s' %('\\ntime between fades at 1900 Mhz=',Tf2*10**(3),'ms')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time between fades at 900 Mhz= 10  ms\n",
        "\n",
        "time between fades at 1900 Mhz= 4.7 ms\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.5 -PG NO. 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no.51\n",
      "import math\n",
      "Vm=72.*5./18.\n",
      "fc=900.*10.**6.\n",
      "c=3.*10.**8.\n",
      "Q1=180.*math.pi/180.\n",
      "Q2=0.*math.pi/180.\n",
      "Q3=60.*math.pi/180.\n",
      "Q4=90.*math.pi/180.\n",
      "fd1=fc*Vm*math.cos(Q1)/c#dopler shift\n",
      "fd2=fc*Vm*math.cos(Q2)/c\n",
      "fd3=fc*Vm*math.cos(Q3)/c\n",
      "fd4=fc*Vm*math.cos(Q4)/c\n",
      "fr1=fc+fd1#recieved carrier frequency\n",
      "fr2=fc+fd2\n",
      "fr3=fc+fd3\n",
      "fr4=fc+fd4\n",
      "print '%s %.5f %s' %('recieved carrier frequency directly away from base station transmitter = ',fr1*10**(-6),'MHz')\n",
      "print '%s %.5f %s' %('recieved carrier frequency directly towards from base station transmitter =',fr2*10**(-6),'MHz')\n",
      "print '%s %.5f %s' %('recieved carrier frequency in direction 60 deg to direction of arrival =',fr3*10**(-6),'MHz')\n",
      "print '%s %d %s' %('recieved carrier frequency in direction perpendicular to direction of arrival =',fr4*10**(-6),'MHz')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "recieved carrier frequency directly away from base station transmitter =  899.99994 MHz\n",
        "recieved carrier frequency directly towards from base station transmitter = 900.00006 MHz\n",
        "recieved carrier frequency in direction 60 deg to direction of arrival = 900.00003 MHz\n",
        "recieved carrier frequency in direction perpendicular to direction of arrival = 900 MHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.6 - PG NO.52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 52\n",
      "fc=900.*10.**6.\n",
      "c=3.*10.**8.\n",
      "fdm=70.\n",
      "Yc=c/fc\n",
      "V=fdm*Yc#max. speed of the vehicle\n",
      "Vm=V*18./5.#to convert max speed in kmph\n",
      "print '%s %d %s' %('maximum speed of the vehicle is =',Vm,'kmph')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum speed of the vehicle is = 84 kmph\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.7 - PG NO.52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 52\n",
      "import math\n",
      "fc=800.*10.**6.\n",
      "fd1=10.\n",
      "fd2=50.\n",
      "Vm=80.*5./18.\n",
      "c=3.*10.**8.\n",
      "Yc=c/fc #wavelength of transmission\n",
      "Q1=math.acos(Yc*fd1/Vm)*180/math.pi #ascosQ=Yc*fd/Vm\n",
      "Q2=math.acos(Yc*fd2/Vm)*180/math.pi\n",
      "Beamwidth=Q1-Q2\n",
      "print '%s %.3f %s' %('Beamwidth is =',Beamwidth,'degrees')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Beamwidth is = 47.823 degrees\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.8 - PG NO.53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 53\n",
      "import math\n",
      "fc=900.*10.**6.#carrier frequency of transmission\n",
      "fdm=20.#max. doppler frequency\n",
      "p=1.#normalized specified level\n",
      "Nl=2.5*fdm*p*(math.e)**(-1*(p**2.))#level crossing rate\n",
      "c=3.*10.**8.#velocity of light\n",
      "V=fdm*c/fc\n",
      "Vm=V*18./5.#maximum speed\n",
      "print '%s %.2f %s' %('positive going level crossing rate =',Nl,'crossings per second');\n",
      "print '%s %d %s' %('\\nmaximum velocity of the mobile for the given doppler frequency =',Vm,'kmph')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "positive going level crossing rate = 18.39 crossings per second\n",
        "\n",
        "maximum velocity of the mobile for the given doppler frequency = 24 kmph\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.9 - PG NO.54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 54\n",
      "import math\n",
      "fdm=20.\n",
      "p1=0.01\n",
      "T1=0.4*(((math.e)**(p1**2.)) -1)/(fdm*p1)#average fade duration T \n",
      "\n",
      "p2=0.1\n",
      "T2=0.4*(((math.e)**(p2**2.)) -1)/(fdm*p2)\n",
      "\n",
      "p3=0.707\n",
      "T3=0.4*(((math.e)**(p3**2.)) -1)/(fdm*p3)\n",
      "\n",
      "p4=1.\n",
      "T4=0.4*(((math.e)**(p4**2.)) -1)/(fdm*p4)\n",
      "print '%s %d %s' %('\\naverage fade duration when p=0.01 T=',((T1*10**6)-1),'miceosec')\n",
      "print '%s %d %s' %('\\naverage fade duration when p=0.01 T=',(T2*10**3),'microsec')\n",
      "print '%s %d %s' %('\\naverage fade duration when p=0.01 T=',(T3*10**3),'microsec')\n",
      "print '%s %d %s' %('\\naverage fade duration when p=0.01 T=',(T4*10**3),'microsec')\n",
      "Dr=50.\n",
      "Bp=1./Dr#Bit period\n",
      "print '%s %d %s' %('\\nBit period=',Bp*10**(3),' msec')\n",
      "if Bp>T3:#for case p=0.707\n",
      "    \n",
      "\tprint('Fast rayleigh fading as Bp>T for p=0.707')\n",
      "else:\n",
      "\tprint('Slow rayleigh fading as Bp<T for p=0.707')\n",
      "#end\n",
      "\n",
      "Nl=2.5*fdm*p2*((math.e)**(-1*(p2**2.)))#avg. no. of level crossings\n",
      "AvgBER=Nl/Dr\n",
      "print '%s %.1f' %('average bit error rate =',AvgBER)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "average fade duration when p=0.01 T= 199 miceosec\n",
        "\n",
        "average fade duration when p=0.01 T= 2 microsec\n",
        "\n",
        "average fade duration when p=0.01 T= 18 microsec\n",
        "\n",
        "average fade duration when p=0.01 T= 34 microsec\n",
        "\n",
        "Bit period= 20  msec\n",
        "Fast rayleigh fading as Bp>T for p=0.707\n",
        "average bit error rate = 0.1\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.10 - PG NO.56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 56\n",
      "Vm=96.*5./18.\n",
      "fc=900.*10.**6.\n",
      "c=3.*10.**8.\n",
      "def fround(x,n):\n",
      "\ty=round(x*10.**n)/10.**n#\n",
      "\treturn y\n",
      "\n",
      "Yc=fround((c/fc),2)\n",
      "fdm=fround((Vm/Yc),2)\n",
      "Tc=fround((0.423/fdm),5)#coherence time\n",
      "Symbol_rate=fround((1/Tc),0)#Symbolrate\n",
      "print '%s %d %s' %('Symbol rate is =',Symbol_rate,'bps')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Symbol rate is = 191 bps\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "EXAMPLE 2.11 - PG NO.57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#page no. 57\n",
      "import math\n",
      "Td=1.*10.**(-1*6.)\n",
      "Delf=1.*10.**6.#difference in frequency\n",
      "print '%s %d %s' %('Delf=',Delf*10**(-6),' MHz')\n",
      "Bc=1/(2*math.pi*Td)#coherence bandwidth\n",
      "print '%s %.2f %s' %('coherence bandwidth= ',Bc*10**(-3),'kHz')\n",
      "if Delf>Bc:\n",
      "    print('Correlative fading -- fading will not be experienced as Delf>Bc')\n",
      "else:\n",
      "    print('Correlative fading -- fading will be experienced as Delf<Bc')\n",
      "#end\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Delf= 1  MHz\n",
        "coherence bandwidth=  159.15 kHz\n",
        "Correlative fading -- fading will not be experienced as Delf>Bc\n"
       ]
      }
     ],
     "prompt_number": 13
    }
   ],
   "metadata": {}
  }
 ]
}