{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 6: Electric Dipoles, Thin Linear Antennas \n",
      "        and Arrays of Dipoles and Apertures<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6-8.1, Page number: 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "z = 333.0         #Driving point impedence (ohm)\n",
      "r = 300.0         #twin-line impedence (ohm)\n",
      "z1 = 73.0         #Self impedence of lambda/2 dipole (ohm)\n",
      "z2 = 13.0         #Mutual impedence with lambda/2 spacing (ohm)\n",
      "\n",
      "#Calculation\n",
      "pv = (z-r)/(z+r)    #Reflection coefficient (unitless)\n",
      "vswr = (1+pv)/(1-pv)    #Voltage Standing Wave Ratio (unitless)\n",
      "gain_l2 =math.sqrt((2*z1)/(z1-z2)) #Field gain over lambda/2 dipole (unitless)\n",
      "gain_l2_db = 20*math.log10(gain_l2) #Field gain (in dB)\n",
      "gain_iso = (gain_l2**2)*1.64        #Gain over isotropic source (unitless)\n",
      "gain_iso_db = 10*math.log10(gain_iso) #Gain over isotropic source (in dB)\n",
      "\n",
      "#Result\n",
      "print \"The VSWR is\", vswr\n",
      "print \"The field gain over lambda/2 dipole is\", round(gain_l2,2), \"or\", round(gain_l2_db,1), \"dB\"\n",
      "print \"\"\"The gain over isotropic source is %.1f or %.1f dB\n",
      "            \"\"\" % (round(gain_iso),gain_iso_db)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The VSWR is 1.11\n",
        "The field gain over lambda/2 dipole is 1.56 or 3.9 dB\n",
        "The gain over isotropic source is 4.0 or 6.0 dB\n",
        "            \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6-8.2, Page number:175<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "z = 73.0      #Self impedence of lambda/2 dipole (ohm)\n",
      "zm = 64.4     #Mutual impedence with lambda/8 spacing (ohm)\n",
      "\n",
      "#Calculation\n",
      "D = math.sqrt((2*z)/(z-zm))*math.sin(math.pi/8) #Field gain over lambda/2 dipole (unitless)\n",
      "D_db = 20*math.log10(D)     #Field gain over lambda/2 dipole (in dB)\n",
      "\n",
      "gain_iso = (D**2)*1.64      #gain over isotropic source (unitless)\n",
      "gain_iso_db = 10*math.log10(gain_iso)   #gain over isotropic source (in dB)\n",
      "\n",
      "#Result\n",
      "print \"The field gain over lambda/2 dipole is\", round(D,2), \"or\", round(D_db,2), \"dB\"\n",
      "print \"The gain over isotropic source is\", round(gain_iso,2), \"or\", round(gain_iso_db,1), \"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The field gain over lambda/2 dipole is 1.58 or 3.96 dB\n",
        "The gain over isotropic source is 4.08 or 6.1 dB\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 6-12.1, Page number: 196<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, log10\n",
      "\n",
      "#Variable declaration\n",
      "s1 = 0.4            #Spacing 1(lambda)\n",
      "s2 = 0.5            #Spacing 2(lambda)\n",
      "s3 = 0.6            #Spacing 3(lambda)\n",
      "R_21_1 = 6.3        #Mutual resistance for s1 (ohm)\n",
      "R_21_2 = -12.691    #Murual resistance for s2 (ohm)\n",
      "R_21_3 = -23.381    #Mutual resistance for s3 (ohm)  \n",
      "Z = 73.13           #Self impedence of lambda/2 dipole (ohm)\n",
      "\n",
      "#Calculation\n",
      "gain_1 = sqrt(2*(Z/(Z+R_21_1)))     #Gain in fieldfor s1 (unitless)\n",
      "gain_iso1 = 1.64*(gain_1**2)        #Power gain over isotropic (unitless)\n",
      "gain_iso_db1 = 10*log10(gain_iso1)  #Power gain (in dBi)\n",
      "\n",
      "gain_2 = sqrt(2*(Z/(Z+R_21_2)))     #Gain in fieldfor s2 (unitless)\n",
      "gain_iso2 = 1.64*(gain_2**2)        #Power gain over isotropic (unitless)\n",
      "gain_iso_db2 = 10*log10(gain_iso2)  #Power gain (in dBi)\n",
      "\n",
      "gain_3 = sqrt(2*(Z/(Z+R_21_3)))     #Gain in fieldfor s3 (unitless)\n",
      "gain_iso3 = 1.64*(gain_3**2)        #Power gain over isotropic (unitless)\n",
      "gain_iso_db3 = 10*log10(gain_iso3)  #Power gain (in dBi)\n",
      "\n",
      "#Result\n",
      "print \"The gain in field over half wave antenna for s1 is\", round(gain_1,2)\n",
      "print \"\"\"The power gain over isotropic for s1 is %.2f or %.1f dBi\n",
      "                \"\"\" % (gain_iso1,gain_iso_db1)\n",
      "                \n",
      "print \"The gain in field over half wave antenna for s2 is\", round(gain_2,2)\n",
      "print \"\"\"The power gain over isotropic for s2 is %.2f or %.2f dBi\n",
      "                \"\"\" % (gain_iso2,gain_iso_db2)\n",
      "                \n",
      "print \"The gain in field over half wave antenna for s3 is\", round(gain_3,2)\n",
      "print \"\"\"The power gain over isotropic for s3 is %.2f or %.2f dBi\n",
      "                \"\"\" % (gain_iso3,gain_iso_db3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gain in field over half wave antenna for s1 is 1.36\n",
        "The power gain over isotropic for s1 is 3.02 or 4.8 dBi\n",
        "                \n",
        "The gain in field over half wave antenna for s2 is 1.56\n",
        "The power gain over isotropic for s2 is 3.97 or 5.99 dBi\n",
        "                \n",
        "The gain in field over half wave antenna for s3 is 1.71\n",
        "The power gain over isotropic for s3 is 4.82 or 6.83 dBi\n",
        "                \n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}