{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7: Junction Transistor Characteristics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, Page 136"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "a=0.99;#a=fraction of the emitter current contributed by the carriers injected into the base and reaching the collector\n",
      "Rl=4500;     #Load resistance in ohms\n",
      "rd=50;      #dynamic resistance in ohms\n",
      "\n",
      "#Calculations\n",
      "Av=a*Rl/rd;     #Voltage gain\n",
      "Ap=a*Av;#Power gain\n",
      "\n",
      "#Results\n",
      "print 'Av=%.1f'%Av\n",
      "print 'Ap=%.1f'%Ap\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Av=89.1\n",
        "Ap=88.2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page 136"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "a=0.98;#a=fraction of the emitter current contributed by the carriers injected into the base and reaching the collector\n",
      "Ie=0.003;   #emitter current in A\n",
      "Ico=10*10**-6;   #reverse saturation current in A\n",
      "\n",
      "#Calculations&Results\n",
      "Ic=a*Ie+Ico;      #collector current in A\n",
      "print 'Ic=%.2f mA'%(Ic/10**-3);#Ic is converted in terms of mA\n",
      "Ib=Ie-Ic;       #base current in A\n",
      "print 'Ib=%.f \u00b5A'%(Ib/10**-6);#Ib is converted in terms of \u00b5A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ic=2.95 mA\n",
        "Ib=50 \u00b5A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, Page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "a=0.975;#a=fraction of the emitter current contributed by the carriers injected into the base and reaching the collector\n",
      "Ico=10*10**-6;   #reverse saturation current in A\n",
      "Ib=250*10**-6;   #base current in A\n",
      "\n",
      "#Calculations&Results\n",
      "b=a/(1-a);      #transistor gain\n",
      "print 'gain B=%.f'%b;\n",
      "Ic=b*Ib+(b+1)*Ico;       #collector current in A\n",
      "print 'Ic=%.1f mA'%(Ic/10**-3);#Ic is converted in terms of mA\n",
      "Ie=(Ic-Ico)/a;      #emitter current in A\n",
      "print 'Ie=%.1f mA'%(Ie/10**-3);#Ie is converted in terms of mA"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "gain B=39\n",
        "Ic=10.1 mA\n",
        "Ie=10.4 mA\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, Page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "b=125;#b=forward current transfer ratio or dc current gain\n",
      "Vbe=0.6;    #base to emitter voltage in V\n",
      "\n",
      "#Calculations&Results\n",
      "Ib=(10-Vbe)/(310*10**3);     #base current in A\n",
      "print 'Ib=%.4f ma'%(Ib*10**3);\n",
      "Ic=b*Ib;        #collector current in A\n",
      "print 'Ic=%.2f mA'%(Ic*10**3)\n",
      "Vce=20-(Ic*5000);       #collector to emitter voltage\n",
      "print 'Vce=%.2f V'%Vce"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ib=0.0303 ma\n",
        "Ic=3.79 mA\n",
        "Vce=1.05 V\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, Page 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "print \"As the base is forward biased,transistor is not cut off.\"\n",
      "print \"Assuming the transistor in active region \"\n",
      "VBB=5#VBB=base bias voltage\n",
      "VBE=0.7#VBE=voltage between base and emitter terminal\n",
      "RB=220#RB=base circuit resistor in kilo ohms\n",
      "\n",
      "#Calculations&Results\n",
      "IB=(VBB-VBE)/RB#IB=base current in mA(By applying Kirchhoff's voltage law)\n",
      "print \"IB=%.4f mA\"%IB\n",
      "print \"Ico<<IB\"#Ico=reverse saturation current and is given as 22nA\n",
      "B=100#B=dc current gain\n",
      "IC=B*IB\n",
      "print \"IC=%.2f mA\"%IC\n",
      "Vcc=12#Vcc=collector supply voltage\n",
      "Rc=3.3#Rc=collector circuit resistor in kilo ohms\n",
      "VCB=Vcc-(IC*Rc)-VBE#VCB=voltage between collector and base terminal (by applying Kirchhoff's voltage law to the collector circuit)\n",
      "print \"\\nVCB=%.2f V\"%VCB\n",
      "print \"A positive value of VCB implies that for n-p-n transistor,the collector junction is reverse\",\\\n",
      "\"\\nbiased and hence the transistor is actually in active region\"\n",
      "IE=-(IB+IC)#IE=emitter current\n",
      "print \"\\nIE=%.2f mA\"%IE\n",
      "print \"The negative sign indicates that IE actually flows in the opposite direction.\"\n",
      "print \"IB and IC do not depend on the collector circuit resistance Rc.So if it is increased, at\",\\\n",
      "\"\\none stage VCB becomes negative and transistor goes into saturation region \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "As the base is forward biased,transistor is not cut off.\n",
        "Assuming the transistor in active region \n",
        "IB=0.0195 mA\n",
        "Ico<<IB\n",
        "IC=1.95 mA\n",
        "\n",
        "VCB=4.85 V\n",
        "A positive value of VCB implies that for n-p-n transistor,the collector junction is reverse \n",
        "biased and hence the transistor is actually in active region\n",
        "\n",
        "IE=-1.97 mA\n",
        "The negative sign indicates that IE actually flows in the opposite direction.\n",
        "IB and IC do not depend on the collector circuit resistance Rc.So if it is increased, at \n",
        "one stage VCB becomes negative and transistor goes into saturation region \n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, Page 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import numpy as np\n",
      "from numpy.linalg import inv\n",
      "\n",
      "#Variable declaration\n",
      "print \"Applying Kirchhoff voltage law to the base & collector circuit respectively\"\n",
      "#(R1*IB)+VBE+(RE*(Ic+IB))=VBB..........(1)\n",
      "#(R2*Ic)+VCE+(RE*(Ic+IB))=Vcc..........(2)\n",
      "R1=47#R1=value of base circuit resistance in kilo ohms\n",
      "RE=2.2#RE=emitter circuit resistance in kilo ohms\n",
      "R2=3.3#R2=collector circuit resistance in kilo ohms\n",
      "VBE=0.85#VBE=voltage between base and emitter terminals\n",
      "VBB=5#VBB=base supply voltage\n",
      "Vcc=9#Vcc=collector supply voltage\n",
      "VCE=0.22#VCE=voltage between collector and emitter terminals\n",
      "\n",
      "#Calculations&Results\n",
      "R=np.matrix([[R1+RE, RE],[RE, R2+RE]]);\n",
      "V=np.matrix([[VBB-VBE],[Vcc-VCE]]);\n",
      "I=inv(R)*V\n",
      "print \"IB=%.4f mA\"%I[0]\n",
      "print \"IC=%.3f mA\"%I[1]\n",
      "hFE=110#hFE=dc current gain\n",
      "IBmin=I[1]/hFE\n",
      "print \"The minimum base current required for saturation is %.4f mA\"%IBmin\n",
      "if (I[0]<IBmin):\n",
      "    print \"\\nAs IB<IBmin transitor is not in the saturation region.It must be in the active region.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Applying Kirchhoff voltage law to the base & collector circuit respectively\n",
        "IB=0.0132 mA\n",
        "IC=1.591 mA\n",
        "The minimum base current required for saturation is 0.0145 mA\n",
        "\n",
        "As IB<IBmin transitor is not in the saturation region.It must be in the active region.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, Page 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "IB=(30*10**-3)#IB=base current (in mA) of transistor in CE mode\n",
      "IC1=3.5\n",
      "IC2=3.7\n",
      "VCE1=7.5\n",
      "\n",
      "#Calculations&Results\n",
      "VCE2=12.5#IC1 and IC2 are the change found in collector current IC in mA when collector emitter voltage VCE changes from VCE1 to VCE2(in volts)\n",
      "VCE=VCE2-VCE1\n",
      "IC=IC2-IC1\n",
      "Ro=VCE/IC\n",
      "print \"The output resistance is = %.f K ohm\"%Ro\n",
      "b=IC2/IB#b=forward current transfer ratio or dc current gain\n",
      "print \"b=%.1f\"%b\n",
      "a=b/(b+1)#a=fraction of the emitter current contributed by the carriers injected into the base and reaching the collector\n",
      "#b=a/(1-a) Hence a=b/(b+1)\n",
      "print \"a=%.3f\"%a"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output resistance is = 25 K ohm\n",
        "b=123.3\n",
        "a=0.992\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, Page 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "b=100#b=forward current transfer ratio or dc current gain\n",
      "Vz=4#Vz=Zener diode voltage\n",
      "IL=2#IL=load current in mA\n",
      "Iz=5#Iz=Zener current in mA\n",
      "VCC=12#VCC=collector supply voltage\n",
      "VEB1=0.7\n",
      "\n",
      "#Calculations&Results\n",
      "VEB2=VEB1#VEB1,VEB2=emitter-to-base voltage for both transistors Q1 and Q2 respectively\n",
      "#Since IL is the collector current of transistor Q1\n",
      "IB=IL/b#IB=base current of transistor Q1\n",
      "IE=IB+IL#IE=emitter current of transistor Q1\n",
      "VR1=VCC-VEB2-Vz#VR1=voltage drop across resistor R1\n",
      "R1=VR1/(IB+Iz)\n",
      "print \"The resistance R1 is = %.2f Kohm\"%R1\n",
      "VR2=VEB2+Vz-VEB1#VR2=voltage drop across resistor R2\n",
      "R2=VR2/IE\n",
      "print \"The resistance R2 is = %.f K ohm\"%R2\n",
      "#VBC=VCC-VR2-VEB1-(IL*RL) where VBC=base-collector voltage drop for transistor Q1\n",
      "#VBC=7.3-(2*RL) where RL=load resistance for transistor Q1 in terms of kilo ohm\n",
      "print \"\\nFor Q1 to remain in the active region,VBC\u22650,i.e.\"\n",
      "print \"RL\u2264(7.3/2) kilo ohm\"\n",
      "print \"RL\u22643.65 kilo ohm\"\n",
      "print \"So the range of RL for Q1 to remain in the active region is 0\u2264RL\u22643.65 kilo ohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance R1 is = 1.46 Kohm\n",
        "The resistance R2 is = 2 K ohm\n",
        "\n",
        "For Q1 to remain in the active region,VBC\u22650,i.e.\n",
        "RL\u2264(7.3/2) kilo ohm\n",
        "RL\u22643.65 kilo ohm\n",
        "So the range of RL for Q1 to remain in the active region is 0\u2264RL\u22643.65 kilo ohm\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}