{
 "metadata": {
  "name": "",
  "signature": "sha256:7ee429170e048ea291cb04ea69be8064a04800ea636a7a3699d6be07a58fc7ae"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter4, Linear Wire Antennas"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.2.1, page 4-17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi, acos, degrees, cos, sin, atan\n",
      "import numpy as np\n",
      "l=5 #cm(length of antenna)\n",
      "f=100 #MHz(operating frequency)\n",
      "Io=120 #mA(Terminal current)\n",
      "t=1 #s(time)\n",
      "theta=45 #degree(Angle)\n",
      "r=3 #m(radius)\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "omega=2*pi*f*10**6 #rad/sec(rotation)\n",
      "k=omega/c #rad/m(Phase constant)\n",
      "kr=2*pi*r/3 #degree(Phase constant)\n",
      "Er=Io*10**-3*l*10**-2/(2*pi*r**2)*cos(theta*pi/180)*120*pi*(1+1/(1J*kr))*np.exp(-1J*kr+1J*omega*t) #V/m(Electric field)\n",
      "Er=Er*1000 #mV/m(Electric field)\n",
      "Er_mag=abs(Er) #mV/m(magnitude of Er)\n",
      "Er_angle=degrees(atan(Er.imag/Er.real)) #degree(angle of Er)\n",
      "print \"Value of Er : magnitude = %0.2f mV/m & angle = %0.2f degree \" %(Er_mag,Er_angle) \n",
      "Etheta=Io*10**-3*l*10**-2/(4*pi*r)*sin(theta*pi/180)*120*pi*1J*k*(1+1/(1J*kr)+1/(1J*kr)**2)*np.exp(-1J*kr+1J*omega*t) #V/m(Electric field)\n",
      "Etheta_mag=abs(Etheta) #V/m(magnitude of Etheta)\n",
      "Etheta_angle=degrees(atan(Etheta.imag/Etheta.real)) #degree(angle of Etheta)\n",
      "print \"Value of Etheta : magnitude = %0.2e V/m & angle = %0.2f degree \" %(Etheta_mag,Etheta_angle) \n",
      "Hfi=Io*10**-3*l*10**-2/(4*pi*r)*sin(theta*pi/180)*1J*k*(1+1/(1J*kr))*np.exp(-1J*kr+1J*omega*t) #A/m(Magnetic field)\n",
      "Hfi_mag=abs(Hfi) #A/m(magnitude of Hfi)\n",
      "Hfi_angle=degrees(atan(Hfi.imag/Hfi.real)) #degree(angle of Hfi)\n",
      "print \"Value of H\u03a6 : magnitude = %0.3e A/m & angle = %0.f degree \" %(Hfi_mag,Hfi_angle) \n",
      "#Answer is not accurate in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of Er : magnitude = 28.64 mV/m & angle = -9.04 degree \n",
        "Value of Etheta : magnitude = 8.78e-02 V/m & angle = 80.73 degree \n",
        "Value of H\u03a6 : magnitude = 2.387e-04 A/m & angle = 81 degree \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.5.1, page 4-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "f=500.0 #MHz(Operating Frequency)\n",
      "Do=1.643 #for half wave dipole\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "lamda=c/(f*10**6) #m(Wavelength)\n",
      "Aem=lamda**2/(4*pi)*Do #m\u00b2(Effective area)\n",
      "print \"Effective area = %0.3f m\u00b2 \" %Aem "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective area = 0.047 m\u00b2 \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.6.1, page 4-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, pi\n",
      "l=1 #m\n",
      "Prad=4 #W\n",
      "f=1.5 #MHz\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "lamda=c/(f*10**6) #m\n",
      "#here l/lamda<1/50 tells us it is a Hertzian monopole antenna\n",
      "h=1 #m\n",
      "Rr=40*pi**2*(h/lamda)**2 #m\u03a9\n",
      "Io=sqrt(2*Prad/Rr) #A\n",
      "print \"Current required = %0.2f A \" %Io "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current required = 28.47 A \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.9.1, page 4-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "le=100.0 #m\n",
      "Irms=450.0 #A\n",
      "f=40000.0 #Hz\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "lamda=c/f #m\n",
      "P=160*pi**2*(le/lamda)**2*Irms**2 #mW\n",
      "Rr=160*pi**2*(le/lamda)**2 #\u03a9\n",
      "print \"Power radiated = %0.2f kW \" %(P*10**-3) \n",
      "print \"Radiation resistance = %0.3f \u03a9 \"%Rr\n",
      "#Answer wrong for radiation resistance in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power radiated = 56.85 kW \n",
        "Radiation resistance = 0.281 \u03a9 \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.9.2, page 4-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "le=61.4 #m\n",
      "Irms=50 #A\n",
      "lamda=625 #m\n",
      "P=160*pi**2*(le/lamda)**2*Irms**2 #kW\n",
      "Rr=160*pi**2*(le/lamda)**2 #\u03a9\n",
      "print \"Power radiated = %0.2f kW \" %(P*10**-3) \n",
      "print \"Radiation resistance = %0.2f \u03a9 \"%Rr "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power radiated = 38.10 kW \n",
        "Radiation resistance = 15.24 \u03a9 \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.9.3, page 4-51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "le=10.0 #m(effective length)\n",
      "Irms=450 #A(rms current)\n",
      "Rl=1.5 #\u03a9(resistance)\n",
      "f=50.0 #kHz(Operating frequency)\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "lamda=c/(f*10**3) #m(Wavelength)\n",
      "P=160*pi**2*(le/lamda)**2*Irms**2 #kW(Power)\n",
      "P=P*1000 #W(Power)\n",
      "Rr=160*pi**2*(le/lamda)**2 #\u03a9(Radiation resistance)\n",
      "Eta=Rr/(Rr+Rl)*100 #%(Efficiency)\n",
      "print \"Efficiency of antenna = %0.2f %% \"%Eta "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of antenna = 0.29 % \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.9.4, page 4-52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "#l=lamda/8\n",
      "lBYlamda=1.0/8 #(length/Wavelength)\n",
      "Rr=80*pi**2*(lBYlamda)**2 #\u03a9(Radiation resistance)\n",
      "print \"Radiation resistance = %0.4f \u03a9 \"%Rr "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radiation resistance = 12.3370 \u03a9 \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 4.9.5, page 4-52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import pi\n",
      "L=1 #m(Length of element)\n",
      "f=10 #MHz(Operating frequency)\n",
      "c=3*10**8 #m/s##Speed of light\n",
      "lamda=c/(f*10**6) #m(Wavelength)\n",
      "Rr=80*pi**2*(L/lamda)**2 #\u03a9(Radiation resistance)\n",
      "print \"Radiation resistance = %0.3f \u03a9 \"%Rr "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radiation resistance = 0.877 \u03a9 \n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}