{
 "metadata": {
  "name": "",
  "signature": "sha256:700ab6262dd3fd322aa3ece04f53175fb8f709a487cc0649654e8878a7afd58c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "chapter09:Solid State Microwave devices"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1, Page number 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Frequncy of IMPATT diode\n",
      "#Variable declaration\n",
      "L = 2*10**-6          #drift length(m)\n",
      "Vd = 10**7*10**-2      #dfrift velocit(m/s)\n",
      "\n",
      "#Calculations\n",
      "f = Vd/(2*L)\n",
      "\n",
      "#Results\n",
      "print \"Frequncy of IMPATT diode is\",round((f/1E+9),2),\"GHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequncy of IMPATT diode is 25.0 GHz\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2, Page number 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate threshold electric field\n",
      "#Variable declaration\n",
      "f = 10*10**9         #operating frequency(Hz)\n",
      "L = 75*10**-6        #device length(m)\n",
      "V = 25.              #voltage pulse amplified(V)\n",
      "\n",
      "#Calculations\n",
      "Eth = V/(L)\n",
      "\n",
      "#Result\n",
      "print \"The threshold electric field is\",round((Eth/1E+5),2),\"KV/cm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The threshold electric field is 3.33 KV/cm\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3, Page number 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Power gain,Power gain as USB converter\n",
      "#chapter-9 page 411 example 9.3\n",
      "import math\n",
      "fs=2.*10.**9.;#Signal Frequency in Hz\n",
      "fp=12.*10.**9.#Pump Frequency in Hz\n",
      "Ri=16.;#O/P resistance of signal generator in ohms\n",
      "Rs=1000.;#On types resistance of signal generator in ohms\n",
      "\n",
      "#CALCULATION\n",
      "P=10*math.log10((fp-fs)/fs);#Power gain in dB\n",
      "Pusb=10*math.log10((fp+fs)/fs);#Power gain as USB converter in dB\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.2f %s %s %.2f %s' %('Power gain is P=',P,'dB','\\nPower gain as USB converter is Pusb=',Pusb,'dB')\n",
      "\n",
      "#Note: Answer given in textbook is wrong Check it once..\n",
      "#Correct answers are Power gain is P=6.99 dB \n",
      "#Power gain as USB converter is Pusb=8.45 dB \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power gain is P= 6.99 dB \n",
        "Power gain as USB converter is Pusb= 8.45 dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4, Page number 411"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Critical voltage ,Breakdown voltage,Breakdown electric field \n",
      "#Variable declaration\n",
      "Es = 12.5             #relative dielectric constant\n",
      "N = 3.2*10**22        #donor concentration(/m**3)\n",
      "L = 8*10**-6          #length(m)\n",
      "Eo = 8.854*10**-12    #dielectric constant\n",
      "q = 1.6*10**-19\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "Vc = (q*N*L**2)/(2*Eo*Es)\n",
      "\n",
      "#Part b\n",
      "Vbd = 2*Vc\n",
      "\n",
      "#Part c\n",
      "Ebd = Vbd/L\n",
      "\n",
      "#Results\n",
      "print \"Critical voltage =\",round((Vc/1E+3),2),\"kV\"\n",
      "print \"Breakdown voltage =\",round((Vbd/1E+3),2),\"kV\"\n",
      "print \"Breakdown electric field =\",round((Ebd/1E+8),2),\"*10**8 V/cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Critical voltage = 1.48 kV\n",
        "Breakdown voltage = 2.96 kV\n",
        "Breakdown electric field = 3.7 *10**8 V/cm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5, Page number 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate avalanche zone velocity\n",
      "#Variable declaration\n",
      "Na = 2.5*10**16       #doping concentration(/cm**3)\n",
      "J = 33*10**3          #current density(A/cm**2)\n",
      "q = 1.6*10**-19\n",
      "\n",
      "#Calculations\n",
      "Vz = J/(q*Na)\n",
      "\n",
      "#Results\n",
      "print \"The avalanche zone velocity is\",round((Vz/1E+6),2),\"*10**6 cm/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The avalanche zone velocity is 8.25 *10**6 cm/s\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6, Page number 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate power gain\n",
      "#Variable declaration\n",
      "Rd = -25      #negative resistance(Ohms)\n",
      "Rl = 50       #load resistance(Ohms)\n",
      "\n",
      "#Calculations\n",
      "G = ((Rd-Rl)/(Rd+Rl))**2\n",
      "\n",
      "#Results\n",
      "print \"Power gain =\",G"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power gain = 9\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7, Page number 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate minimum voltage required\n",
      "#chapter-9 page 412 example 9.7\n",
      "#For a Gunn Diode\n",
      "L=5.*10.**(-4.);#Drift Length in cm\n",
      "Vg=3300.;#Voltage gradient in V/cm [Vg>3.3 kV/cm]\n",
      " \n",
      "#CALCULATION\n",
      "Vmin=Vg*L;#Minimum Voltage needed to initiate Gunn effect in volts\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.2f %s' %('\\nMinimum Voltage needed to initiate Gunn effect is Vmin=',Vmin,'volts');\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Minimum Voltage needed to initiate Gunn effect is Vmin= 1.65 volts\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.8, Page number 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate Natural(Rational) Frequency,Critical Voltage of the diode\n",
      "#chapter-9 page 412 example 9.8\n",
      "#For a Gunn Diode\n",
      "L=20.*10.**(-4.);#Active Length in cm\n",
      "Vd=2.*10.**7.;#Drift Velocity of Electrons in cm/sec\n",
      "Ec=3.3*10.**3.;#Criticl Field for GaAs in V/cm\n",
      "\n",
      "#CALCULATION\n",
      "fn=(Vd/L)/10.**9.;#Natural(Rational) Frequency in GHz\n",
      "Vc=L*Ec;#Critical Voltage of the diode in volts\n",
      "\n",
      "#OUTPUT\n",
      "print '%s %.f %s %s %.1f %s ' %('\\nNatural(Rational) Frequency is fn=',fn,'GHz','\\nCritical Voltage of the diode is Vc=',Vc,'volts');\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Natural(Rational) Frequency is fn= 10 GHz \n",
        "Critical Voltage of the diode is Vc= 6.6 volts \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.9, Page number 412"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the resonant frequency,Efficiency\n",
      "from math import pi,sqrt\n",
      "\n",
      "#Variable declaration\n",
      "Cj = 0.5*10**-12       #capacitance of IMPATT diode(F)\n",
      "Lp = 0.5*10**-9        #Inductance of IMPATT diode(H)\n",
      "Vbd = 100              #breakdown voltage(V)\n",
      "Ib = 100*10**-3        #dc bias current(A)\n",
      "Ip = 0.8               #peak current(A)\n",
      "Rl = 2                 #load resistance(Ohms)\n",
      "\n",
      "#Calculations\n",
      "f = 1/(2*pi*sqrt(Lp*Cj))\n",
      "Pl = ((Ip**2)*Rl)/2\n",
      "Pdc = Vbd*Ib\n",
      "N = (Pl/Pdc)*100\n",
      "\n",
      "#Results\n",
      "print \"The resonant frequency is\",round((f/1E+9)),\"GHz\"\n",
      "print \"Efficiency is\",round(N,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resonant frequency is 10.0 GHz\n",
        "Efficiency is 6.4 %\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.10, Page number 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Drift time of the carrier,Operating frequency of diode\n",
      "\n",
      "#Variable declaration\n",
      "Vd = 10**5     #carrier dirft velocity(cm/s)\n",
      "L = 2*10**-6   #drift length(m)\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "tou = L/Vd\n",
      "\n",
      "#Part b\n",
      "f = 1/(2*tou)\n",
      "\n",
      "#Results\n",
      "print \"Drift time of the carrier is\",round((tou/1E-11),2),\"*10**-11 sec\"\n",
      "print \"Operating frequency of diode is\",(f/1E+9),\"GHz\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drift time of the carrier is 2.0 *10**-11 sec\n",
        "Operating frequency of diode is 25.0 GHz\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.11, Page number 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Breakdown voltage,Breakdown electric field\n",
      "\n",
      "#Variable declaration\n",
      "Er = 11.8          #relative dielectric constant\n",
      "N = 3*10**21       #donor concentration(m^-3)\n",
      "L = 6.2*10**-6     #Si length(m)\n",
      "q = 1.6*10**-19    #charge of an electron(C)\n",
      "Eo = 8.854*10**-12 #dielctric constant\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "Vbd = (q*N*L**2)/(Eo*Er)\n",
      "\n",
      "#Part b\n",
      "Ebd = Vbd/L\n",
      "\n",
      "#Results\n",
      "print \"Breakdown voltage =\",round(Vbd,1),\"V\"\n",
      "print \"Breakdown electric field =\",round((Ebd/1E+7),2),\"*10**7 V/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Breakdown voltage = 176.6 V\n",
        "Breakdown electric field = 2.85 *10**7 V/m\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.12, Page number 413"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Maximum power gain,Noise figure,Bandwidth\n",
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "rQ = 8.        #figure of merit\n",
      "fo_fs = 8.     #ratio of o/p to i/p frequency\n",
      "Td = 300.      #diode temperatur(K)\n",
      "To = 300.      #ambient temperature(K)\n",
      "r = 0.2\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "X = rQ**2/fo_fs\n",
      "G = (X/((1+math.sqrt(1+X))**2))*fo_fs\n",
      "g = 10*math.log10(G)\n",
      "\n",
      "#Part b\n",
      "F = 1+((2*Td)/To)*((1/rQ)+(1/rQ**2))\n",
      "f = 10*math.log10(F)\n",
      "\n",
      "#Part c\n",
      "BW = 2*r*math.sqrt(fo_fs)\n",
      "\n",
      "#Results\n",
      "print \"Maximum power gain =\",round(g,2),\"dB\"\n",
      "print \"Noise figure =\",round(f,2),\"dB\"\n",
      "print \"Bandwidth =\",round(BW,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum power gain = 6.02 dB\n",
        "Noise figure = 1.08 dB\n",
        "Bandwidth = 1.13\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.13, Page number 414"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Equivalent noise resistance,Gain,Noise figure,Bandwidth\n",
      "#Variable declaration\n",
      "import math\n",
      "fs = 2*10**9       #signal frequency(Hz)\n",
      "fp = 12*10**9      #amplifier frquency(Hz)\n",
      "fi = 10*10**9      #input frequency(Hz)\n",
      "fd = 5*10**9       #diode frequency(Hz)\n",
      "Ri = 1*10**3       #input resistance(Ohms)\n",
      "Rg = 1*10**3       #gate resistance(Ohms)\n",
      "RTs = 1*10**3      #resistance(Ohms)\n",
      "RTi = 1*10**3      #resistance(Ohms)\n",
      "r = 0.35           #resistane(Ohms)\n",
      "rQ = 10.            #figure of merit\n",
      "rd = 300           #diode temperature(K)\n",
      "C = 0.01*10**-12   #capacitance(F)\n",
      "Td = 300\n",
      "To = 300\n",
      "\n",
      "#Calculations\n",
      "#Part a\n",
      "ws = 2*math.pi*fs\n",
      "wi = 2*math.pi*fi\n",
      "R = (r**2)/(ws*wi*C**2*RTi)\n",
      "a = R/RTs\n",
      "\n",
      "#Part b\n",
      "G = (4*fi*Rg*Ri*a)/(fs*RTs*RTi*(1-a)**2)\n",
      "g = 10*math.log10(G)\n",
      "\n",
      "#Part c\n",
      "F = 1+((2*Td)/To)*((1/rQ)+(1/rQ**2))\n",
      "f = 10*math.log10(F)\n",
      "\n",
      "#Part d\n",
      "BW = (r/2)*math.sqrt(fd/(fs*G))\n",
      "\n",
      "#Results\n",
      "print \"Equivalent noise resistance =\",round(a,2),\"Ohms\"\n",
      "print \"Gain =\",round(g,1),\"dB\"\n",
      "print \"Noise figure =\",round(f,2),\"dB\"\n",
      "print \"Bandwidth =\",round(BW,3),\"(Calculation error in the textbook)\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Equivalent noise resistance = 1.55 Ohms\n",
        "Gain = 20.1 dB\n",
        "Noise figure = 0.86 dB\n",
        "Bandwidth = 0.027 (Calculation error in the textbook)\n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}