{
 "metadata": {
  "name": "",
  "signature": "sha256:42445a9cad2a842fdbeaf4fef86ad51dfbe0d5e8d585b4595a7c5777bd6d8bc1"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter04:Bipolar Junction Transistors (BJTs)"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine the collector and base current\n",
      "#given\n",
      "a=0.98;#dc alpha\n",
      "Ie=5.*10.**-3.;#A#emitter current\n",
      "Ico=2.*10.**-6.;#A#collector reverse leakage current\n",
      "Ic=a*Ie+Ico;\n",
      "Ib=Ie-Ic;\n",
      "print '%s %.3f %s' %(\"The collector current is =\",Ic*1000,\"mA\\n\");\n",
      "print '%s %.f %s' %(\"The base current is =\",Ib*10**6,\"uA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The collector current is = 4.902 mA\n",
        "\n",
        "The base current is = 98 uA\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine the base and collector current and exact and approax dc alpha \n",
      "#given\n",
      "Ie=8.4*10.**-3.#A#emitter current\n",
      "Icbo=0.1*10.**-6.##A#reverse leakage current\n",
      "Ib=0.008*Ie##A#base current\n",
      "Ic=Ie-Ib#\n",
      "Icinj=Ic-Icbo#\n",
      "a0=Icinj/Ie#\n",
      "a=Ic/Ie#\n",
      "print '%s %.1f %s' %(\"Base current is =\",Ib*10**6,\"uA\\n\")#\n",
      "print '%s %.4f %s' %(\"Collector current =\",Ic*1000,\"mA\\n\",)#\n",
      "print '%s %.7f %s' %(\"Exact value of alphha =\",a0,\"\\n\")#\n",
      "print '%s %.3f' %(\"Approax value of alpha =\",a)#\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Base current is = 67.2 uA\n",
        "\n",
        "Collector current = 8.3328 mA\n",
        "\n",
        "Exact value of alphha = 0.9919881 \n",
        "\n",
        "Approax value of alpha = 0.992\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Determine the base current\n",
      "#given\n",
      "a=0.96;            #dc alpha\n",
      "Rc=2.*10.**3.;#ohm      #resistor across collector\n",
      "Vc=4.;#V            #Voltage drop across the collector resistor\n",
      "Ic=Vc/Rc;         #Colletor current\n",
      "Ie=Ic/a;          #Emmiter current\n",
      "Ib=Ie-Ic;         #Base current\n",
      "print '%s %.f %s' %(\"The base current is =\",Ib*10**6,\"uA\",)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The base current is = 83 uA\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine dynamic input resistance\n",
      "#given\n",
      "Ie=2.;#mA\n",
      "Vcb=10.;#V\n",
      "\n",
      "#Taking points around Ie & Vcb from graph\n",
      "del_Ie=(2.5-1.5)*10.**-3.;#A\n",
      "\n",
      "#corresponding change in Veb\n",
      "del_Veb=(0.9-0.8);#V\n",
      "rib=del_Veb/del_Ie;\n",
      "print '%s %.f %s' %(\"The dynamic input resistance of transistor is =\",rib,\"ohm\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dynamic input resistance of transistor is = 100 ohm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#find dc current gain in common emitter configuration\n",
      "#given\n",
      "a=0.98;#dc current gain in common base configuration\n",
      "B=a/(1.-a);\n",
      "print '%s %.f' %(\"The dc current gain in common emitter configuration is=\",B);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dc current gain in common emitter configuration is= 49\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate ac alpha and beta\n",
      "#given\n",
      "ic=0.995#mA#Emitter current change\n",
      "ie=1.#mA#collector current change\n",
      "a=ic/ie;\n",
      "B=a/(1.-a);\n",
      "print '%s %.3f %s' %(\"The ac alpha is =\",a,\"\\n\")\n",
      "print '%s %.f' %(\"The common emitter ac current gain is =\",B);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ac alpha is = 0.995 \n",
        "\n",
        "The common emitter ac current gain is = 199\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 129"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate beta and Iceo and exact and approax collector current\n",
      "#given\n",
      "a0=0.992;#dc current gain in common base configuration\n",
      "Icbo=48.*10.**-9.;#A\n",
      "Ib=30.*10.**-6.;#A#base current\n",
      "B=a0/(1.-a0);\n",
      "Iceo=Icbo/(1.-a0);\n",
      "print '%s %.f %s' %(\"Beta=\",B,\"\\n\");\n",
      "print '%s %.f %s' %(\"Iceo=\",Iceo*10**6,\"uA\\n\");\n",
      "Ic=B*Ib+Iceo;\n",
      "Ica=B*Ib;#approax\n",
      "print '%s %.3f %s' %(\"Exact collector current =\",Ic*1000,\"mA\\n\");\n",
      "print '%s %.2f %s' %(\"Approax collector current =\",Ica*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Beta= 124 \n",
        "\n",
        "Iceo= 6 uA\n",
        "\n",
        "Exact collector current = 3.726 mA\n",
        "\n",
        "Approax collector current = 3.72 mA\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 130"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine dynamic input resistance\n",
      "#given\n",
      "Vbe=0.75;#V\n",
      "Vce=2.;#V\n",
      "\n",
      "#Taking points around Vbe=0.75V from graph\n",
      "del_Vbe=(0.98-0.9);#V\n",
      "\n",
      "#corresponding change in ib\n",
      "del_ib=(68.-48.)*10.**-6.;#A\n",
      "\n",
      "rie=del_Vbe/del_ib;\n",
      "print '%s %.f %s' %(\"The dynamic input resistance of transistor is =\",rie/1000,\"k ohm\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dynamic input resistance of transistor is = 4 k ohm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E9 - Pg 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#determine dynamic input resistance and dc and ac current gain\n",
      "#given\n",
      "Ib=30.*10.**-6.;#A\n",
      "Vce=10.;#V\n",
      "Ic=3.6*10.**-3.;#A        #from graph\n",
      "\n",
      "#Taking points around Vce = 10V from graph\n",
      "del_Vce=(12.5-7.5);#V\n",
      "\n",
      "#corresponding change in ic\n",
      "del_ic=(3.7-3.5)*10.**-3.;#A\n",
      "\n",
      "roe=del_Vce/del_ic;\n",
      "print '%s %.f %s' %(\"The dynamic output resistance of transistor is =\",roe/1000,\"k ohm\\n\");\n",
      "\n",
      "#dc current gain\n",
      "Bo=Ic/Ib;\n",
      "print '%s %.f %s' %(\"The dc current gain is =\",Bo,\"\\n\");\n",
      "\n",
      "#ac current gain\n",
      "\n",
      "del_ic=(4.7-2.5)*10.**-3.;    #the collector current change is from 3.5mA to 4.7mA as we can see from graph when we change ib from 40mA to 20mA\n",
      "del_ib=(40.-20.)*10.**-6.;\n",
      "B=del_ic/del_ib;\n",
      "print '%s %.f %s' %(\"The ac current gain is =\",B,\"\\n\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dynamic output resistance of transistor is = 25 k ohm\n",
        "\n",
        "The dc current gain is = 120 \n",
        "\n",
        "The ac current gain is = 110 \n",
        "\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E10 - Pg 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate ac current gain in CE and CC configuration\n",
      "#given\n",
      "a=0.99;\n",
      "B=a/(1.-a);\n",
      "print '%s %.f' %(\"The ac current gain in CE configuration is =\",B);\n",
      "y=1.+B;\n",
      "print '%s %.f' %(\"\\nThe ac current gain in CC configuration is =\",y);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ac current gain in CE configuration is = 99\n",
        "\n",
        "The ac current gain in CC configuration is = 100\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}