{
 "metadata": {
  "name": "",
  "signature": "sha256:d9216abaea55a671c8710ff5277d260ca9c6b9e6c9e1a5aa7567e0769b212b24"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter3, Fundamental Parameters of Antenna"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.3.1, page 3-9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, acos, degrees\n",
      "E_theta=1/sqrt(2) #Electric Field at half power\n",
      "#theta=thetaHP/2 #E(thetaHP/2)=cosd(thetaHP/2)\n",
      "thetaHP=2*degrees(acos(E_theta)) #degree(Half power beam width)\n",
      "print \"Half power beam width = %0.2f degree \"%thetaHP "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Half power beam width = 90.00 degree \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.3.2, page 3-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import asin, degrees\n",
      "E_theta=1/sqrt(2) #Electric field at theta=90-thetaHP/2\n",
      "#E(90-thetaHP/2)=sind(90-thetaHP/2)\n",
      "thetaHP=2*(90-degrees(asin(E_theta)) )#degree(HPBW)\n",
      "print \"HPBW = %0.2f degree \"%(thetaHP) \n",
      "theta1=0 ;theta2=180 #degree(Pattern angles)\n",
      "FNBW=theta2-theta1 #degree(FNBW)#as E is zero at these points\n",
      "print \"FNBW = %0.2f degree \"%FNBW "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "HPBW = 90.00 degree \n",
        "FNBW = 180.00 degree \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.3.3, page 3-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import acos, degrees\n",
      "E_theta=1/sqrt(2) #Elecric field at half power point\n",
      "#E(thetaHP/2)=(cosd(thetaHP/2))**2\n",
      "thetaHP=2*degrees(acos(sqrt(E_theta))) #degree(HPBW)\n",
      "print \"Half Power Beam Width = %0.2f degree \"%thetaHP "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Half Power Beam Width = 65.53 degree \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.8.1, page 3-23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import pi, cos, acos\n",
      "theta1=0 ;theta2=pi/2 #radian(Angles)\n",
      "fi1=0 ;fi2=2*pi #radian(Angles)\n",
      "#Prad=integrate('integrate('U','thheta',theta1,theta2)','fi',fi1,fi2) \n",
      "Prad_BY_Um=pi*(1/2)*(cos(2*theta1)-cos(2*theta2)) #(Power radiated/Max intensity)\n",
      "Do=4*pi/Prad_BY_Um #Exact Directivity\n",
      "print \"Exact Directivity : \",Do \n",
      "#Um*Cosd(thetaHP/2)=0.5*Um\n",
      "thetaHP=2*(degrees(acos(0.5))) #degree(HPBW)\n",
      "fiHP=thetaHP #degree(HPBW)\n",
      "Do=41253/(thetaHP*fiHP) #Approximate Directivity\n",
      "print \"Approximate Directivity : \",round(Do,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Exact Directivity :  4.0\n",
        "Approximate Directivity :  2.865\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.10.1, page 3-26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "K=90 #%#radiation efficiency\n",
      "Pin=10 #W\n",
      "Prad=(K/100)*Pin #W\n",
      "print \"Radiated power = %0.f Watts \" %Prad "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radiated power = 9 Watts \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.11.1, page 3-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "D=20 #Directivity\n",
      "K=90 #%#radiation efficiency\n",
      "G=(K/100)*D #Gain\n",
      "GdB=10*log10(G) #dB\n",
      "print \"Gain = %0.2f dB \"%(GdB) \n",
      "#Answer is not calculated in the book."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain = 12.55 dB \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.11.2, page 3-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "Rr=72 #\u03a9\n",
      "RL=8 #\u03a9\n",
      "G=16 #Gain\n",
      "K=Rr/(Rr+RL)*100 #%#radiation efficiency\n",
      "D=G/(K/100) #Directivity\n",
      "DdB=10*log10(D) #dB\n",
      "print \"Directivity = %0.3f dB\" %DdB"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Directivity = 12.499 dB\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.13.1, page 3-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Irms=15 #A(Current Drawn)\n",
      "Prad=5 #kW(Radiated Power)\n",
      "Rr=Prad*10**3/Irms**2 #\u03a9(Radiation Resistance)\n",
      "print \"Radiation resistance = %0.2f \u03a9  \"%Rr"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Radiation resistance = 22.22 \u03a9  \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.13.2, page 3-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "Prad=1000 #W(Radiated Power)\n",
      "Rr=300 #\u03a9(Radiation Resistance)\n",
      "Irms=sqrt(Prad/Rr) #A(Current Drawn)\n",
      "print \"Current drawn = %0.1f A \"%Irms "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Current drawn = 1.8 A \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.13.3, page 3-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Rr=73 #\u03a9(Radiation Resistance)\n",
      "Z=120*pi #\u03a9(For free space)\n",
      "#le=lambda/pi\n",
      "AemBYlambda_sqr=(1/pi)**2*Z/(4*Rr) \n",
      "print \"Maximum effective aperture is \",round(AemBYlambda_sqr,2),\"*lambda\u00b2 m\u00b2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum effective aperture is  0.13 *lambda\u00b2 m\u00b2\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.13.4, page 3-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Rr=73 #\u03a9\n",
      "Z=120*pi #\u03a9(For free space)\n",
      "#Aem=0.13*lambda\u00b2\n",
      "AemBylambda_sqr=0.13 \n",
      "leBYlambda=2*sqrt(AemBylambda_sqr*Rr)/sqrt(Z) \n",
      "print \"Effective length is \",round(leBYlambda,4),\"*lambda meter\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective length is  0.3173 *lambda meter\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.15.1, page 3-39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt, log10\n",
      "cos_si_p=1/sqrt(2) \n",
      "PLF=cos_si_p**2 #Polarization Loss factor\n",
      "PLFdB=10*log10(PLF) #dB\n",
      "print \"Power loss factor = %0.f dB \"%PLFdB "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power loss factor = -3 dB \n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.16.1, page 3-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "Do_dB=20 #dB\n",
      "f=10 #GHz\n",
      "Wi=2*10**-3 #W/m\u00b2\n",
      "c=3*10**8 #m/s\n",
      "lamda=c/(f*10**9) #m\n",
      "Do=10**(Do_dB/10) #unitless\n",
      "Aem=lamda**2/(4*pi)*Do #m\u00b2\n",
      "print \"Maximum effective aperture = %0.3e m\u00b2\" %Aem \n",
      "Pr=Aem*Wi #W\n",
      "print \"Maximum received power = %0.3f \u00b5W \"%(Pr*10**6) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum effective aperture = 7.162e-03 m\u00b2\n",
        "Maximum received power = 14.324 \u00b5W \n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.16.2, page 3-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "ecd=1.0 #for lossless antenna\n",
      "Aem=2.147 #m\u00b2(Maximum Effective aperture)\n",
      "Zin=75.0 #\u03a9(Input impedence)\n",
      "Zo=50.0 #\u03a9(Output impedence)\n",
      "f=100.0 #MHz(Operating frequency)\n",
      "c=3*10**8 #m/s(speed f light)\n",
      "aw_aa=1.0 #For no polarization loss\n",
      "lamda=c/(f*10**6) #m(Wavelength)\n",
      "Tau=(Zin-Zo)/(Zin+Zo) #(Reflection Coefficient)\n",
      "Do=Aem/(ecd*(1.0-Tau**2)*lamda**2.0/(4*pi)/aw_aa**2) #unitless(Directivity)\n",
      "print \"Directivity of antenna\",round(Do,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Directivity of antenna 3.123\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.17.1, page 3-46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "PT=15 #W(Transmitted Power)\n",
      "AeT=0.2 #m\u00b2(Effective aperture)\n",
      "AeR=0.5 #m\u00b2(Effective aperture)\n",
      "f=5 #GHz(frequency)\n",
      "r=15 #km(line of sight distance)\n",
      "c=3*10**8 #m/s(Speed of light)\n",
      "lamda=c/(f*10**9) #m(Wavelength)\n",
      "PR=PT*AeT*AeR/((r*1000)**2*lamda**2) #Watts(Power delivered to reciever)\n",
      "print \"Power delivered to receiver = %0.2e Watts \"%(PR) \n",
      "#Answer is wrong in the book. lambda is 0.6 instead of 0.06 and lambda**2 is 0.06 instead of 0.0036"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power delivered to receiver = 1.85e-06 Watts \n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.17.2, page 3-46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "DT=20 #dB(Transmitter Directivity)\n",
      "DR=20 #dB(Reciever Directivity)\n",
      "PT=10 #W(Transmitted Power)\n",
      "ecdT=1; ecdR=1 #(For lossless antenna)\n",
      "aT_aR=1 #(For polarization match)\n",
      "DT=10**(DT/10) #unitless(Transmitter Directivity)\n",
      "DR=10**(DR/10) #unitless(Reciever Directivity)\n",
      "Tau_T=0; Tau_R=0 #(Reflection coefficient)\n",
      "rBYlambda=50 #m\n",
      "PR=PT*ecdT*ecdR*(1-Tau_T**2)*(1-Tau_R**2)/(4*pi*rBYlambda)**2*DT*DR*aT_aR**2 #Watts(Power delivered to reciever)\n",
      "print \"Power at receiving antenna = %0.3f Watts \"%PR  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power at receiving antenna = 0.253 Watts \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No. 3.17.3, page 3-47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "f=3 #GHz\n",
      "c=3*10**8 #m/s(Speed of light)\n",
      "lamda=c/(f*10**9) #m(wavelength)\n",
      "r=500 #m(distance)\n",
      "PT=100 #W(Transmitted Power)\n",
      "GT=25 #dB(Transmitter Gain)\n",
      "GR=20 #dB(Reciever Gain)\n",
      "GT=10**(GT/10) #unitless(Transmitter Gain)\n",
      "GR=10**(GR/10) #unitless(Reciever Gain)\n",
      "PLF=1; aT_aR=1 #(For polarization match)\n",
      "PR=PT*(lamda/4/pi/r)**2*GT*GR*aT_aR**2 #Watts(Power delivered to reciever)\n",
      "print \"Power delivered to load = %0.2e Watts \"%PR "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power delivered to load = 8.01e-04 Watts \n"
       ]
      }
     ],
     "prompt_number": 29
    }
   ],
   "metadata": {}
  }
 ]
}