{
 "metadata": {
  "name": "",
  "signature": "sha256:5168da214feed4bdafc5432918593870d207c98c8ad5626a85639886ab07fdcb"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 13: Antennas<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.1, Page number: 601<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "H=5*10**-6              #magnetic field strentgh in A/m\n",
      "theta=scipy.pi/2        \n",
      "r=2*10**3               #distance in m\n",
      "Bdl=2*scipy.pi/25\n",
      "N=10                    #number of turns\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Ia=4*scipy.pi*r*H/(Bdl*scipy.sin(theta))        #current for part (a) in A\n",
      "Pa=40*scipy.pi**2*(1/25.0)**2*Ia**2             #power for part (a) in W\n",
      "def pow(Io,Rrad):\n",
      "    P=0.5*Io**2*Rrad\n",
      "    print round(P*10**3,0),'mW'\n",
      "\n",
      "denom=scipy.cos(scipy.pi*scipy.cos(theta)/2)    \n",
      "Ib=H*2*scipy.pi*r*scipy.sin(theta)/denom        #current for part (b) in A\n",
      "Rradb=73                                        #wave impedance in ohms for (b)\n",
      "Ic=Ib                                           #current for part (c) in A\n",
      "Rradc=36.56                                     #wave impedance in ohms for (c)\n",
      "Id=H*r*400/(10*scipy.pi**2)                     #current for part (d) in A\n",
      "Rradd=320*scipy.pi**6*N**2/20**4                #wave impedance in ohms for (d)\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'The power transmitted in mW if antenna is ;'\n",
      "print '(a) A Hertzian dipole of length lambda/25 =','\\n',round(Pa*10**3,0),'mW'\n",
      "print '(b) A half-wave dipole ='\n",
      "pow(Ib,Rradb)\n",
      "print '(c) A quarter-wave monopole ='\n",
      "pow(Ic,Rradc)\n",
      "print '(d) A 10-turn loop antenna of radius Po = lambda/20 ='\n",
      "pow(Id,Rradd)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The power transmitted in mW if antenna is ;\n",
        "(a) A Hertzian dipole of length lambda/25 = \n",
        "158.0 mW\n",
        "(b) A half-wave dipole =\n",
        "144.0 mW\n",
        "(c) A quarter-wave monopole =\n",
        "72.0 mW\n",
        "(d) A 10-turn loop antenna of radius Po = lambda/20 =\n",
        "158.0 mW\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.2, Page number: 603<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "import scipy\n",
      "import cmath\n",
      "from numpy import *\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "c=3*10**8               #speed of wave in m/s\n",
      "f=50*10**6              #frequency in Hz\n",
      "E=10*10**-6             #field strength in V/m\n",
      "theta=scipy.pi/2\n",
      "r=500*10**3             #distance in m\n",
      "eta=120*scipy.pi        #wave impedance in ohms\n",
      "Rrad=73                 #in ohms\n",
      "Zo=75                   #in ohms\n",
      "Zl=73+42.5j\n",
      "\n",
      "#Calculations\n",
      "\n",
      "l=c/(2*f)\n",
      "I=E*2*r*scipy.pi*sin(theta)/(eta*(cos((scipy.pi/2)*cos(theta))))\n",
      "P=0.5*I**2*Rrad\n",
      "T=(Zl-Zo)/(Zl+Zo)\n",
      "s=(1+abs(T))/(1-abs(T))\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'The length of the dipole =',l,'m'\n",
      "print 'The current that must be fed to the antenna =',round(I*10**3,2),'mA'\n",
      "print 'The average power radiated by the antenna =',round(P*10**3,1),'mW'\n",
      "print 'The standing wave ratio =',round(s,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The length of the dipole = 3 m\n",
        "The current that must be fed to the antenna = 83.33 mA\n",
        "The average power radiated by the antenna = 253.5 mW\n",
        "The standing wave ratio = 1.7636\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.4, Page number: 610<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "G=5\n",
      "r=10*10**3      #in m\n",
      "P=20*10**3      #power in W\n",
      "n=120*scipy.pi  #wave impedance in ohms\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Gd=10**(G/10.0)\n",
      "E=scipy.sqrt(n*Gd*P/(2*scipy.pi*r*r))    #field intensity in V/m\n",
      "\n",
      "#Result\n",
      "\n",
      "print 'electric field intensity =',round(E,4),'V/m'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "electric field intensity = 0.1948 V/m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.5, Page number: 611<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "import scipy.integrate\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "Umax=2.0\n",
      "\n",
      "def U(phi,theta):\n",
      "    s=2*scipy.sin(theta)*(scipy.sin(phi))**3/(4.0*scipy.pi)\n",
      "    return s\n",
      "    \n",
      "#Calculations\n",
      "\n",
      "if __name__ == '__main__':\n",
      "        \n",
      " Uav,er=scipy.integrate.dblquad(lambda theta,phi:U(phi,theta)*scipy.sin(theta),    \n",
      "             0, scipy.pi, lambda theta: 0, lambda theta: scipy.pi)\n",
      "\n",
      "D=Umax/Uav   #Directivity\n",
      "\n",
      "#Result\n",
      "\n",
      "print 'directivity of the antenna =',D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "directivity of the antenna = 6.0\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.8, Page number: 624<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "c=3*10**8           #speed of wave in m/s\n",
      "f=30*10**6          #frequency in Hz\n",
      "E=2*10**-3          #field strength in V/m\n",
      "n=120*scipy.pi\n",
      "R=73 \n",
      "\n",
      "#Calculations\n",
      "\n",
      "l=c/f                             #wavelength in m\n",
      "Gdmax=round(n/(scipy.pi*R),2)  \n",
      "Amax=(l**2/(4*scipy.pi))*Gdmax    #maximum effective area in m^2\n",
      "Pr=(E*E*Amax)/(2*n)               #power received in W\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'maximum effective area =',round(Amax,2),'m^2'\n",
      "print 'power received =',round(Pr*10**9,2),'nW'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum effective area = 13.05 m^2\n",
        "power received = 69.24 nW\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.9, Page number: 624<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "Gt=25           #in dB\n",
      "Gr=18           #in dB\n",
      "r=200           #in units of lambda\n",
      "Pr=5*10**-3     #power received in W\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Gdt=10**(Gt/10.0) \n",
      "Gdr=10**(Gr/10.0)\n",
      "Pt=Pr*(4*scipy.pi*r)**2/(Gdr*Gdt)\n",
      "\n",
      "#Result\n",
      "\n",
      "print 'minimum transmitted power =',round(Pt,3),'W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "minimum transmitted power = 1.583 W\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 13.10, Page number: 627<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "c=3*(10)**8                 #speed of wave in m/s\n",
      "f=3.0*(10)**9               #frequency in Hz\n",
      "Aet=9                       #effective area in m^2\n",
      "r1=1.852*(10)**5            #distance in m\n",
      "r2=4*r1                     #distance in m\n",
      "r3=5.556*10**5              #distance in m\n",
      "Pr=200*(10)**3              #in W\n",
      "a=20                        #target area in m^2\n",
      "\n",
      "#Calculations\n",
      "\n",
      "l=c/f                                       #wavelength in m\n",
      "Gdt=4*scipy.pi*Aet/(l*l)\n",
      "P1=Gdt*Pr/(4*scipy.pi*r1*r1)                #power at 100 nmiles in W/m^2\n",
      "P2=Gdt*Pr/(4*scipy.pi*r2*r2)                #power at 400 nmiles in W/m^2\n",
      "Pr=Aet*a*Gdt*Pr/(4*scipy.pi*r3*r3)**2       #power of reflected signal in W\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'Signal power density at 100 nautical miles =',round(P1*1000,3),'mW/m^2'\n",
      "print 'Signal power density at 400 nautical miles =',round(P2*1000,3),'mW/m^2'\n",
      "print 'Power of reflected signal =',round(Pr*10**12,5),'pico W'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Signal power density at 100 nautical miles = 5.248 mW/m^2\n",
        "Signal power density at 400 nautical miles = 0.328 mW/m^2\n",
        "Power of reflected signal = 0.02706 pico W\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}