{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 06 : Ac analysis of BJT circuits"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1, Page No 240"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Vcc=12.0\n",
      "R2=15.0*10**3\n",
      "R1=33.0*10**3\n",
      "rs=600\n",
      "\n",
      "#Calculations\n",
      "print(\"with no signal source\")\n",
      "Vb=(Vcc*R2)/(R1+R2)\n",
      "print(\" base bais voltage when no signal source is present %3.2fV \" %Vb)\n",
      "print(\" signal source directly connected\")\n",
      "Vb=(Vcc*((rs*R2)/(rs+R2))/(R1+((rs*R2)/(rs+R2))))\n",
      "\n",
      "#Results\n",
      "print(\"base bais voltage is %3.2fV \" %Vb)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "with no signal source\n",
        " base bais voltage when no signal source is present 3.75V \n",
        " signal source directly connected\n",
        "base bais voltage is 0.21V \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2, Page No 244"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "\n",
      "Rc=2.2*10**3\n",
      "Re=2.7*10**3\n",
      "R1=18.0*10**3\n",
      "R2=8.2*10**3\n",
      "Vbe=.7\n",
      "\n",
      "#Calculations\n",
      "print(\"drawing dc load line\")\n",
      "Rldc=Rc+Re\n",
      "print(\" for Vce\")\n",
      "Ic=0\n",
      "Vcc=20\n",
      "Vce=Vcc-Ic*(Rc+Re)\n",
      "print(\"plot point A at\")\n",
      "Ic=Vcc/(Rc+Re)\n",
      "print(\"plot point B Ic=4.08mA and Vce=0\")\n",
      "print(\" draw dc laod line through point A nad B\")\n",
      "Vb=(Vcc*R2)/(R1+R2)\n",
      "Ve=Vb-Vbe\n",
      "Ic=Ve/Re\n",
      "Ie=Ic\n",
      "print(\"drawing the ac load line\")\n",
      "Rlac=Rc#when there is no external Rl\n",
      "Vce=Ic*Rc\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\"The voltage is %.2f v \" %Vce)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "drawing dc load line\n",
        " for Vce\n",
        "plot point A at\n",
        "plot point B Ic=4.08mA and Vce=0\n",
        " draw dc laod line through point A nad B\n",
        "drawing the ac load line\n",
        "The voltage is 4.53 v \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3 Page No 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Vce=4.5\n",
      "Ib=40.0*10**-6\n",
      "\n",
      "#Calculations\n",
      "print(\"from current characteristic at Vce=4.5V and Ib=40uA\")\n",
      "Ic=4.0*10**-3\n",
      "Ib=30.0*10**-6\n",
      "hFE=Ic/Ib\n",
      "print(\" the value of hFE is %d \" %hFE)\n",
      "print(\"from output characteristic at Vce=4.5 and Ib=40uA\")\n",
      "Ic=0.2\n",
      "Vce=6\n",
      "hoe=(Ic/Vce)\n",
      "R=1/hoe\n",
      "\n",
      "#Results\n",
      "print(\"the value of hoe is %3.1fuS \" %(hoe*10**3))\n",
      "print(\"the value of 1/hoe is %3.1fuS \" %(1/hoe))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "from current characteristic at Vce=4.5V and Ib=40uA\n",
        " the value of hFE is 133 \n",
        "from output characteristic at Vce=4.5 and Ib=40uA\n",
        "the value of hoe is 33.3uS \n",
        "the value of 1/hoe is 30.0uS \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4, Page No 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "hfe=133.0\n",
      "hoe=33.3*10**-6\n",
      "hfc=1+hfe\n",
      "\n",
      "#Calculations\n",
      "hob=hoe/(1+hfe)\n",
      "A=hfe/(1+hfe)\n",
      "\n",
      "#Results\n",
      "print(\"tye value of a is %3.1fuS \" %(A))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "tye value of a is 1.0uS \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5 Page No 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "\n",
      "Ib=20.0*10**-6\n",
      "Ic=1.0*10**-3\n",
      "Ie=Ic\n",
      "\n",
      "#Calculations\n",
      "re=(26*10**-3)/Ie\n",
      "hfe=Ic/Ib\n",
      "hie=(1+hfe)*re\n",
      "r=hie\n",
      "B=hfe\n",
      "\n",
      "#Results\n",
      "print(\"the value of b is %3.1f \" %(B))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the value of b is 50.0 \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6 Page No 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "hie=2.1*10**3\n",
      "hfe=75.0\n",
      "hoe=1*10**-6\n",
      "R1=68.0*10**3\n",
      "R2=56.0*10**3\n",
      "Rc=3.9*10**3\n",
      "Rl=82*10**3\n",
      "\n",
      "#Calculations\n",
      "print(\" input impedance Zi=R1||R2||hie\")\n",
      "Zi=((R1*R2*hie)/(R1+R2+hie))*10**-3\n",
      "print(\" input impedance is %3.2fKohm \" %Zi)\n",
      "print(\"output impedance is Zo=Rc||(1/hoe)\")\n",
      "Zo=((Rc*(1/hoe))/(Rc+(1/hoe)))*10**-3\n",
      "print(\" output impadance is %f3.2fKohm \" %Zo)\n",
      "Av=-(hfe*((Rc*Rl)/(Rc+Rl)))/hie\n",
      "\n",
      "\n",
      "#Results\n",
      "print(\" voltage gain is %d \" %Av)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " input impedance Zi=R1||R2||hie\n",
        " input impedance is 63416.34Kohm \n",
        "output impedance is Zo=Rc||(1/hoe)\n",
        " output impadance is 3.8848493.2fKohm \n",
        " voltage gain is -132 \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7, Page No 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Ic=1.5*10**-3\n",
      "Rc=4.7*10**3\n",
      "Rl=56.0*10**3\n",
      "\n",
      "#Calculations\n",
      "Ie=Ic\n",
      "re=(26*10**-3)/Ie\n",
      "Av=-(((Rc*Rl)/(Rc+Rl))/re)\n",
      "\n",
      "#Results\n",
      "print(\" voltage gain is %d \" %Av)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " voltage gain is -250 \n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.8 Page No 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "hie=2.1*10**3\n",
      "hfe=75.0\n",
      "hoe=1.0*10**-6\n",
      "Re=4.7*10**3\n",
      "R1=68.0*10**3\n",
      "R2=56.0*10**3\n",
      "Rc=3.9*10**3\n",
      "Rl=82.0*10**3\n",
      "\n",
      "#Calculations\n",
      "Zb=hie+Re*(1+hfe)\n",
      "print(\" input impedance is Zi=R1||R2||Zb\")\n",
      "Zi=((R1*R2*Zb)/(R1+R2+Zb))\n",
      "print(\" input circuit resistance is %3.3fKohm \" %Zi)\n",
      "Zo=Rc\n",
      "Av=-hfe*((Rc*Rl)/(Rc+Rl))/(hie+Re*(1+hfe))\n",
      "\n",
      "#Results\n",
      "print(\"voltage gain is %3.3f \" %Av)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " input impedance is Zi=R1||R2||Zb\n",
        " input circuit resistance is 2830983654.045Kohm \n",
        "voltage gain is -0.777 \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.9 Page No 267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "hie=2.1*10**3\n",
      "hfe=75.0\n",
      "R1=10.0*10**3\n",
      "R2=10.0*10**3\n",
      "Re=4.7*10**3\n",
      "Rl=12.0*10**3\n",
      "rs=1.0*10**3\n",
      "\n",
      "#Calculations\n",
      "print(\" Rl is not connected\")\n",
      "hic=hie\n",
      "hfc=1+hfe\n",
      "Zb=hic+hfc*(Re)\n",
      "Zi=(R1*R2*Zb)/(R1+R2+Zb)\n",
      "Ze=(hic+(R1*R2*rs)/(R1+R2+rs))/hfc\n",
      "Z0=(Ze*Re)/(Ze+Re)\n",
      "print(\" when Rl is connected\")\n",
      "Zb=hic+hfc*((Re*Rl)/(Re+Rl))\n",
      "Zi=(R1*R2*Zb)/(R1+R2+Zb)\n",
      "hib=hie/(1+hfe)\n",
      "Av=((Re*Rl)/(Re+Rl))/(hib+((Re*Rl)/(Re+Rl)))\n",
      "\n",
      "#Results\n",
      "print(\"voltage gain is %3.3f \" %Av)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Rl is not connected\n",
        " when Rl is connected\n",
        "voltage gain is 0.992 \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.10 Page No 273"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "hie=2.1*10**3\n",
      "hfe=75.0\n",
      "Re=4.7*10**3\n",
      "Rc=3.9*10**3\n",
      "Rl=82.0*10**3\n",
      "\n",
      "#Calculations\n",
      "hib=hie/(1+hfe)\n",
      "hfb=hfe/(1+hfe)\n",
      "Zi=(hib*Re)/(Re+hib)\n",
      "print(\"input impedance is %3.2fohm \" %Zi)\n",
      "Zo=Rc\n",
      "print(\" output impedance is %3.2fohm \" %Zo)\n",
      "Av=(hfb*((Rc*Rl)/(Rc+Rl)))/hib\n",
      "\n",
      "#Results\n",
      "print(\" voltage gain is %3.2f \" %Av)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input impedance is 27.47ohm \n",
        " output impedance is 3900.00ohm \n",
        " voltage gain is 132.96 \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.11, Page No 273"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "hib=27.6\n",
      "hfb=.987\n",
      "R1=68.0*10**3\n",
      "R2=56.0*10**3\n",
      "Re=4.7*10**3\n",
      "Rc=3.9*10**3\n",
      "Rl=82.0*10**3\n",
      "\n",
      "#Calculations\n",
      "Rb=(R1*R2)/(R1+R2)\n",
      "Ze=hib+Rb*(1-hfb)\n",
      "Zi=(Ze*Re)/(Ze+Re)\n",
      "Av=(hfb*((Rc*Rl)/(Rc+Rl)))/(hib+Rb*(1-hfb))\n",
      "\n",
      "#Results\n",
      "print(\"voltage gain is %3.3f \" %Av)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain is 8.609 \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.12, Page No 277"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Rc=5.6*10**3\n",
      "Rl=33.0*10**3\n",
      "rs=600.0\n",
      "hfe=100\n",
      "hie=1.5*10**3\n",
      "vs=50.0*10**-3\n",
      "\n",
      "#Calculations\n",
      "print(\" CE circuit operation with vs at transistor base and Re bypassed\")\n",
      "Av=(hfe*((Rc*Rl)/(Rc+Rl)))/hie\n",
      "Zb=hie\n",
      "Rb=(R1*R2)/(R1+R2)\n",
      "Zi=(Rb*Zb)/(Rb+Zb)\n",
      "vi=(vs*Zi)/(rs+Zi)\n",
      "vo=Av*vi\n",
      "print(\"Cb circuit operation with vs at emitter and the base resistor bypassed\")\n",
      "Av=(hfe*((Rc*Rl)/(Rc+Rl)))/hie\n",
      "Ze=hie/(1+hfe)\n",
      "Zi=(Ze*Re)/(Ze+Re)\n",
      "vi=(vs*Zi)/(rs+Zi)\n",
      "vo=Av*vi\n",
      "\n",
      "#Results\n",
      "print(\"voltage vo is %3.2f \" %(vo*10**3))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " CE circuit operation with vs at transistor base and Re bypassed\n",
        "Cb circuit operation with vs at emitter and the base resistor bypassed\n",
        "voltage vo is 384.29 \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.13, Page No 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "Io=50.0*10**-9\n",
      "Vbe=.7\n",
      "Vbc=-10\n",
      "Af=.995\n",
      "Ar=.5\n",
      "Vt=26.0*10**-3\n",
      "n=2.0\n",
      "Vd=-10.0\n",
      "\n",
      "#Calculations\n",
      "x=Vd/(n*Vt)\n",
      "Idc=(Io*((2.73**-x)-1))*10**9\n",
      "Idc=Io*(-1)\n",
      "y=Vbe/(n*Vt)\n",
      "Ide=Io*((2.73**y)-1)\n",
      "I1=Af*Ide\n",
      "I2=Ar*Idc\n",
      "Ic=I1-Idc\n",
      "Ie=Ide-I2\n",
      "Ib=Ie-Ic\n",
      "\n",
      "#Results\n",
      "print(\"voltage gain is %3.3f \" %(Ib*10**6))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "voltage gain is 185.909 \n"
       ]
      }
     ],
     "prompt_number": 13
    }
   ],
   "metadata": {}
  }
 ]
}