{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 4: Radiation<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-4.1, Page number: 75<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "theta = 30              #Angle of radiation (degrees)\n",
      "epsilon_0 = 8.854e-12   #Permittivity of free space (F/m)\n",
      "I_dl = 10               #Current in length dl (A-m)\n",
      "r = 100e3               #Distance of point from origin (m)\n",
      "\n",
      "#Calculation\n",
      "E_mag = (I_dl*math.sin(theta*math.pi/180))/(4*math.pi*epsilon_0)\n",
      "                        #Magnitude of Electric field vector (V/m)\n",
      "H_mag = (I_dl*math.sin(theta*math.pi/180))/(4)\n",
      "                        #Magnitude of Magnetic field vector (T)\n",
      "\n",
      "#Result\n",
      "print \"The magnitude of E vector is \", round(E_mag,-9), \"V/m\"\n",
      "print \"The magnitude of H vector is\", round(H_mag, 3), \"/pi T\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The magnitude of E vector is  45000000000.0 V/m\n",
        "The magnitude of H vector is 1.25 /pi T\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-4.2, Page number: 76<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "v = 3e8         #Speed of light(m/s)\n",
      "f = 10e6        #Frequency (Hz)\n",
      "\n",
      "#Calculation\n",
      "w = 2*math.pi*f     #Angular frequency(rad/s)\n",
      "r = v/w             #Distance (m)\n",
      "\n",
      "#Result\n",
      "print \"The distance for the specified condition is\", round(r, 2), \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance for the specified condition is 4.77 m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-4.3, Page number: 76<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "c = 3e8             #Speed of light (m/s)\n",
      "f = 3e9             #Frequency (Hz)\n",
      "\n",
      "#Calculation\n",
      "v = 0.6*c           #60% of velocity of light (m/s)\n",
      "w = 2*math.pi*f     #Angular frequency (rad/s)\n",
      "r = v/w             #Distance (m)\n",
      "\n",
      "#Result\n",
      "print \"The distance for the specified condition is\", round(r,6), \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance for the specified condition is 0.009549 m\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-5.1, Page number: 80<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "dl = 1e-2       #Length of radiating element (m)\n",
      "I_eff = 0.5     #Effective current (A)\n",
      "f = 3e9         #Frequency (Hz)\n",
      "c = 3e8         #Velocity of light (m/s)\n",
      "\n",
      "#Calculation\n",
      "w = 2*math.pi*f     #Angular Frequency (rad/s)\n",
      "P = 20*(w**2)*(I_eff**2)*(dl**2)/(c**2)     #Radiated power (W)\n",
      "\n",
      "#Result\n",
      "print \"The radiated power is\", round(P, 2), \"W\"\n",
      "\n",
      "#The final result is incorrect in the book because of the calculation mistake"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radiated power is 1.97 W\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-5.2, Page number: 80<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "L = 5         #Length of radiating element (m)\n",
      "f1 = 30e3     #Frequency (Hz)  \n",
      "f2 = 30e6     #Frequency (Hz)  \n",
      "f3 = 15e6     #Frequency (Hz)\n",
      "c = 3e8       #Velocity of light (m/s)  \n",
      "\n",
      "#Calculation\n",
      "wave_lt1 = c/f1                 #Wavelength (m)\n",
      "wave_lt1 /= 10\n",
      "R_r1 = 800*(L/wave_lt1)**2      #Radiation resistance (ohm)\n",
      "\n",
      "wave_lt2 = c/f2                 #Wavelength (m)\n",
      "L = wave_lt2/2                  #Effective length (m)\n",
      "R_r2 = 200*(L/wave_lt2)**2      #Radiation resistance (ohm)\n",
      "\n",
      "wave_lt3 = c/f3                 #Wavelength (m)\n",
      "L = wave_lt3/4                  #Effective length (m)\n",
      "R_r3 = 400*(L/wave_lt3)**2      #Radiation resistance (ohm)\n",
      "\n",
      "#Result\n",
      "print \"The radiation resistance for f1 is\", R_r1, \"ohms\"\n",
      "print \"The radiation resistance for f2 is\", round(R_r2), \"ohms\"\n",
      "print \"The radiation resistance for f3 is\", round(R_r3), \"ohms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radiation resistance for f1 is 0.02 ohms\n",
        "The radiation resistance for f2 is 50.0 ohms\n",
        "The radiation resistance for f3 is 25.0 ohms\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 4-6.1, Page number: 82<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Im = 5              #Maximum current (A)\n",
      "r = 1e3             #Distance (km)\n",
      "eta = 120*math.pi   #Intrinsic impedence (ohm)\n",
      "theta = 60*math.pi/180          #Angle of radiation (radians)\n",
      "\n",
      "#Calculation\n",
      "sin2 = math.sin(theta)**2       #Sine squared theta (unitless)\n",
      "P_av = (eta*(Im**2))/(8*(math.pi**2)*(r**2))\n",
      "P_av = P_av*(math.cos(math.pi/2*math.cos(theta))**2)/(sin2)\n",
      "                        #Average power (W)\n",
      "                        \n",
      "#Result\n",
      "print \"The average power available at 1km distance is\", round(P_av,9), \"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The average power available at 1km distance is 7.9577e-05 W\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}