{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "CHAPTER 16 Frequency Effets"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-1, Page 567"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Avm=200                #mid band voltage gain\n",
      "f1=20                  #cutoff frequency1 (Hz)\n",
      "f2=20*10**3            #cutoff frequency2 (Hz)\n",
      "fi1=5                  #input frequency1(Hz)\n",
      "fi2=200*10**3          #input frequency2(Hz)\n",
      "\n",
      "Av=0.707*Avm                     #voltage gain at either frequency\n",
      "Av1=Avm/(1+(f1/fi1)**2)**0.5     #voltage gain for 5Hz\n",
      "Av2=Avm/(1+(fi2/f2)**2)**0.5     #voltage gain for 200KHz\n",
      "\n",
      "print 'voltage gain for 200KHz = ',round(Av1,2)\n",
      "print 'voltage gain for 5Hz = ',round(Av2,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 200KHz =  48.51\n",
        "voltage gain for 5Hz =  19.9\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-2, Page 568"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Avm=100000             #mid band voltage gain\n",
      "f2=10                  #cutoff frequency (Hz)\n",
      "\n",
      "Av=0.707*Avm                     #voltage gain at cutoff frequency\n",
      "\n",
      "print 'voltage gain for 10Hz = ',Av"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 10Hz =  70700.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-3, Page 569"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Avm=100000               #mid band voltage gain\n",
      "fc=10.0                  #cutoff frequency (Hz)\n",
      "fi1=100.0                #input frequency1(Hz)\n",
      "fi2=1*10**3              #input frequency2(Hz)\n",
      "fi3=10*10**3             #input frequency3(Hz)\n",
      "fi4=100*10**3            #input frequency4(Hz)\n",
      "fi5=1*10**6              #input frequency5(Hz)\n",
      "\n",
      "Av1=Avm/(1+(fi1/fc)**2)**0.5     #voltage gain for 100Hz\n",
      "Av2=Avm/(1+(fi2/fc)**2)**0.5     #voltage gain for 1KHz\n",
      "Av3=Avm/(1+(fi3/fc)**2)**0.5     #voltage gain for 10KHz\n",
      "Av4=Avm/(1+(fi4/fc)**2)**0.5     #voltage gain for 100KHz\n",
      "Av5=Avm/(1+(fi5/fc)**2)**0.5     #voltage gain for 1MHz\n",
      "\n",
      "print 'voltage gain for 100Hz = ',math.ceil(Av1)\n",
      "print 'voltage gain for 1KHz = ',math.ceil(Av2)\n",
      "print 'voltage gain for 10KHz = ',math.ceil(Av3)\n",
      "print 'voltage gain for 100KHz = ',math.ceil(Av4)\n",
      "print 'voltage gain for 1MHz = ',math.ceil(Av5)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 100Hz =  9951.0\n",
        "voltage gain for 1KHz =  1000.0\n",
        "voltage gain for 10KHz =  100.0\n",
        "voltage gain for 100KHz =  10.0\n",
        "voltage gain for 1MHz =  1.0\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-4, Page 571"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Ap1=1                    #power gain1\n",
      "Ap2=2                    #power gain2\n",
      "Ap3=4                    #power gain3\n",
      "Ap4=8                    #power gain4\n",
      "\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'\n",
      "print 'Each time Ap increase by factor 2, decibel power gain increases by 3 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  3.01 dB\n",
        "decibel power gain Ap3(dB) =  6.02 dB\n",
        "decibel power gain Ap4(dB) =  9.03 dB\n",
        "Each time Ap increase by factor 2, decibel power gain increases by 3 dB\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-5, Page 571"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Ap1=1                        #power gain1\n",
      "Ap2=0.5                      #power gain2\n",
      "Ap3=0.25                     #power gain3\n",
      "Ap4=0.125                    #power gain4\n",
      "\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',round(Ap_db2,2),'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',round(Ap_db3,2),'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',round(Ap_db4,2),'dB'\n",
      "print 'Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  -3.01 dB\n",
        "decibel power gain Ap3(dB) =  -6.02 dB\n",
        "decibel power gain Ap4(dB) =  -9.03 dB\n",
        "Each time Ap decreases by factor 2, decibel power gain decreases by 3 dB\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-6, Page 572"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Ap1=1                       #power gain1\n",
      "Ap2=10                      #power gain2\n",
      "Ap3=100                     #power gain3\n",
      "Ap4=1000                    #power gain4\n",
      "\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'\n",
      "print 'Each time Ap increases by factor 10, decibel power gain increases by 10 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  10.0 dB\n",
        "decibel power gain Ap3(dB) =  20.0 dB\n",
        "decibel power gain Ap4(dB) =  30.0 dB\n",
        "Each time Ap increases by factor 10, decibel power gain increases by 10 dB\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-7, Page 572"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Ap1=1                        #power gain1\n",
      "Ap2=0.1                      #power gain2\n",
      "Ap3=0.01                     #power gain3\n",
      "Ap4=0.001                    #power gain4\n",
      "\n",
      "Ap_db1=10*math.log10(Ap1)     #decibel power gain(dB)\n",
      "Ap_db2=10*math.log10(Ap2)     #decibel power gain(dB)\n",
      "Ap_db3=10*math.log10(Ap3)     #decibel power gain(dB)\n",
      "Ap_db4=10*math.log10(Ap4)     #decibel power gain(dB)\n",
      "\n",
      "print 'decibel power gain Ap1(dB) = ',Ap_db1,'dB'\n",
      "print 'decibel power gain Ap2(dB) = ',Ap_db2,'dB'\n",
      "print 'decibel power gain Ap3(dB) = ',Ap_db3,'dB'\n",
      "print 'decibel power gain Ap4(dB) = ',Ap_db4,'dB'\n",
      "print 'Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel power gain Ap1(dB) =  0.0 dB\n",
        "decibel power gain Ap2(dB) =  -10.0 dB\n",
        "decibel power gain Ap3(dB) =  -20.0 dB\n",
        "decibel power gain Ap4(dB) =  -30.0 dB\n",
        "Each time Ap decreases by factor 10, decibel power gain decreases by 10 dB\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-8, Page 575"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Av1=100                     #voltage gain1\n",
      "Av2=200                     #voltage gain2\n",
      "\n",
      "Av=Av1*Av2                    #total voltage gain\n",
      "Av_db=20*math.log10(Av)       #decibel total voltage gain(dB)\n",
      "Av_db1=20*math.log10(Av1)     #decibel voltage gain(dB)\n",
      "Av_db2=20*math.log10(Av2)     #decibel voltage gain(dB)\n",
      "Avt_db=Av_db1+Av_db2          #decibel total voltage gain(dB)\n",
      "\n",
      "print 'decibel total voltage gain Av(dB) = ',round(Av_db,2),'dB'\n",
      "print 'decibel voltage gain Av1(dB) = ',Av_db1,'dB'\n",
      "print 'decibel voltage gain Av2(dB) = ',round(Av_db2,2),'dB'\n",
      "print 'so, again, decibel total voltage gain by addition of both: Avt(dB) = ',round(Avt_db,2),'dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel total voltage gain Av(dB) =  86.02 dB\n",
        "decibel voltage gain Av1(dB) =  40.0 dB\n",
        "decibel voltage gain Av2(dB) =  46.02 dB\n",
        "so, again, decibel total voltage gain by addition of both: Avt(dB) =  86.02 dB\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-9, Page 577"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Av_db1=23                    #voltage gain1(dB)\n",
      "Av_db2=36                    #voltage gain2(dB)\n",
      "Av_db3=31                    #voltage gain3(dB)\n",
      "\n",
      "Avt_db=Av_db1+Av_db2+Av_db3          #decibel total voltage gain(dB)\n",
      "Ap=10**(Avt_db/10)                   #power gain by taking antilog\n",
      "Avt=10**(Avt_db/20.0)                #total voltage gain by taking antilog\n",
      "\n",
      "print 'decibel total voltage gain Avt(dB) = ',Avt_db,'dB'\n",
      "print 'power gain Ap = ',Ap\n",
      "print 'total voltage gain Avt = ',math.ceil(Avt)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "decibel total voltage gain Avt(dB) =  90 dB\n",
        "power gain Ap =  1000000000\n",
        "total voltage gain Avt =  31623.0\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-10, Page 577"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Av_db1=23                    #voltage gain1(dB)\n",
      "Av_db2=36                    #voltage gain2(dB)\n",
      "Av_db3=31                    #voltage gain3(dB)\n",
      "\n",
      "Av1=10**(Av_db1/20.0)        #voltage gain of stage 1 by taking antilog\n",
      "Av2=10**(Av_db2/20.0)        #voltage gain of stage 2 by taking antilog\n",
      "Av3=10**(Av_db3/20.0)        #voltage gain of stage 3 by taking antilog\n",
      "\n",
      "print 'voltage gain of stage 1 : Av1 = ',round(Av1,2)\n",
      "print 'voltage gain of stage 1 : Av2 = ',round(Av2,2)\n",
      "print 'voltage gain of stage 1 : Av3 = ',round(Av3,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain of stage 1 : Av1 =  14.13\n",
        "voltage gain of stage 1 : Av2 =  63.1\n",
        "voltage gain of stage 1 : Av3 =  35.48\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-11, Page 579"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Ap_dbm=24                           #power gain(dBm)\n",
      "\n",
      "P=10**(Ap_dbm/10.0)                 #Output power(mW)\n",
      "\n",
      "print 'Output power P = ',round(P,2),'mW'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output power P =  251.19 mW\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-12, Page 580"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "Av_dbV=-34                          #voltage gain(dBV)\n",
      "\n",
      "V=10**(Av_dbV/20.0)                 #Output voltage(V)\n",
      "\n",
      "print 'Output voltage V = ',math.ceil(V*1000),'mV'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Output voltage V =  20.0 mV\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-13, Page 583"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "Avm=100000             #mid band voltage gain\n",
      "f2=10                  #cutoff frequency (Hz)\n",
      "\n",
      "Av_db=20*math.log10(Avm)       #decibel total voltage gain(dB)\n",
      "\n",
      "print 'voltage gain for 10Hz = ',Av_db1,'dB'\n",
      "print 'At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain for 10Hz =  20.0 dB\n",
        "At 1MHz, due to roll off factor of 20 dB, voltage gain reduce to 0 dB\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-14, Page 588"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "R=5*10**3                      #resistance(Ohm)\n",
      "C=100*10**-12                  #Capacitance (F)\n",
      "\n",
      "f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)\n",
      "\n",
      "print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
      "print 'After f2, response rolls off at rate of 20 dB/decade'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  318.31 KHz\n",
        "After f2, response rolls off at rate of 20 dB/decade\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-15, Page 589"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "R=2*10**3                      #resistance(Ohm)\n",
      "C=500*10**-12                  #Capacitance (F)\n",
      "\n",
      "f2=(2*math.pi*R*C)**-1          #cutoff frequency (Hz)\n",
      "\n",
      "print 'cutoff frequency f2 = ',round((f2/1000),2),'KHz'\n",
      "print 'After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  159.15 KHz\n",
        "After f2, response rolls off at rate of 20 dB/decade up to funity of 15.9 MHz\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-17, Page 592"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "R=5.3*10**3                #resistance(Ohm)\n",
      "C=30*10**-12               #Capacitance (F)\n",
      "Av=100000                  #voltage gain\n",
      "\n",
      "Cout_M=C                     #input Miller Capacitance (F)\n",
      "Cin_M=Av*C                   #input Miller Capacitance (F)\n",
      "f2=(2*math.pi*R*Cin_M)**-1    #cutoff frequency (Hz)\n",
      "\n",
      "print 'cutoff frequency f2 = ',round(f2,3),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  10.01 Hz\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-18, Page 595"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "TR=1*10**-6                #rise time(s)\n",
      "\n",
      "f2=0.35/TR                 #cutoff frequency (Hz)\n",
      "\n",
      "print 'cutoff frequency f2 = ',f2/1000,'KHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "cutoff frequency f2 =  350.0 KHz\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-19, Page 597"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "re=22.7                 #from past dc calculation (example:9-5)(Ohm)\n",
      "VCC=10                  #collector voltage(V)\n",
      "RC=3.6                  #Collector resistance (KOhm)\n",
      "RE=1                    #Emitter resistance (KOhm)\n",
      "R1=10                   #Base resistance1 (KOhm)\n",
      "R2=2.2                  #Base resistance2 (KOhm)\n",
      "VBE=0.7                 #Base-emitter voltage drop(V)\n",
      "RL=10                   #Load resistance2 (KOhm)\n",
      "B=150                   #current gain\n",
      "RG=0.6                  #source resistance(KOhm)\n",
      "C1=0.47*10**-6          #input capacitance(F)\n",
      "C3=2.2*10**-6           #output capacitance(F)\n",
      "C2=10*10**-6            #emitter capacitance(F)\n",
      "\n",
      "Rinb=B*re/1000                                #Rin(base) (KOhm)\n",
      "Ri=RG+((R1**-1)+(Rinb**-1)+(R2**-1))**-1      #thevenin resistance facing i/p capacitor\n",
      "f1i=((2*math.pi*Ri*C1)**-1)/1000                      #input cutoff frequency (Hz)\n",
      "Ro=RC+RL                                      #thevenin resistance facing o/p capacitor\n",
      "f1o=((2*math.pi*Ro*C3)**-1)/1000                      #output cutoff frequency (Hz)\n",
      "Zout=(((RE**-1)+((re/1000)**-1))**-1)+((((R1**-1)+(R2**-1)+(RG**-1))**-1)/B) #thevenin resistance facing emitter-bypass capacitor\n",
      "f1z=((2*math.pi*Zout*C2)**-1)/1000                    #cutoff frequency for bypass circuit (Hz)\n",
      "\n",
      "\n",
      "print 'input cutoff frequency f1 = ',round(f1i,2),'Hz'\n",
      "print 'output cutoff frequency f1 = ',round(f1o,2),'Hz'\n",
      "print 'cutoff frequency for bypass circuit f1 = ',round(f1z,2),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input cutoff frequency f1 =  190.36 Hz\n",
        "output cutoff frequency f1 =  5.32 Hz\n",
        "cutoff frequency for bypass circuit f1 =  631.63 Hz\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-20, Page 602"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math   # This will import math module\n",
      "\n",
      "re=22.7                 #from past dc calculation (example:9-5)(Ohm)\n",
      "VCC=10                  #collector voltage(V)\n",
      "RC=3.6                  #Collector resistance (KOhm)\n",
      "RE=1                    #Emitter resistance (KOhm)\n",
      "R11=10                  #Base resistance1 (KOhm)\n",
      "R12=2.2                 #Base resistance2 (KOhm)\n",
      "RL=10                   #Load resistance2 (KOhm)\n",
      "B=150                   #current gain\n",
      "RG=0.6                  #source resistance(KOhm)\n",
      "fT=300*10**6            #current gain bandwidth product(Hz)\n",
      "CC1=2.1*10**-12         #Cc' capacitance(F)\n",
      "Cs=10*10**-12           #stray capacitance(F)\n",
      "\n",
      "\n",
      "Rinb=B*re/1000                                #Rin(base) (KOhm)\n",
      "Ce1=((2*math.pi*re*fT)**-1)                    #capacitance Ce'(F)\n",
      "rc=RC*RL/(RC+RL)                              #collector resistance(KOhm) \n",
      "rg=((R11**-1)+(RG**-1)+(R12**-1))**-1         #source resistance (Ohm)\n",
      "Av=math.ceil(1000*rc/re)                      #voltage gain\n",
      "Cin_M=CC1*(Av+1)                              #input Miller capacitance(F)\n",
      "C1=Ce1+Cin_M                                  #base bypass capacitance(F)\n",
      "R1=int(1000*rg*Rinb/(rg+Rinb))                #resistance facing this capacitance(Ohm) \n",
      "f2=((2*math.pi*R1*C1)**-1)                     #base bypass circuit cutoff frequency (Hz)\n",
      "Cout_M=CC1*((Av+1)/Av)                        #output Miller capacitance(F)\n",
      "C2=Cout_M+Cs                                  #output bypass capacitance(F)\n",
      "R2=1000*RC*RL/(RC+RL)                         #resistance facing this capacitance(Ohm)\n",
      "f21=((2*math.pi*R2*C2)**-1)                    #collector bypass circuit cutoff frequency (Hz)\n",
      "\n",
      "print 'base bypass circuit cutoff frequency f2 = ',round((f2/10**6),2),'MHz'\n",
      "print 'collector bypass circuit cutoff frequency f21 = ',round((f21/10**6),2),'MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "base bypass circuit cutoff frequency f2 =  1.48 MHz\n",
        "collector bypass circuit cutoff frequency f21 =  4.96 MHz\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-21, Page 605"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "re=22.7                      #from past dc calculation (example:9-5)(Ohm)\n",
      "RC=3.6                       #Collector resistance (KOhm)\n",
      "R1=2*10**6                   #Base resistance1 (Ohm)\n",
      "R2=1*10**6                   #Base resistance2 (Ohm)\n",
      "RD=150                       #drain resistance(Ohm) \n",
      "RL=1*10**3                   #Load resistance2 (Ohm)\n",
      "RG=0.6*10**3                 #source resistance(Ohm)\n",
      "Cin=0.1*10**-6               #Cin capacitance(F)\n",
      "Cout=10*10**-6               #Cout capacitance(F)\n",
      "\n",
      "\n",
      "Rthi=RG+((R1**-1)+(R2**-1))**-1                  #Thevenin resistance facing input coupling capacitor resistance (Ohm)\n",
      "f1=((2*math.pi*Rthi*Cin)**-1)                     #base bypass circuit cutoff frequency (Hz)\n",
      "Rtho=RD+RL                                       #Thevenin resistance facing output coupling capacitor resistance (Ohm)\n",
      "f2=((2*math.pi*Rtho*Cout)**-1)                    #base bypass circuit cutoff frequency (Hz)\n",
      "\n",
      "print 'base bypass circuit cutoff frequency f1 = ',round(f1,2),'Hz'\n",
      "print 'collector bypass circuit cutoff frequency f2 = ',round(f2,2),'Hz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "base bypass circuit cutoff frequency f1 =  2.39 Hz\n",
        "collector bypass circuit cutoff frequency f2 =  13.84 Hz\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16-22, Page 606"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "Ciss=60                     #Capacitance Ciss (pF)\n",
      "Coss=25                     #Capacitance Coss (pF)\n",
      "Crss=5                      #Capacitance Crss (pF)\n",
      "gm=93*10**-3                #gm (S)\n",
      "R1=2*10**6                  #resiatance 1(Ohm)\n",
      "R2=1*10**6                  #resiatance 2(Ohm)\n",
      "RG=600                      #resiatance(Ohm)\n",
      "RD=150                      #resiatance(Ohm)\n",
      "RL=1*10**3                  #load resiatance(Ohm)\n",
      "\n",
      "Cgd=Crss                            #Internal Capacitance Cgd (pF)\n",
      "Cgs=Ciss-Crss                       #Internal Capacitance Cgs (pF)\n",
      "Cds=Coss-Crss                       #Internal Capacitance Cds (pF)\n",
      "rd=((RD**-1)+(RL**-1))**-1          #rd (Ohm)\n",
      "Av=gm*rd                            #voltage gain\n",
      "Cin_M=Cgd*(Av+1)                    #Cin(M) (pF)\n",
      "C=Cgs+Cin_M                         #gate bypass capacitance (pF)\n",
      "R=((R1**-1)+(R2**-1)+(RG**-1))**-1  #resistance (Ohm)\n",
      "f2=((2*math.pi*R*C*10**-12)**-1)    #gate bypass cutoff frequency (Hz)\n",
      "Cout_M=Cgd*((Av+1)/Av)              #Cout(M) (pF)\n",
      "C1=Cds+Cout_M                       #drain bypass capacitance(pF)\n",
      "f21=((2*math.pi*rd*C1*10**-12)**-1) #drain bypass cutoff frequency (Hz)\n",
      "\n",
      "print 'Gate bypass cutoff frequency = ',round(f2*10**-6,2),'MHz'\n",
      "print 'Drain bypass cutoff frequency = ',round(f21*10**-6,2),'MHz'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gate bypass cutoff frequency =  2.2 MHz\n",
        "Drain bypass cutoff frequency =  48.02 MHz\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}