{
 "metadata": {
  "name": "",
  "signature": "sha256:90a8210af9bbd341fd0161ae92317cb94b49dff94f57602b89ee58a96a935fea"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter04:Microwave Transmission Lines"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1, Page number 141"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Inductance per unit lengths,Capacitance per unit lengths,Characteristic Impedance ,Velocity of propagation\n",
      "#chapter-4 page 141 example 4.1\n",
      "import math\n",
      "\n",
      "d=0.0049;#Diameter of inner conductor in met \n",
      "D=0.0110;#Inner Diameter of outer conductor in met\n",
      "er=2.3;#Polyethylene dielectric\n",
      "c=3.*10.**8.;#Velocity of Light in m/sec\n",
      "\n",
      "#CALCULATIONS\n",
      "x=math.log(D/d);\n",
      "L=(2.*10.**(-1.)*x);#Inductance per unit lengths in microH/m\n",
      "C=(55.56*(er/x));#The Capacitance per unit lengths in picoF/m\n",
      "R0=(x*(60./math.sqrt(er)));#The Characteristic Impedance in ohms\n",
      "V=(c/math.sqrt(er))/(10.**8.);#The Velocity of propagation in Km/s\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.2f %s %s %.2f %s %s %.2f %s %s %.3f %s' %('\\nInductance per unit lengths is L=',L,'microH/m' ,'\\nThe Capacitance per unit lengths is C=',C,'picoF/m' ,'\\nThe Characteristic Impedance is R0=',R0,'ohms','\\nThe Velocity of propagation is V=',V,'*10**8 m/s');"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Inductance per unit lengths is L= 0.16 microH/m \n",
        "The Capacitance per unit lengths is C= 158.02 picoF/m \n",
        "The Characteristic Impedance is R0= 31.99 ohms \n",
        "The Velocity of propagation is V= 1.978 *10**8 m/s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2, Page number 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Attenuation Constant,Phase Constant ,Phase Velocity,Relative Permittivit,Power Loss\n",
      "#chapter-4 page 142 example 4.2\n",
      "import math\n",
      "R=0.05##Resistance in ohm/m\n",
      "L=0.16173*10.**(-6.)##Inductance per unit lengths in H/m\n",
      "C=0.15802*10.**(-6.)##The Capacitance per unit lengths in F/m\n",
      "V=197814.14##The Velocity of propagation in Km/s\n",
      "l=50.##Length of Coaxial Line in met\n",
      "Pin=480.##Input Power to the System in watts\n",
      "f=3.*10.**9.##Frequency in Hz\n",
      "c=3.*10.**5.##Velocity of Light in Km/sec\n",
      "e0=8.854*10.**(-12.)##Permittivity in free space in F/m\n",
      "\n",
      "#CALCULATIONS\n",
      "Z0=math.sqrt(L/C)#\n",
      "A=(R/(2.*Z0))##Attenuation Constant in NP/m\n",
      "w=(2.*(math.pi)*f)##Angular Frequency in rad/sec\n",
      "B=(w*math.sqrt(L*C))##Phase Constant in rad/m\n",
      "Vp=(1./math.sqrt(L*C))/(10.**3.)##Phase Velocity in Km/s\n",
      "er=(((c/V)**2.)/e0)##Relative Permittivity\n",
      "Pl=(2.*Pin*l)##Power Loss in watts\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.3f %s %s %.2f %s %s %.f %s %s %.f %s %.f %s ' %('\\nAttenuation Constant is A=',A,'NP/m','\\nPhase Constant is B=',B,'rad/m','\\nPhase Velocity is Vp=',Vp,'Km/s','\\nRelative Permittivity is er=',er,'\\nPower Loss is Pl=',Pl,'watts')#"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Attenuation Constant is A= 0.025 NP/m \n",
        "Phase Constant is B= 3013.37 rad/m \n",
        "Phase Velocity is Vp= 6255 Km/s \n",
        "Relative Permittivity is er= 259769600965 \n",
        "Power Loss is Pl= 48000 watts \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3, Page number 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 142 example 4.3\n",
      "#For an air filled coaxial cable\n",
      "import math\n",
      "f=9.375*10.**9.##operating frequency in Hz\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "print '%s' %('Assuming a ratio of (b/a)=2.3 and (b+a)<(w/pi) to exclude higher order modes and a dominant mode propagating')#\n",
      "a=0.36432##length of coaxial cable in cm\n",
      "x=2.3##ratio of b/a\n",
      " \n",
      "#CALCULATION\n",
      "w0=(c/f)##free space wavelength in cm\n",
      "Pbd=(3600.*(a**2.)*math.log(x))##Breakdown power of a coaxial cable in kW\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.f %s' %('\\nBreakdown power of a coaxial cable is Pbd=',Pbd,'kW')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Assuming a ratio of (b/a)=2.3 and (b+a)<(w/pi) to exclude higher order modes and a dominant mode propagating\n",
        "\n",
        "Breakdown power of a coaxial cable is Pbd= 398 kW\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4, Page number 142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Characteristic Impedance, Velocity of propagation\n",
      "#chapter-4 page 142 example 4.4\n",
      "import math\n",
      "b=0.3175##Distance between ground planes of strip line in cm\n",
      "d=0.0539##Diameter of circular conductor in cm\n",
      "er=2.32##Dielectric Constant \n",
      "c=3.*10.**8.##Velocity of Light in m/sec\n",
      "\n",
      "#CALCULATION\n",
      "Z0=((60./math.sqrt(er))*math.log((4.*b)/(d*(math.pi))))##Characteristic Impedance in ohms\n",
      "V=(c/math.sqrt(er))/(10.**8.)##The Velocity of propagation in Km/s\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.2f %s %s %.2f %s' %('Characteristic Impedance is Z0=',Z0,'ohms','\\nThe Velocity of propagation is  V =',V,'*10**8 m/s')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Characteristic Impedance is Z0= 79.37 ohms \n",
        "The Velocity of propagation is  V = 1.97 *10**8 m/s\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5, Page number 143"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 143 example 4.5\n",
      "import math\n",
      "#For a microstrip transmission line \n",
      "er=9.7##relative dielectric constant of an alumina substrate \n",
      "x1=0.5##w/h ratio in first transmission line \n",
      "x2=5##w/h ratio in second transmission line \n",
      "c=3.*10.**8.##Velocity of Light in m/sec\n",
      "\n",
      "#CALCULATION\n",
      "print '%s' %('For case1: w/h=0.5')#\n",
      "print '%s' %('Since x1=0.5<1, for this we use high impedance analysis')#\n",
      "Eeff1=(((er+1.)/2.)+((er-1.)/2.)*(1./((math.sqrt(1.+(12./x1)))+(0.04*(1.-x1)**2.))))##Effective dielectric constant\n",
      "Zo1=((60./math.sqrt(Eeff1))*math.log((8./x1)+(x1/4.)))##Characteristic impedance in ohms\n",
      "V1=(c/math.sqrt(Eeff1))/10.**8.##Velocity of propagation in 10**8 m/sec\n",
      "print '%s %.2f %s %.2f %s %s %.1f %s ' %('\\nEffective dielectric constant is Eeff1  =',Eeff1,'\\nCharacteristic impedance is Zo1 =',Zo1,'ohms','\\nVelocity of propagation is V1 =',V1 ,'*10**8 m/sec')#\n",
      "\n",
      "print '%s' %('\\nFor case2: w/h=5')#\n",
      "print '%s' %('here x2>1')#\n",
      "Eeff2=(((er+1)/2)+((er-1)/2)*(1/(math.sqrt(1+(12/x2)))))##Effective dielectric constant\n",
      "Zo2=((120*(math.pi)/math.sqrt(Eeff2))*(1/(x2+1.393+(0.667*math.log(1.444+x2)))))##Characteristic impedance in ohms\n",
      "V2=(c/math.sqrt(Eeff2))/10**8##Velocity of propagation in 10**8 m/sec\n",
      "print '%s %.2f %s %.2f %s %s %.2f %s' %('\\nEffective dielectric constant is Eeff2 =',Eeff2,'\\nCharacteristic impedance is Zo2 =',Zo2,'ohms' ,'\\nVelocity of propagation is V2 =',V2,'*10**8 m/sec')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For case1: w/h=0.5\n",
        "Since x1=0.5<1, for this we use high impedance analysis\n",
        "\n",
        "Effective dielectric constant is Eeff1  = 6.22 \n",
        "Characteristic impedance is Zo1 = 66.90 ohms \n",
        "Velocity of propagation is V1 = 1.2 *10**8 m/sec \n",
        "\n",
        "For case2: w/h=5\n",
        "here x2>1\n",
        "\n",
        "Effective dielectric constant is Eeff2 = 7.86 \n",
        "Characteristic impedance is Zo2 = 17.61 ohms \n",
        "Velocity of propagation is V2 = 1.07 *10**8 m/sec\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6, Page number 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Ratio of area of circular to area of rectangular waveguide in case a and case b\n",
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "a1 = 1.70645        #for case a\n",
      "b1 = a1/2           #for case a\n",
      "b2 = 1.4621         #for case b\n",
      "\n",
      "#Calculations\n",
      "#Case a(For TE10 mode)\n",
      "Area_rw1 = a1*b1\n",
      "Area_cw1 = math.pi\n",
      "Ratio1 = Area_cw1/Area_rw1\n",
      "\n",
      "#Case b(For TM mode)\n",
      "Area_rw2 = b2**2\n",
      "Area_cw2 = math.pi\n",
      "Ratio2 = Area_cw2/Area_rw2\n",
      "\n",
      "\n",
      "#Results\n",
      "print \"Case a\"\n",
      "print \"Ratio of area of circular to area of rectangular waveguide =\",round(Ratio1,1),\"\\n\"\n",
      "print \"Case b\"\n",
      "print \"Ratio of area of circular to area of rectangular waveguide =\",round(Ratio2,1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Case a\n",
        "Ratio of area of circular to area of rectangular waveguide = 2.2 \n",
        "\n",
        "Case b\n",
        "Ratio of area of circular to area of rectangular waveguide = 1.5\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7, Page number 146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate breadth of rectangular waveguide\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "f = 9.*10**9   #frequency(Hz)\n",
      "lamda_g = 4.   #guide wavelength(cm)\n",
      "c = 3.*10**10  #velocity of propagation(cm/s)\n",
      "\n",
      "#Calculations\n",
      "lamda_o = c/f\n",
      "lamda_c = math.sqrt((lamda_o**2)/(1-(lamda_o**2/lamda_g**2)))\n",
      "#For TE10 mode,\n",
      "a = lamda_c/2\n",
      "b = lamda_c/4  #@since a=2b\n",
      "#Results\n",
      "print \"The breadth of rectangular waveguide is\",round(b,1),\"cms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The breadth of rectangular waveguide is 1.5 cms\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8, Page number 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate cut-off wavelength,guided wavelength,pahse velocity,group velocity\n",
      "#Variable declaration\n",
      "a = 10          #breadth of waveguide(cms)\n",
      "f = 2.5*10**9   #frequency of signal(Hz)\n",
      "c = 3*10**10     #velocity of propagation(cm/s)\n",
      "\n",
      "#Calculations\n",
      "lamda_c = 2*a   #cut-off wavelength\n",
      "lamda_o = c/f   \n",
      "x = math.sqrt(1-((lamda_o/lamda_c)**2))\n",
      "lamda_g = (lamda_o/x) #guided wavelength\n",
      "Vp = c/x             #Phase velocity\n",
      "Vg = c**2/Vp          #Group velocity\n",
      "\n",
      "#Results\n",
      "print \"The cut-off wavelength is\", round(lamda_c),\"cm\"\n",
      "print \"The guided wavelength is\",round(lamda_g),\"cm\"\n",
      "print \"The pahse velocity is\",round((Vp/1E+10),2),\"*10^10 cm/sec\"\n",
      "print \"The group velocity is\",round((Vg/1E+10),2),\"*10^10 cm/sec\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cut-off wavelength is 20.0 cm\n",
        "The guided wavelength is 15.0 cm\n",
        "The pahse velocity is 3.75 *10^10 cm/sec\n",
        "The group velocity is 2.4 *10^10 cm/sec\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9, Page number 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 147 example 4.9\n",
      "import math\n",
      "\n",
      "f=8.6*10.**9.##frequency in Hz\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "a=2.5##Length of a Waveguide in cm\n",
      "b=1.##Width of a Waveguide in cm\n",
      "\n",
      "#CALCULATION\n",
      "print '%s' %('The condition for the wave to propagate along a guide is that wc>w0.')#\n",
      "w0=c/f##free space wavelength in cm\n",
      "print '%s %.3f' %('\\nFree space wavelength w0 in cm is =',w0)#\n",
      "print '%s' %('\\nFor TE waves, wc=(2ab/sqrt((mb)**2+(na)**2))')#\n",
      "print '%s ' %('For TE01 waves')#\n",
      "m1=0#\n",
      "n1=1.#\n",
      "wc1=((2.*a*b)/(math.sqrt((m1*b)**2+(n1*a)**2)))##Cutoff wavelength for TE01 mode in cm\n",
      "print '%s %.f' %('\\nCutoff wavelength for TE01 mode in cm is =',wc1)#\n",
      "print '%s' %('\\nSince wc for TE01=2cm is not greater than w0 TE01,will not propagate for TE01 mode.')#\n",
      "print '%s' %('For TE10 waves')#\n",
      "m2=1.#\n",
      "n2=0#\n",
      "wc2=((2.*a*b)/(math.sqrt((m2*b)**2.+(n2*a)**2.)))##Cutoff wavelength for TE10 mode in cm\n",
      "print '%s %.f' %('\\nCutoff wavelength for TE10 mode in cm is =',wc2)#\n",
      "print '%s' %('\\nSince wc TE10 > w0 TE10 is a possible mode.')#\n",
      "fc=(c/wc2)/10.**9.##Cutoff frequency in GHz\n",
      "print '%s' %('\\nFor TE11 and TM11 waves')#\n",
      "m3=1.#\n",
      "n3=1.#\n",
      "wc3=((2.*a*b)/(math.sqrt((m3*b)**2.+(n3*a)**2.)))##Cutoff wavelength for TE11 mode in cm\n",
      "print '%s %.3f' %('Cutoff wavelength for TE11 and TM11 modes in cm is =',wc3)#\n",
      "print '%s' %('\\nAs wc for TE11 and TM11 is < w0 both TE11 and TM11 do not propagate as higher modes.')#\n",
      "wg=(w0/math.sqrt(1-(w0/wc2)**2))##Guide wavelength in cm\n",
      "print '%s' %('\\nFrom the above analysis we conclude that only TE10 mode is possible')#\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.f %s %s %.3f %s' %('\\nCutoff frequency is fc=',fc,'GHz','\\nGuide wavelength is wg=',wg,'cm')#"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The condition for the wave to propagate along a guide is that wc>w0.\n",
        "\n",
        "Free space wavelength w0 in cm is = 3.488\n",
        "\n",
        "For TE waves, wc=(2ab/sqrt((mb)**2+(na)**2))\n",
        "For TE01 waves \n",
        "\n",
        "Cutoff wavelength for TE01 mode in cm is = 2\n",
        "\n",
        "Since wc for TE01=2cm is not greater than w0 TE01,will not propagate for TE01 mode.\n",
        "For TE10 waves\n",
        "\n",
        "Cutoff wavelength for TE10 mode in cm is = 5\n",
        "\n",
        "Since wc TE10 > w0 TE10 is a possible mode.\n",
        "\n",
        "For TE11 and TM11 waves\n",
        "Cutoff wavelength for TE11 and TM11 modes in cm is = 1.857\n",
        "\n",
        "As wc for TE11 and TM11 is < w0 both TE11 and TM11 do not propagate as higher modes.\n",
        "\n",
        "From the above analysis we conclude that only TE10 mode is possible\n",
        "\n",
        "Cutoff frequency is fc= 6 GHz \n",
        "Guide wavelength is wg= 4.869 cm\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10, Page number 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate required cross sectional area\n",
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "lamda_c = 10           #cut-off wavelength(cms)\n",
      "c = 3*10**10           #velocity of propagation\n",
      "\n",
      "#Calculations\n",
      "#For TE11 mode in a circular waveguide,\n",
      "r = (lamda_c*1.841)/(2*math.pi)      #radius of circular waveguide(cms)\n",
      "a = math.pi*r**2                   #area of circular waveguide\n",
      "fc = c/lamda_c                     #cut-off frequency(Hz)\n",
      "\n",
      "#Results\n",
      "print \"The required cross sectional area is\", round(a,2),\"cms^2\"\n",
      "print \"Frequencies above\",round((fc/1E+9),2),\"GHz can be propagated throught the waveguide\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required cross sectional area is 26.97 cms^2\n",
        "Frequencies above 3.0 GHz can be propagated throught the waveguide\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11, Page number 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 149 example 4.11\n",
      "#For a rectangular waveguide\n",
      "import math\n",
      "f=5.*10.**9.##frequency in Hz\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "a=4.##Length of Rectangular Waveguide in cm\n",
      "b=3.##Width of Rectangular Waveguide in cm\n",
      "\n",
      "#CALCULATION\n",
      "print '%s' %('The condition for the wave to propagate along a guide is that wc>w0.')#\n",
      "w0=c/f##free space wavelength in cm\n",
      "print '%s %.2f' %('Free space wavelength w0 in cm is =',w0)#\n",
      "print '%s' %('\\nFor TE waves, wc=(2ab/sqrt((mb)**2+(na)**2))')#\n",
      "print '%s' %('For TE01 waves')#\n",
      "m1=0#\n",
      "n1=1.#\n",
      "wc1=((2.*a*b)/(math.sqrt((m1*b)**2.+(n1*a)**2.)))##Cutoff wavelength for TE01 mode in cm\n",
      "print '%s %.f' %('\\nCutoff wavelength for TE01 mode in cm is =',wc1)#\n",
      "print '%s' %('\\nSince wc for TE01=6cm is not greater than w0 TE01,will not propagate for TE01 mode.')#\n",
      "print '%s' %('For TE10 waves')#\n",
      "m2=1.#\n",
      "n2=0#\n",
      "wc2=((2.*a*b)/(math.sqrt((m2*b)**2.+(n2*a)**2.)))##Cutoff wavelength for TE10 mode in cm\n",
      "print '%s %.f' %('\\nCutoff wavelength for TE10 mode in cm is =',wc2)#\n",
      "print '%s' %('\\nSince wc TE10 > w0 TE10 is a possible mode.')#\n",
      "print '%s' %('For TE11 waves')#\n",
      "m3=1.#\n",
      "n3=1.#\n",
      "wc3=((2.*a*b)/(math.sqrt((m3*b)**2.+(n3*a)**2.)))##Cutoff wavelength for TE11 mode in cm\n",
      "print '%s %.1f' %('\\nCutoff wavelength for TE11 mode in cm is =',wc3)#\n",
      "print '%s' %('\\nAs wc TE11 < w0 TE11 does not propagate.')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The condition for the wave to propagate along a guide is that wc>w0.\n",
        "Free space wavelength w0 in cm is = 6.00\n",
        "\n",
        "For TE waves, wc=(2ab/sqrt((mb)**2+(na)**2))\n",
        "For TE01 waves\n",
        "\n",
        "Cutoff wavelength for TE01 mode in cm is = 6\n",
        "\n",
        "Since wc for TE01=6cm is not greater than w0 TE01,will not propagate for TE01 mode.\n",
        "For TE10 waves\n",
        "\n",
        "Cutoff wavelength for TE10 mode in cm is = 8\n",
        "\n",
        "Since wc TE10 > w0 TE10 is a possible mode.\n",
        "For TE11 waves\n",
        "\n",
        "Cutoff wavelength for TE11 mode in cm is = 4.8\n",
        "\n",
        "As wc TE11 < w0 TE11 does not propagate.\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12, Page number 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Cut-off wavelength,Cut-off wavelength,Guide wavelength\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d = 4           #inner diameter of circular waveguide(cms)\n",
      "c = 3*10**10    #velocity od propagation(m/s)\n",
      "fs = 5*10**9    #signal frequency(Hz)\n",
      "\n",
      "#Calculations\n",
      "r = d/2                         #radius(cms)\n",
      "lamda_c = (2*math.pi*r)/1.841\n",
      "fc = c/lamda_c\n",
      "lamda_o = c/fs\n",
      "lamda_g = lamda_o/math.sqrt(1-((lamda_o/lamda_c)**2))\n",
      "\n",
      "#Results\n",
      "print \"Cut-off wavelength =\",round(lamda_c,4),\"cms\"\n",
      "print \"Cut-off frequency =\",round((fc/1E+9),3),\"GHz\"\n",
      "print \"Guide wavelength =\",round(lamda_g,2),\"cms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cut-off wavelength = 6.8258 cms\n",
        "Cut-off frequency = 4.395 GHz\n",
        "Guide wavelength = 12.58 cms\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13, Page number 150"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Frequency of wave\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "a = 6.               #length of rectangular waveguide(cms)\n",
      "b = 4.               #breadth of rectangular waveguide(cms)\n",
      "d = 4.55            #distance between maximum and minimum(cms)\n",
      "c = 3.*10**10        #velocity of propagation(cm/s)\n",
      "\n",
      "#Calculations\n",
      "#For TE10 mode:\n",
      "lamda_c = 2*a\n",
      "lamda_g = d*4\n",
      "lamda_o = math.sqrt(1./(((1./lamda_g**2)+(1./lamda_c**2))))\n",
      "f = c/lamda_o\n",
      "\n",
      "#Results\n",
      "print \"Frequency of wave is\",round((f/1E+9)),\"GHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency of wave is 3.0 GHz\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14, Page number 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Guide wavelength,Phase constant,Phase velocity \n",
      "#chapter-4 page 151 example 4.14\n",
      "#For a rectangular waveguide\n",
      "import math\n",
      "b=2.5##Length of Rectangular Waveguide in cm\n",
      "a=5.##breadth of Rectangular Waveguide in cm\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "w0=4.5##Free space wavelength in cm\n",
      "\n",
      "#CALCULATION\n",
      "print '%s' %('For a TE10 mode which is the dominant mode')#\n",
      "wc=2.*a##Cutoff wavelength in cm\n",
      "wg=(w0/math.sqrt(1.-(w0/wc)**2.))##Guide wavelength in cm\n",
      "Vp=(c/math.sqrt(1.-(w0/wc)**2.))/10.**10.##Phase Velocity in 10**10 cm/sec\n",
      "B=((2.*(math.pi)*math.sqrt(wc**2.-w0**2.))/(w0*wc))##Phase constant in radians\n",
      "\n",
      "#OUTPUT\n",
      "print \"Solutions obtained in the textbook are incorrect due to calculation mistake in lamda_g\"\n",
      "print '%s %1.5f %s %s %1.3f %s %s %1.2f %s ' %('\\nGuide wavelength is wg  =',wg,'cm','\\nPhase constant is B =',B,'radians','\\nPhase Velocity is Vp =',Vp,'*10**10 cm/sec')#\n",
      "\n",
      "#Note: Check the answers once\n",
      "#Correct answers are\n",
      "#Guide wavelength is wg = 5.03903 cm \n",
      "#Phase constant is B = 1.247 radians \n",
      "#Phase Velocity is Vp = 3.36*10**10 cm/sec"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For a TE10 mode which is the dominant mode\n",
        "Solutions obtained in the textbook are incorrect due to calculation mistake in lamda_g\n",
        "\n",
        "Guide wavelength is wg  = 5.03903 cm \n",
        "Phase constant is B = 1.247 radians \n",
        "Phase Velocity is Vp = 3.36 *10**10 cm/sec \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.15, Page number 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate For any wave to be propagated, the condition to be met is wc>wo\n",
      "#chapter-4 page 152 example 4.15\n",
      "wcTE10=16.##Critical wavelength of TE10 mode in cm\n",
      "wcTM11=7.16##Critical wavelength of TM11 mode in cm\n",
      "wcTM21=5.6##Critical wavelength of TM21 mode in cm\n",
      "print '%s' %('For any wave to be propagated, the condition to be met is wc>wo')#\n",
      "wo1=10.##Free space wavelength in cm\n",
      "wo2=5.##Free space wavelength in cm\n",
      "print '%s %.2f' %('Critical wavelength of TE10 mode in cm is =',wcTE10)#\n",
      "print '%s %.2f' %('Critical wavelength of TM11 mode in cm is =',wcTM11)#\n",
      "print '%s %.2f' %('Critical wavelength of TM21 mode in cm is =',wcTM21)#\n",
      "print '%s' %('\\nFor wo1=10cm,\\nThe mode that propagates only TE10. Because wcTE10>wo1 and all other modes that is TM11 TM21 donot propagate')#\n",
      "print '%s' %('\\nFor wo2=5cm')#\n",
      "print '%s' %('wcTE10>wo2, so TE10 mode propagates')#\n",
      "print '%s' %('wcTM11>wo2, so TE11 mode propagates')#\n",
      "print '%s' %('wcTE21>wo2, so TE21 mode propagates')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For any wave to be propagated, the condition to be met is wc>wo\n",
        "Critical wavelength of TE10 mode in cm is = 16.00\n",
        "Critical wavelength of TM11 mode in cm is = 7.16\n",
        "Critical wavelength of TM21 mode in cm is = 5.60\n",
        "\n",
        "For wo1=10cm,\n",
        "The mode that propagates only TE10. Because wcTE10>wo1 and all other modes that is TM11 TM21 donot propagate\n",
        "\n",
        "For wo2=5cm\n",
        "wcTE10>wo2, so TE10 mode propagates\n",
        "wcTM11>wo2, so TE11 mode propagates\n",
        "wcTE21>wo2, so TE21 mode propagates\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16, Page number 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Characteristic Wave Impedance\n",
      "#chapter-4 page 152 example 4.16\n",
      "import math\n",
      "n=120.*(math.pi)##Intrinsic Impedance\n",
      "a=3.##Length of Rectangular Waveguide in cm\n",
      "b=2.##Width of Rectangular Waveguide in cm\n",
      "f=10.**10.##Frequency in Hz\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "\n",
      "#CALCULATION\n",
      "wc=((2.*a*b)/math.sqrt(a**2.+b**2.))##Cutoff wavelength in TM11 mode in cms\n",
      "w0=(c/f)##Free space wavelength in cms\n",
      "ZTM=(n*math.sqrt(1.-(w0/wc)**2.))##Characteristic Wave Impedance in ohms\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.3f %s ' %('\\nCharacteristic Wave Impedance is ZTM=',ZTM,'ohms')#\n",
      "\n",
      "#Note: Check the given answer once it is wrong\n",
      "#correct answer is 163.242 ohms"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Characteristic Wave Impedance is ZTM= 163.242 ohms \n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17, Page number 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate diameter of waveguide,guide wavelength\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "f = 6.*10**9     #frequency(Hz)\n",
      "c = 3.*10**10    #velocity of propagation(cm/s)\n",
      "\n",
      "#Calculations\n",
      "fc = 0.8*f\n",
      "lamda_c = c/fc\n",
      "D = (lamda_c*1.841)/math.pi\n",
      "lamda_o = c/f\n",
      "lamda_g = lamda_o/(math.sqrt(1-((lamda_o/lamda_c)**2)))\n",
      "\n",
      "#Results\n",
      "print \"diameter of waveguide =\",round(D,4),\"cms\"\n",
      "print \"guide wavelength =\",round(lamda_g,3),\"cms\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "diameter of waveguide = 3.6626 cms\n",
        "guide wavelength = 8.333 cms\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.18, Page number 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 153 example 4.18\n",
      "#For a TE10 mode\n",
      "import math\n",
      "a=1.5##Length of an air filled square Waveguide in m\n",
      "b=1.##breadth of an air filled square Waveguide in cm\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "f=6.*10.**9.##Impressed Frequency in Hz\n",
      "er=4.##dielectric constant\n",
      "\n",
      "#CALCULATION\n",
      "wc=2.*a##Cutoff wavelength in cm\n",
      "fc=(c/wc)/10.**9.##Cutoff frequency in GHz\n",
      "print '%s %.2f' %('Cutoff frequency in GHz is =',fc)#\n",
      "\n",
      "\n",
      "print '%s' %('\\nThe impressed frequency of 6 GHz is less than the Cutoff frequency and hence the signal will not pass through the guide')#\n",
      "w=(c/f)##Wavelength in cm\n",
      "print '%s %.2f' %('\\nAlternatively, the wavelength of the impressed signal in cm is =',w)#\n",
      "wair=w#\n",
      "print '%s' %('\\nwhich is longer than the cutoff wavelength (3cm) and hence no propagation of the wave')#\n",
      "w1=wair/math.sqrt(er)##Wavelength in cm\n",
      "print '%s' %('If the waveguide is loaded with dielectric of er=4')#\n",
      "print '%s %.2f' %('\\nthen the wavelength in cm is =',w1)\n",
      "print '%s' %('\\nwhich is lessthan wair')#\n",
      "print '%s' %('Now the signal with 6 GHz frequency will pass through the dielectric loaded waveguide')#"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cutoff frequency in GHz is = 10.00\n",
        "\n",
        "The impressed frequency of 6 GHz is less than the Cutoff frequency and hence the signal will not pass through the guide\n",
        "\n",
        "Alternatively, the wavelength of the impressed signal in cm is = 5.00\n",
        "\n",
        "which is longer than the cutoff wavelength (3cm) and hence no propagation of the wave\n",
        "If the waveguide is loaded with dielectric of er=4\n",
        "\n",
        "then the wavelength in cm is = 2.50\n",
        "\n",
        "which is lessthan wair\n",
        "Now the signal with 6 GHz frequency will pass through the dielectric loaded waveguide\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.19, Page number 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate amount of attenuation\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "a = 1.5*10**-2      #length of rectangular waveguide(m)\n",
      "b = 1               #breadth of rectangular waveguide(cms)\n",
      "f = 6*10**9         #frequency(Hz)\n",
      "c = 3*10**10        #velocity of propagation(m/s)\n",
      "m = 1\n",
      "n = 0\n",
      "mu = 4*math.pi*10**-7\n",
      "e = 8.854*10**-12\n",
      "\n",
      "#Calculations\n",
      "#For dominant TE10 mode,\n",
      "lamda_c = 2*a\n",
      "fc = c/lamda_c\n",
      "w = 2*math.pi*f\n",
      "alpha = math.sqrt((((m*math.pi)/a)**2)+(((n*math.pi)/b)**2)- ((w**2)*mu*e))\n",
      "\n",
      "#Results\n",
      "print \"The amount of attenuation is\",round(alpha,1),\"nepass/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The amount of attenuation is 167.5 nepass/m\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20, Page number 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate The maximum power handling capacity of the waveguide\n",
      "#chapter-4 page 154 example 4.20\n",
      "import math\n",
      "a=3.##Length of Rectangular Waveguide in cm\n",
      "b=1.##Width of Rectangular Waveguide in cm\n",
      "f=9.*10.**9.##Frequency in Hz in TE10 mode\n",
      "c=3.*10.**10.##Velocity of Light in cm/sec\n",
      "Emax=3000.##Max potential gradient in V/cm\n",
      "\n",
      "#CALCULATION\n",
      "w0=(c/f)##Free space wavelength in cms\n",
      "print '%s %.2f' %('Free space Wavelength in cm is =',w0)#\n",
      "wc=2.*a##Cutoff wavelength in TE10 mode in cms\n",
      "wg=(w0/math.sqrt(1.-(w0/wc)**2.))##Guide wavelength in cms\n",
      "print '%s %.2f' %('Guide Wavelength in cm is =',wg)#\n",
      "P=((6.63*10.**(-4.))*(Emax**2.)*a*b*(w0/wg))/1000.##Power handling capability of the waveguide in kW\n",
      "\n",
      "#OUTPUT\n",
      "print '%s'%('\\nSolution obtained in the textbook is incorrect due to rounding off the actual value of lamda_g')\n",
      "print '%s %3.3f %s' %('\\nPower handling capability of the waveguide is P=',P,'kW')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Free space Wavelength in cm is = 3.33\n",
        "Guide Wavelength in cm is = 4.01\n",
        "\n",
        "Solution obtained in the textbook is incorrect due to rounding off the actual value of lamda_g\n",
        "\n",
        "Power handling capability of the waveguide is P= 14.884 kW\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21, Page number 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Maximum power\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "f = 9*10**9       #frequency(Hz)\n",
      "d = 5             #internal diameter(cms)\n",
      "Emax = 300        #maximum field strength(V/cm)\n",
      "c = 3*10**10      #velocity of propagation(m/s)\n",
      "\n",
      "#Calculations\n",
      "lamda_o = c/f\n",
      "#For domnant mode TE11,\n",
      "lamda_c = (math.pi*d)/1.841\n",
      "lamda_g = lamda_o/math.sqrt(1-((lamda_o/lamda_c)**2))\n",
      "Pmax = 0.490*(Emax**2)*(d**2)*(lamda_o/lamda_g)\n",
      "\n",
      "#Results\n",
      "print \"Maximum power =\",round((Pmax/1E+6),3),\"*10^6 W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum power = 1.032 *10^6 W\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.22, Page number 155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#chapter-4 page 155 example 4.22\n",
      "#calculate The Peak value of Electric field occuring in the guide\n",
      "#For an air filled square waveguide\n",
      "import math\n",
      "a=0.01##Length of an air filled square Waveguide in m\n",
      "b=0.01##breadth of an air filled square Waveguide in m\n",
      "c=3.*10.**8.##Velocity of Light in m/sec\n",
      "f=30.*10.**9.##Frequency in Hz in TE11 mode\n",
      "Pmax=746.##Max power =1 horsepower  in W\n",
      "n=120.*(math.pi)##Impedance of freespace in ohms\n",
      "\n",
      "#CALCULATION\n",
      "w0=(c/f)##Free space wavelength in m\n",
      "wc=2.*a##Cutoff wavelength in m\n",
      "ZTE=(n/math.sqrt(1.-(w0/wc)**2.))##Impedance in ohms\n",
      "Emax=(math.sqrt((Pmax*4*ZTE)/(a*b)))/1000.##The Peak value of Electric field occuring in the guide in kV/m\n",
      "#From P=(1/2)*Integration(Re(E*H))da\n",
      "#and Pmax=(1/(4*ZTE))*Emax**2*a*b\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.2f %s' %('\\nThe Peak value of Electric field occuring in the guide is Emax=',Emax,'kV/m')#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "The Peak value of Electric field occuring in the guide is Emax= 113.97 kV/m\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.23, Page number 155"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Breakdown power\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "a = 2.3          #length of rectangular waveguide(cms)\n",
      "b = 1.0          #breadth of rectangular waveguide(cms)\n",
      "f = 9.375*10**9  #frequency(Hz)\n",
      "c = 3*10**10     #velocity of propagation(m/s)\n",
      "\n",
      "#Calculations\n",
      "lamda_o = c/f\n",
      "x = (1-((lamda_o/(2*a))**2))**0.5\n",
      "Pbd = 597*a*b*x\n",
      "\n",
      "#Results\n",
      "print \"calculation error\"\n",
      "print \"\\nBreakdown power =\",round(Pbd,2),\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "calculation error\n",
        "\n",
        "Breakdown power = 986.41 W\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.24, Page number 156"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Breakdown power\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "d = 5.           #internal diameter(cms)\n",
      "a = d/2\n",
      "f = 9.*10**9     #frequency(Hz)\n",
      "c = 3.*10**10   #velocity of propagation\n",
      "\n",
      "#Calculations\n",
      "lamda_o = c/f\n",
      "lamda_c = (math.pi*d)/1.841\n",
      "fc = c/lamda_c\n",
      "x = (1 - ((fc/f)**2))**0.5\n",
      "Pbd = 1790.*a*a*x\n",
      "\n",
      "#Results\n",
      "print \"Breakdown power =\",round((Pbd/1E+3),3),\"kW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Breakdown power = 10.298 kW\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}