{

 "metadata": {

  "name": "",

  "signature": "sha256:ee8ead130cd20bf208c1745a750e51dbe8ebb757e8693bff3ccfb09c0b5cc29e"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter4:MICROWAVE WAVEGUIDES AND COMPONENTS"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.1.1:pg-128"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#(a)program to find the cut-off frequency (fc) of an air-filled rectangular waveguide in TE10 mode.\n",

      "a=0.07          #wave-guide dimension in meters\n",

      "b=0.035         #wave-guide dimension in meters\n",

      "f=3.5*(10**9)   #operating frequency in Hz \n",

      "c=3*(10**8)     # c is the speed of the light (m/s)\n",

      "m=1             #Given that guide operates in the dominant mode TE10\n",

      "n=0\n",

      "fc=c/(a*2)      #since,fc=(c/2)*sqrt(((m/a)**2)+((n/b)**2)). For TE10 mode m=1,n=0,fc=c/2*a \n",

      "print\"Cut-off frequency for TE10 mode (in GHz)is=\",round(fc/10**9,2),\"GHz\"#print fc ,fc is divided by 10**9 to obtain frequency in GHZ\n",

      "\n",

      "#(b) program to find the phase velocity of the wave in the guide at a frequency of 3.5GHZ\n",

      "              \n",

      "vg=c/(sqrt(1-((fc/f)**2)))  #since , phase velocity=c/(sqrt(1-((fc/f)**2))) \n",

      "print\"Phase velocity for a wave at a frequency of 3.5GHZ  (m/s)is=\",\"{:.2e}\".format(vg),\"m/s\"  #print the phase velocity\n",

      "\n",

      "# (c) program to find the guideD wavelength(lg of the wavE at a frequency of 3.5GHZ)\n",

      "lo=c/f                                # lo= wavelength in an unbounded dielectric and lo is in meters\n",

      "lg_in_metres=lo/(sqrt(1-((fc/f)**2))) #since ,lg=lo/sqrt(1-((fc/f)**2)) guide wavelength(lg) is in meter\n",

      "lg_in_cm=100*lg_in_metres             #guided wavelength (lg) is in centimeters\n",

      "print\"Guided wavelength for a wave at frequency of 3.5GHZ (cm)is=\",round(lg_in_cm,1),\"cm\"  "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Cut-off frequency for TE10 mode (in GHz)is= 2.14 GHz\n",

        "Phase velocity for a wave at a frequency of 3.5GHZ  (m/s)is= 3.79e+08 m/s\n",

        "Guided wavelength for a wave at frequency of 3.5GHZ (cm)is= 10.8 cm\n"

       ]

      }

     ],

     "prompt_number": 32

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.1.2:pg-133"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "from scipy.integrate import dblquad\n",

      "import math\n",

      "#Program to find the peak value of the electric field occuring in the guide.\n",

      "m=1     #given guide transports energy in the TE10 mode.\n",

      "n=0\n",

      "f=30*(10**9)     #The impressed frequency in Hertz\n",

      "uo=(4*(math.pi))*(10**-7)  #scientific value of permeability of free space\n",

      "eo=8.854*(10**(-12))     #permittivity of free space in F/m\n",

      "a=0.02  # dimensions of wave-guide given in metres\n",

      "b=0.01\n",

      "energyrate=0.5*746 #given ,the rate of transport of energy =0.5 hp,1 horse power(1 hp)= 746 watts.\n",

      "kc=math.pi/a #kc is cutoff wave number ,kc=sqrt((m*pi/a)**2+(n*pi/b)**2),For m=1,n=0 we get kc=pi/a\n",

      "bg=sqrt((((2*math.pi*f)**2)*(uo*eo)) -(kc**2)) #bg is the phase constant in radian/metre, bg=sqrt(((w**2)*(uo*eo))-(kc**2))  where w=2*pi*f\n",

      "Zg=((2*math.pi*30*(10**9))*uo)/bg  #Zg is the characteristic wave impedence ,Zg=(w*uo)/bg  where w=2*pi*f\n",

      "\n",

      "#Defining the variables\n",

      "Ex=0    #For TE10 mode Ex=0\n",

      "#Ey = Eoy*sin((pi*x)/a)*exp(-1j*bg*z) (for TE10 mode) \n",

      "Ez=0    #For TE10 mode Ez=0 \n",

      "#since, Hx=(Eoy/Zg)*sin(pi*x)/a)*exp(-1j*bg*z) (for TE10 mode)\n",

      "Hy = 0  #For TE10 mode Hy=0\n",

      "#Hz=Hoz*cos((pi*x)/a)*exp(-1j*bg*z) (for TE10 mode).\n",

      "p=dblquad(lambda x, y :(sin((math.pi*x)/a))**2, 0, b, lambda x:0 ,lambda x:a )\n",

      "p=p[0]\n",

      "c=(bg*p)/(4*math.pi*f*uo)\n",

      "p=c*(eoy)**2\n",

      "p=373.\n",

      "eoy=sqrt(p/c)\n",

      "print\"The peak value of the electric intensity is=\",\"Eoy=\", round(eoy/1000,2),\"KV/m\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The peak value of the electric intensity is= Eoy= 53.87 KV/m\n"

       ]

      }

     ],

     "prompt_number": 35

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.2.1:pg-144"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "# (a) program to find the cut off frequency (fc) of circular waveguide in TE11 mode\n",

      "radius=0.05               #Given .Here radius is in meters. \n",

      "f=3*(10**9)               #operating frequency in Hertz\n",

      "uo=(4*(math.pi))*(10**-7) #scientific value of permeability of free space \n",

      "eo=8.85*(10**(-12))       #permittivity of free space in F/m\n",

      "n=1                       #Given that a TE11 mode is propagating.\n",

      "p=1 \n",

      "X=1.841                   #For TE11 mode in circular waveguide X= (kc*radius) =1.841\n",

      "kc=X/radius               #cut-off wave number\n",

      "fc=kc/((2*math.pi)*(sqrt(uo*eo)))        #since fc=kc/((2*pi)*(sqrt(uo*eo))) \n",

      "print\"Cut-off frequency for TE11 mode (in Hz)is=\",\"{:.3e}\".format(fc),\"Hz\"  \n",

      "\n",

      "# (b) program to find the guide wavelength(lg) of the wave  at operating frequency of 3GHZ\n",

      "bg=sqrt((((2*math.pi*f)**2)*(uo*eo)) - (kc**2)) #bg is the phase constant in radian/metre, bg=sqrt(((w**2)*(uo*eo))-(kc**2)) where w=2*pi*f\n",

      "lg_in_metres=(2*math.pi)/bg                     #Guide wavelength is in meters\n",

      "lg_in_cm=100*lg_in_metres                       #Guide wavelength is in centimeters\n",

      "print\"Guide wavelength for a wave at a frequency of 3GHz(in cm)is=\",round(lg_in_cm,1),\"cm\"   # print Guide wavelength for TE11 mode\n",

      "\n",

      "# (c) program to find the wave impedance zg in the guide\n",

      "zg=(2*math.pi*f*uo)/bg #Zg is the characteristic wave impedence ,Zg=(w*uo)/bg  where w=2*pi*f\n",

      "print\"Wave impedance zg in the wave guide(in ohm)=\",int(round(zg)),\"ohm\" #print wave impedance in the wave guide"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Cut-off frequency for TE11 mode (in Hz)is= 1.757e+09 Hz\n",

        "Guide wavelength for a wave at a frequency of 3GHz(in cm)is= 12.3 cm\n",

        "Wave impedance zg in the wave guide(in ohm)= 465 ohm\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.2.2:pg-147"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#program to find all the TE(n,p) and TM(n,p)modes for which energy transmisssion is possible.\n",

      "\n",

      "radius=0.02                  #Given. Here radius is in metres. \n",

      "uo=(4*(math.pi))*(10**-7)    #scientific values of permeability of free space\n",

      "eo=8.85*(10**(-12))          #permittivity of free space in F/m\n",

      "f=(10**10)                   #operating frequency in Hertz\n",

      "wc=(2*math.pi*f)             #since, wc=(2*pi*f) is the angular frequency in Hertz\n",

      "kc=wc*sqrt(uo*eo)            #kc is cut-off wave number  \n",

      "X=kc*radius                  #the product X=(kc*radius) for a given mode is constant\n",

      "print\"The value of the product X=(kc*radius)is =\",round(X,2)  #print the product X=(kc*a)\n",

      "print\"Any mode having a product (kc*radius) less than or equal to 4.19 will propagate the wave with a frequency of 10 GHZ .This is \\n\",\"(kc*radius)< =4.19\"\n",

      "print\"The possible modes are\" \n",

      "print\"TE11(1.841)   TM01(2.405)  \\n\",\"TE21(3.054)   TM11(3.832)  \\n\",\"TE01(3.832)\"   \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The value of the product X=(kc*radius)is = 4.19\n",

        "Any mode having a product (kc*radius) less than or equal to 4.19 will propagate the wave with a frequency of 10 GHZ .This is \n",

        "(kc*radius)< =4.19\n",

        "The possible modes are\n",

        "TE11(1.841)   TM01(2.405)  \n",

        "TE21(3.054)   TM11(3.832)  \n",

        "TE01(3.832)\n"

       ]

      }

     ],

     "prompt_number": 16

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.5.1:pg-170"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#(a)program to find the amount of the power dissipated in the load Zl\n",

      "PT4=8           #Given.Transmitted power to Bolometer 1 at port 4 in mW\n",

      "s=2             #Given.VSWR of 2.0 is introduced on arm 4 by Bolometer 1 in mW   \n",

      "r4=(s-1)/(s+1)  #reflection coefficient at port 4(r4)\n",

      "PR4=8/8         #(r4**2)=PR4/PI4=PR4/(PR4+PT4)=PR4/PR4+8=1/9 so we get 8PR4=8 \n",

      "PI4=PT4 + PR4   #PI4=power incident at port 4  PT4=power transmitted at port 4 PR4=power reflected at port 4 \n",

      "#Since port 3 is matched and the Bolometer at port 3 reads 2mw ,then 1 mw must be radiated through the holes. \n",

      "#Since 20 dB is equivalent to a power of 100:1,the power input at port 2 is given by PI2\n",

      "PI2=100*PI4     \n",

      "PR2=100.0*PR4  #power reflected from the load at port 2 is given by (mW)\n",

      "PT2=PI2-PR2    #power dissipated in the load = incident power - reflected power\n",

      "print\"power dissipated in the load at port 2 is given by (mW) =\",int(PT2),\"mW\"   \n",

      "\n",

      "#(b)Program to find the VSWR on arm 2\n",

      "r=sqrt(PR2/PI2)                     #reflection coefficient at port 2\n",

      "s=(1+r)/(1-r)                       #VSWR ON ARM 2                                                   \n",

      "print\"value of VSWR ON ARM 2 is=\",s "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "power dissipated in the load at port 2 is given by (mW) = 800 mW\n",

        "value of VSWR ON ARM 2 is= 2.0\n"

       ]

      }

     ],

     "prompt_number": 37

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg4.5.2:pg-174"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#(a)Program to find out the input and output VSWRs.\n",

      "s11=0                   #for balanced amplifier s11=(1/2)*(s11a-s11b) where s11a=s11b is given in question\n",

      "s=(1+s11)/(1-s11)       #Input VSWR\n",

      "print\"Input vswr=\",s \n",

      "s22=0                   #for balanced amplifier s22=(1/2)*(s22a-s22b) where s22a=s22b is given in question\n",

      "s=(1+s22)/(1-s22)       #output VSWR\n",

      "print\"Output vswr=\",s \n",

      "\n",

      "#(b)Program to find out the output power in watts\n",

      "Pg=10                   #power gain of each GaAs chip(dB)\n",

      "n=2                     #number of GaAs chip\n",

      "pin=200               #input signal power in mW\n",

      "PO=pin*Pg*n             #output power(PO)=[power input]*[power gain of each GaAs chip]*[n],here n=2\n",

      "print\"Output POWER (in Watt)=\",PO/1000,\"W\"  #print power in watts by dividing PO by 1000\n",

      "\n",

      "#(C)Program to find out the linear output power gain in db \n",

      "GAIN=10*math.log10(2)   #BECAUSE TWO CHIPS ARE IN PARALLEL. Gain=(power gain of each GaAs chip)*log(n),n=2.\n",

      "print\"Linear output power gain (in db)=\",int(round(GAIN)),\"dB\"   #print linear output power gain in db"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Input vswr= 1\n",

        "Output vswr= 1\n",

        "Output POWER (in Watt)= 4 W\n",

        "Linear output power gain (in db)= 3 dB\n"

       ]

      }

     ],

     "prompt_number": 36

    }

   ],

   "metadata": {}

  }

 ]

}