{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8:Junction Transistors: Biasing and Amplification"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, Page 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "b=99.;\n",
      "Vbe=0.7;    #Volatge between base and emitter in V\n",
      "Vcc=12;     #Volatge source applied at collector in V4\n",
      "Rl=2*10**3;      #load resistance in ohms\n",
      "Rb=100*10**3;       #Resistance at base in ohms\n",
      "\n",
      "#Calculations&Results\n",
      "Ib=(12-0.7)/((100*Rl)+Rb);        #Base current in micro Ampere\n",
      "print 'Ib=%.1f uA'%(Ib*10**6)\n",
      "\n",
      "Ic=b*Ib;\n",
      "print 'Ic=%.2f mA'%(Ic*10**3)\n",
      "Vce=4.47;       #Voltage between collector and emitter in V\n",
      "\n",
      "S=(b+1)/(1+b*Rl/(Rl+Rb));       #stabilty factor 1\n",
      "print 'S=%.f'%S;\n",
      "S1=b/(Rb+Rl*(1+b));      #stabilty factor 2 in A/V\n",
      "print 'S1=%.1e A/V'%S1\n",
      "S2=(Vcc-Vbe-(Ic*Rl))/(Rb+Rl*(1+b));        #stability factor 3 in A\n",
      "print 'S2=%.2e A'%S2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ib=37.7 uA\n",
        "Ic=3.73 mA\n",
        "S=34\n",
        "S1=3.3e-04 A/V\n",
        "S2=1.28e-05 A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, Page 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "b=49;#b=dc current gain of the common emitter transistor\n",
      "Vbe=0.2;    #Volatge between base and emitter in V\n",
      "Vcc=10.;     #Volatge source applied at collector in V4\n",
      "Vce=5;      #Collector to emitter voltage in V\n",
      "Ic=4.9;     #collector current in mA\n",
      "Rl=1.;      #load resistance in kilo ohms\n",
      "S=10;       #stability factor\n",
      "\n",
      "#Calculations&Results\n",
      "Ib=Ic/b;    #base current in mA\n",
      "Re=((Vcc-Vce-(Ic*Rl))/(Ic+Ib))*1000;       #Resistance at emitter in ohms\n",
      "print 'Re=%.f ohms'%Re;\n",
      "#S=((1+b)*(1+(RT/Re)))/(1+b+(RT/Re)) \n",
      "RT=((S-1)*Re)/(1-(S/(1+b)))#RT=Thevenin resistance =(R1*R2)/(R1+R2)\n",
      "VT=(Ib*(10**-3)*RT)+Vbe+((Ib+Ic)*(10**-3)*Re)#VT=Thevenin voltage=(R2*Vcc)/(R1+R2)\n",
      "# R2/(R1+R2)=VT/Vcc\n",
      "R1=(RT*Vcc)/VT\n",
      "print \"R1=%.3f k ohm\"%(R1/10**3)\n",
      "R2=((VT/Vcc)*R1)/(1-(VT/Vcc))\n",
      "print \"R2=%.1f ohm\"%R2#incorrect answer in textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Re=20 ohms\n",
        "R1=5.660 k ohm\n",
        "R2=185.9 ohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, Page 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "hib=30;     #h parameter of CB a transistor\n",
      "hrb=4*10**-4;        #h parameter of CB a transistor\n",
      "hfb=-0.99;        #h parameter of CB a transistor\n",
      "hob=0.9*10**-6;        #h parameter of CB a transistor in S\n",
      "Rl=6*10**3;       #Load resistance in ohms\n",
      "\n",
      "#Calculations&Results\n",
      "AI=-hfb/(1+(hob*Rl));        #Current gain\n",
      "print 'AI=%.3f'%AI;\n",
      "\n",
      "Ri=hib-((hfb*hrb*Rl)/(1+(hob*Rl)));    #Input resistance in ohms\n",
      "print 'Ri=%.1f ohms'%Ri;\n",
      "\n",
      "Ro=hib/((hib*hob)-(hfb*hrb));       #Output Resistance in kohms\n",
      "print 'Ro=%.2f k ohms'%(Ro*10**-3);\n",
      "\n",
      "AV=AI*Rl/Ri;        #Voltage gain\n",
      "print 'AV=%.1f'%AV;\n",
      "\n",
      "AP=AI*AV;       #Power gain\n",
      "print 'AP=%.1f'%AP"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "AI=0.985\n",
        "Ri=32.4 ohms\n",
        "Ro=70.92 k ohms\n",
        "AV=182.6\n",
        "AP=179.8\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, Page 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Rg=1.*10**3;      #internal resistance in ohms\n",
      "Rl=20*10**3;     #Load resistance in ohms\n",
      "hie=1*10**3;     #h parameter of the transistor in terms of ohms\n",
      "hre=2.5*10**-4;     #h parameter of the transistor\n",
      "hfe=150.;     #h parameter of the transistor\n",
      "\n",
      "#Calculations&Results\n",
      "hoe=1./(40*10**3);      #h parameter of the transistor in terms of mho\n",
      "AI=(-hfe)/(1+(hoe*Rl));      #Current gain\n",
      "print 'AI=%.f'%AI;\n",
      "Ri=hie+(AI*hre*Rl);     #input resistance in ohms\n",
      "print 'Ri=%.f ohms'%Ri;\n",
      "Ro=(Rg+hie)/((Rg*hoe)+(hie*hoe)-(hfe*hre));     #output resistance in ohms\n",
      "print 'Ro=%.f k ohms'%(Ro*10**-3);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "AI=-100\n",
        "Ri=500 ohms\n",
        "Ro=160 k ohms\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, Page 173"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Rl=5.*10**3;     #Load resistance in ohms\n",
      "hie=1*10**3;     #h parameter of the transistor in terms of ohms\n",
      "hre=5*10**-4;     #h parameter of the transistor\n",
      "hfe=100;     #h parameter of the transistor\n",
      "hoe=25*10**-6;      #h parameter of the transistor in terms of mho\n",
      "Rg=1*10**3;      #source reistance in ohms\n",
      "\n",
      "#Calculations&Results\n",
      "AI=(-hfe)/(1+(hoe*Rl));      #Current gain\n",
      "print 'AI=%.2f'%AI;\n",
      "\n",
      "Ri=hie+(AI*hre*Rl);     #input resistance in ohms\n",
      "print 'Ri=%.1f ohms'%Ri;\n",
      "\n",
      "AVo=AI*Rl/(Rg+Ri);      #Overall voltage gain including source resistance \n",
      "print 'AVo=%.f'%AVo;\n",
      "\n",
      "APo=AVo*AI;     #Overall voltage gain including source resistance \n",
      "print 'APo=%.2e'%APo;"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "AI=-88.89\n",
        "Ri=777.8 ohms\n",
        "AVo=-250\n",
        "APo=2.22e+04\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, Page 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "hoe=25*10**-6;       #h parameter in A/V\n",
      "hie=4000;       #h paramater in ohms\n",
      "hfe=135;        #h paramater of transistor\n",
      "hre=7*10**-4;        #h paramater of transistor\n",
      "Re=100;     #emitter resistance in ohms\n",
      "Rl=3*10**3;      #Load resistance in ohms\n",
      "\n",
      "#Calculations&Results\n",
      "#Here hoe*Rl is less than 0.1. So we can simplify the circuit and according to it the current gain is AI=Ic/Ib. here Ic=-hfe*Ib.\n",
      "\n",
      "AI=-hfe;        #current gain\n",
      "print 'AI=%.f'%AI;\n",
      "\n",
      "Ri=hie+(1+hfe)*Re;      #input resistance in ohms\n",
      "print 'Ri=%.1f k ohms'%(Ri*10**-3);\n",
      "\n",
      "AV=AI*Rl/Ri;        #voltage gain\n",
      "print 'AV=%.f'%AV;\n",
      "\n",
      "print \"The output resistance of the transistor excluding RL is infinite.\"\n",
      "print \"The output resistance of the transistor including RL is = %.f k ohms\"%(Rl/10**3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "AI=-135\n",
        "Ri=17.6 k ohms\n",
        "AV=-24\n",
        "The output resistance of the transistor excluding RL is infinite.\n",
        "The output resistance of the transistor including RL is = 3 k ohms\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, Page 175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "hfe=100;        #h parameter of transistor\n",
      "hie=560;        #h parameter of transistor in ohms\n",
      "Rc=2*10**3;      #collector resistance in ohms\n",
      "Re=10**3;        #emitter resistance in ohms\n",
      "Rb=600*10**3;        #Base resistance in ohms\n",
      "\n",
      "#Calculations&Results\n",
      "#Since hoe is neglected we can use the simplified equivalent circuit hence the Ri is\n",
      "\n",
      "Ri=hie+(1+hfe)*Re;      #Input resistance in ohms\n",
      "print 'Ri=%.2f K ohms'%(Ri*10**-3);\n",
      "\n",
      "Rib=(Ri*Rb)/(Ri+Rb);        #Input resistance including Rb in ohms\n",
      "print 'Input resistance (including Rb)=%.2f k ohms'%(Rib*10**-3);\n",
      "\n",
      "print \"The output resistance excluding load is infinita\"\n",
      "Ro=Rc;\n",
      "print \"Output resistance including load = %.f k ohms\"%(Ro*10**-3)\n",
      "\n",
      "AV=-(hfe*Ro)/(hie+((1+hfe)*Re));        #voltage gain\n",
      "print 'AV=%.2f'%AV;\n",
      "print \"\\nSmall signals are used,since otherwise the output waveform will be distorted.Also,the equivalent circuit will not hold.\"\n",
      "\n",
      "#Taking DC emitter current and collector current nearly equal\n",
      "\n",
      "Ib=20./(Rb+Re*101);      #base current in mA\n",
      "print 'Ib=%.4f mA'%(Ib*10**3);\n",
      "\n",
      "print \"\\nThe Q-point is defined by\"\n",
      "Ic=hfe*Ib;      #collector current in mA\n",
      "print 'Ic=%.2f mA'%(Ic*10**3);\n",
      "\n",
      "VCE=20-(3*Ic*10**3)\n",
      "print 'VCE=%.2f V'%VCE;"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ri=101.56 K ohms\n",
        "Input resistance (including Rb)=86.86 k ohms\n",
        "The output resistance excluding load is infinita\n",
        "Output resistance including load = 2 k ohms\n",
        "AV=-2.00\n",
        "\n",
        "Small signals are used,since otherwise the output waveform will be distorted.Also,the equivalent circuit will not hold.\n",
        "Ib=0.0285 mA\n",
        "\n",
        "The Q-point is defined by\n",
        "Ic=2.85 mA\n",
        "VCE=11.44 V\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, Page 176"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "#For a CE transistor amplifier circuit with self-bias\n",
      "f=1000#f=frequency in Hz\n",
      "AV=-200#AV=voltage gain\n",
      "hfe=100#hfe=current gain\n",
      "hie=1#hie=input impedance in kilo ohms\n",
      "Pcmax=75*10**-3#Pcmax=maximum collector dissipation in Watt\n",
      "#hre and hoe are to be neglected\n",
      "VCC=12#VCC=collector supply voltage\n",
      "\n",
      "#Calculations&Results\n",
      "#AV=-(hfe*RL)/hie where RL is the load resistance\n",
      "RL=-(AV*hie)/hfe\n",
      "print \"The designed values of the components of a CE transistor amplifier are:\"\n",
      "print \"The load resistance RL is = %.f K ohms\"%RL\n",
      "#For the amplifier to be linear,the quiescent point is chosen to lie in the middle of the DC load line\n",
      "VCG=VCC/2  #VCG=DC collector to ground voltage\n",
      "#VCC=(IC*RL)+VCG where IC=DC collector current\n",
      "IC=(VCC-VCG)/RL\n",
      "print \"Ihe DC collector current is = %.f mA\"%IC\n",
      "Pr=(IC**2)*RL#Pr=power dissipation in RL\n",
      "#Pc=the collector dissipation is set at 14.5 mW which is below the value of Pcmax\n",
      "#Pc=VCE*IC\n",
      "Pc=14.5\n",
      "VCE=Pc/IC#VCE=collector-to-emitter voltage drop\n",
      "VEG=VCG-VCE#VEG=DC voltage drop across resistance Re\n",
      "IE=IC#IE=emitter current\n",
      "Re=VEG/(IC)\n",
      "print \"The resistance Re is = %.f ohm\"%(Re*1000)#Re is converted in terms of ohms\n",
      "Pe=(IC**2)*Re#Pe=power dissipation in Re\n",
      "VBE=0.7#VBE=assumed DC base-to-emitter voltage drop\n",
      "VBG=VBE+(IE*Re)#VBG=DC voltage across resistance R2\n",
      "#VT=(VCC*R2)/(R1+R2) where VT=Thevenin equivalent voltage\n",
      "#RT=(R1*R2)/(R1+R2).............(1) where RT=Thevenin equivalent resistance\n",
      "#VBG=VT-(IB*RT)\n",
      "#VBG=((VCC*R2)/(R1+R2))-(IB*((R1*R2)/(R1+R2)))..................(2)\n",
      "#Let (R2/(R1+R2))=x ..............(3)\n",
      "x=VBG/VCC#neglecting the second term on the right hand side of equation (2)\n",
      "a=(1-x)/x    #a=R1/R2\n",
      "#S=((1+b)*(1+RT/Re))/(1+b+(RT/Re)) where S=stability factor and b=current gain=hfe\n",
      "#b>>1 hence S=(hfe*(1+RT/Re))/(1+b+(RT/Re))\n",
      "#For good stability we choose S=hfe/20\n",
      "RT=((hfe-20.)/19)*Re\n",
      "R1=RT/x#from equation (1) and (3)\n",
      "print \"The resistance R1 is=%.1f k ohm\"%R1\n",
      "R2=R1/5.33\n",
      "print \"The resistance R2 is = %.f k ohm\"%R2\n",
      "Pr2=(VBG**2)/R2#Pr2=power dissipation in R2\n",
      "Pr1=((VCC-VBG)**2)/R1 #Pr1=power dissipation in R1\n",
      "Ce=1./(2*math.pi*f*((Re*1000)/10))#Ce=bypass capacitor\n",
      "print \"The bypass capacitance Ce is %.f uF\"%(Ce/10**-6)#Ce is converted in terms of micro farad\n",
      "C1=2/(2*math.pi*f*100)#C1=coupling capacitor\n",
      "print \"The coupling capacitance C1 is %.1f uF\"%(C1/10**-6)#C1 is converted in terms of micro farad\n",
      "Rin=20*1000#Rin=assumed input impedance in ohms\n",
      "C2=1/(2*math.pi*f*0.1*Rin)#C2=coupling capacitor\n",
      "print \"The coupling capacitance C2 is %.1f uF\"%(C2/10**-6)#C2 is converted in terms of micro farad\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The designed values of the components of a CE transistor amplifier are:\n",
        "The load resistance RL is = 2 K ohms\n",
        "Ihe DC collector current is = 3 mA\n",
        "The resistance Re is = 389 ohm\n",
        "The resistance R1 is=10.5 k ohm\n",
        "The resistance R2 is = 2 k ohm\n",
        "The bypass capacitance Ce is 4 uF\n",
        "The coupling capacitance C1 is 3.2 uF\n",
        "The coupling capacitance C2 is 0.1 uF\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, Page 177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "VCC=12#VCC=collector supply voltage\n",
      "a=0.98#a=dc current gain of the common base transistor\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "IE=2#IE=emitter current in mA\n",
      "\n",
      "#Calculations&Results\n",
      "#Ico is to be neglected\n",
      "b=a/(1-a)#b=dc current gain of the common emitter transistor\n",
      "#IC=b*IB where IC=collector current and IB=base current\n",
      "#IE=IC+IB\n",
      "#IE=(b+1)*IB\n",
      "IB=IE/(b+1)\n",
      "IC=b*IB\n",
      "RE=0.1#RE=resistance in kilo ohms connected to the emitter terminal\n",
      "R2=20#R2=resistance in kilo ohms\n",
      "RC=3.3#RC=resistance in kilo ohms connected to the collector terminal\n",
      "#Let I be the current in the resistance R2\n",
      "#Applying Kirchhoff's voltage law in the base-emitter circuit\n",
      "#VBE+(RE*IE)=R2*I\n",
      "I=(1./R2)*(VBE+(RE*IE))\n",
      "#Applying Kirchhoff's voltage law\n",
      "#((I+IB+IC)*RC)+((I+IB)*R1)+(I*R2)=VCC\n",
      "R1=(VCC-((I+IB+IC)*RC)-(I*R2))/(I+IB)\n",
      "\n",
      "\n",
      "print \"The resistance R1 is = %.1f k ohm\"%R1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance R1 is = 51.2 k ohm\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, Page 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "b=90#b=dc current gain of the common emitter transistor\n",
      "VCC=10#VCC=collector supply voltage\n",
      "RE=1.2#RE=resistance in kilo ohms connected to the emitter terminal\n",
      "RC=4.7#RC=resistance in kilo ohms connected to the collector terminal\n",
      "RB=250.#RB=resistance in kilo ohms connected to the base terminal\n",
      "\n",
      "#Calculations&Results\n",
      "#Applying Kirchhoff's voltage law\n",
      "#VCE=(RB*IB)+VBE where VCE=collector emitter voltage\n",
      "#Also VCC=((IB+IC)*RC)+VCE+(IE*RE)\n",
      "#IC=b*IB where IC=collector current and IB=base current\n",
      "#IE=IC+IB where IE=emitter current\n",
      "#IE=(b+1)*IB\n",
      "IB=(VCC-VBE)/(((b+1)*(RC+RE))+RB)\n",
      "IE=(b+1)*IB\n",
      "VCE=(RB*IB)+VBE\n",
      "IC=b*IB\n",
      "print \"The quiescent value of IE is = %.3f mA\"%IE\n",
      "print \"The quiescent value of VCE is = %.2f V\"%VCE\n",
      "print \"When dc current gain=90,IC= %.3f mA\"%IC\n",
      "#b is increased by 50%\n",
      "b1=((50*b)/100)+b\n",
      "IB1=(VCC-VBE)/(((b1+1)*(RC+RE))+RB)\n",
      "IC1=b1*IB1\n",
      "print \"When dc current gain is increased by 50%%,IC=%.3f mA\"%IC1\n",
      "x=((IC1-IC)/IC)*100#x=increase in the collector current\n",
      "print \"The increase in the collector current IC is = %.1f %%\"%x\n",
      "print \"\\nThe percentage increase of IC being less than that of the dc current gain,the circuit provides some stabilization against the changes in the dc current gain.\"\n",
      "print \"VCE does not depend on dc current gain and hence it is not affected when the dc current gain changes.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quiescent value of IE is = 1.075 mA\n",
        "The quiescent value of VCE is = 3.65 V\n",
        "When dc current gain=90,IC= 1.064 mA\n",
        "When dc current gain is increased by 50%,IC=1.193 mA\n",
        "The increase in the collector current IC is = 12.2 %\n",
        "\n",
        "The percentage increase of IC being less than that of the dc current gain,the circuit provides some stabilization against the changes in the dc current gain.\n",
        "VCE does not depend on dc current gain and hence it is not affected when the dc current gain changes.\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, Page 178"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "b=99#b=dc current gain of the common emitter transistor\n",
      "VCC=15#VCC=collector supply voltage\n",
      "RE=7#RE=resistance in kilo ohms connected to the emitter terminal\n",
      "RC=4#RC=resistance in kilo ohms connected to the collector terminal\n",
      "RB=5#RB=resistance in kilo ohms connected to the base terminal\n",
      "VEE=(-15)#VEE=emitter supply voltage\n",
      "\n",
      "#Calculations&Results\n",
      "#Applying Kirchhoff's voltage law in the base emitter loop\n",
      "#-VEE=(RB*IB)+VBE +(IE*RE)\n",
      "#IC=b*IB where IC=collector current and IB=base current\n",
      "#IE=IC+IB where IE=emitter current\n",
      "#IE=(b+1)*IB\n",
      "IB=(-VEE-VBE)/(RB+((b+1)*RE))\n",
      "print \"The quiescent value of IB is = %.4f mA\"%IB\n",
      "IC=b*IB\n",
      "print \"The quiescent value of IC is = %.2f mA\"%IC\n",
      "IE=(b+1)*IB\n",
      "print \"The quiescent value of IE is = %.2f mA\"%IE\n",
      "#Applying Kirchhoff's voltage law in the output circuit\n",
      "#(IC*RC)+VCE+(IE*RE)=VCC-VEE\n",
      "VCE=(VCC-VEE)-(IE*RE)-(IC*RC)\n",
      "print \"The quiescent value of VCE is = %.2f V\"%VCE\n",
      "#b is increased by 20%\n",
      "b1=((20*b)/100)+b\n",
      "IB1=(-VEE-VBE)/(RB+((b1+1)*RE))\n",
      "IC1=b1*IB1\n",
      "print \"When dc current gain is increased by 20%%,IC=%.2f mA\"%IC1\n",
      "x=((IC1-IC)/IC)*100#x=increase in the collector current\n",
      "print \"The increase in the collector current IC is = %.1f %%\"%x\n",
      "print \"\\nSince a 20% increase in current gain produces a mere 0.284% enhancement of IC,the circuit provides a good\",\\\n",
      "\"stabilization against the changes in the current gain\"\n",
      "#In textbook the increase in the collector current is given as 0.5% which is actually coming as 0.284% approximately"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quiescent value of IB is = 0.0203 mA\n",
        "The quiescent value of IC is = 2.01 mA\n",
        "The quiescent value of IE is = 2.03 mA\n",
        "The quiescent value of VCE is = 7.77 V\n",
        "When dc current gain is increased by 20%,IC=2.01 mA\n",
        "The increase in the collector current IC is = 0.3 %\n",
        "\n",
        "Since a 20% increase in current gain produces a mere 0.284% enhancement of IC,the circuit provides a good stabilization against the changes in the current gain\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12, Page 179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "#For a self-bias circuit\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "b=100#b=dc current gain of the common emitter transistor\n",
      "VCC=22#VCC=collector supply voltage\n",
      "R1=82.#R1=resistance in kilo ohms\n",
      "R2=16#R2=resistance in kilo ohms\n",
      "RL=2.2#RL=load resistance in kilo ohms\n",
      "Re=0.750#Re=resistance in kilo ohms connected to the emitter terminal\n",
      "\n",
      "#Calculations&Results\n",
      "#ICO is to be neglected\n",
      "VT=(R2*VCC)/(R1+R2)#VT=Thevenin equivalent voltage\n",
      "RT=(R1*R2)/(R1+R2)#RT=Thevenin equivalent resistance\n",
      "#Applying Kirchhoff's voltage law to the base circuit\n",
      "#(IB*(RT+Re))+(IC*Re)=VT-VBE\n",
      "#IC=b*IB\n",
      "IB=(VT-VBE)/(RT+Re+(b*Re))#IB=base current\n",
      "IC=b*IB#IC=collector current\n",
      "#Applying Kirchhoff's voltage law to the collector circuit\n",
      "#(IC*(RL+Re))+(IB*Re)+VCE=VCC\n",
      "VCE=VCC-((IC*(RL+Re))+(IB*Re))#VCE=collector emitter voltage\n",
      "print \"The operating point is specified by\"\n",
      "print \"IC=%.2f mA\"%IC\n",
      "print \"VCE=%.1f V\"%VCE"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The operating point is specified by\n",
        "IC=3.24 mA\n",
        "VCE=12.4 V\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13, Page 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "RE=0.680#RE=resistance in kilo ohms connected to the emitter terminal\n",
      "RC=2.7#RC=resistance in kilo ohms connected to the collector terminal\n",
      "#RB=resistance connected to the base terminal\n",
      "VCE=7.3#VCE=collector emitter voltage\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "Vre=2.1#Vre=voltage across RE resistance\n",
      "IB=0.02#IB=base current in mA\n",
      "\n",
      "#Calculations&Results\n",
      "IE=Vre/RE#IE=emitter current in mA\n",
      "IC=IE-IB#IC=collector current in mA\n",
      "b=IC/IB#b=current gain\n",
      "print \"The current gain \u03b2 is = %.1f\"%b\n",
      "VCC=(IC*RC)+VCE+Vre#VCC=collector supply voltage\n",
      "print \"The collector supply voltage VCC is = %.1f V\"%VCC\n",
      "#Voltage across RB (Vrb)resistance is given by\n",
      "Vrb=VCC-(VBE+Vre)\n",
      "RB=Vrb/IB\n",
      "print \"The resistance RB is = %.f k ohm\"%RB\n",
      "#To draw the DC load line,we neglect the base current in RE resistance\n",
      "#Equation for DC load line is:\n",
      "#VCE=VCC-(RC+RE)*IC\n",
      "print \"\\nFor the DC load line\"\n",
      "print \"The intercept of the load line on the VCE-axis(X-axis) is = %.1f V\"%VCC\n",
      "print \"The intercept of the load line on the IC axis(Y-axis) is = %.2f mA\"%(VCC/(RC+RE))\n",
      "print \"The DC load line is the straight line joining above two intercepts.\"\n",
      "print \"The co-ordinates of the operating point Q on the load line are (7.3V,3.07mA)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current gain \u03b2 is = 153.4\n",
        "The collector supply voltage VCC is = 17.7 V\n",
        "The resistance RB is = 744 k ohm\n",
        "\n",
        "For the DC load line\n",
        "The intercept of the load line on the VCE-axis(X-axis) is = 17.7 V\n",
        "The intercept of the load line on the IC axis(Y-axis) is = 5.23 mA\n",
        "The DC load line is the straight line joining above two intercepts.\n",
        "The co-ordinates of the operating point Q on the load line are (7.3V,3.07mA)\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14, Page 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "VBE=0.7#VBE=base emitter voltage\n",
      "b=120#b=dc current gain of the common emitter transistor\n",
      "VCC=15.#VCC=collector supply voltage\n",
      "R1=72.#R1=resistance in kilo ohms\n",
      "R2=8#R2=resistance in kilo ohms\n",
      "RL=2#RL=load resistance in kilo ohms\n",
      "Re=0.700#Re=resistance in kilo ohms connected to the emitter terminal\n",
      "RC=2#RC=resistance in kilo ohms connected to the collector terminal\n",
      "Rin=1.5#Rin=input resistance in kilo ohms of the amplifier\n",
      "vi=1#vi=amplitude of the ac input signal in mV\n",
      "\n",
      "#Calculations&Results\n",
      "VT=(R2*VCC)/(R1+R2)#VT=Thevenin equivalent voltage\n",
      "RT=(R1*R2)/(R1+R2)#RT=Thevenin equivalent resistance\n",
      "#Applying Kirchhoff's voltage law to the base circuit\n",
      "#(IB*(RT+Re))+(IC*Re)=VT-VBE\n",
      "#IC=b*IB\n",
      "IB=(VT-VBE)/(RT+Re+(b*Re))#IB=base current\n",
      "IC=b*IB#IC=collector current\n",
      "#Applying Kirchhoff's voltage law to the collector circuit\n",
      "#(IC*(RL+Re))+(IB*Re)+VCE=VCC\n",
      "VCE=VCC-((IC*(RL+Re)))#VCE=collector emitter voltage(neglecting small term IB*RE)\n",
      "#Equation for DC load line is:\n",
      "#VCE=VCC-(RL+Re)*IC\n",
      "print \"1. For the DC load line\"\n",
      "print \"The operating point Q is specified by %.3f mA\"%IC\n",
      "print \"VCE=%.1f V\"%VCE\n",
      "print \"The intercept of the dc load line on the VCE-axis(X-axis) is = %.f V\"%VCC\n",
      "print \"The intercept of the dc load line on the IC axis(Y-axis) is = %.2f mA\"%(VCC/(RC+Re))\n",
      "print \"The DC load line is the straight line joining above two intercepts.\"\n",
      "Rac=(RL*RC)/(RL+RC)#Rac=ac load resistance\n",
      "print \"\\n2. For the AC load line\"\n",
      "print \"The intercept of the ac load line on the VCE-axis(X-axis) is = %.1f V\"%(VCE+(IC*Rac))\n",
      "print \"The line joining the above intercept and the operating point Q extended to meet the IC axis(Y-axis) gives the AC load line\"\n",
      "AV=-(b*Rac)/Rin#AV=voltage gain of the amplifier\n",
      "vo=abs(AV)*vi#vo=amplitude of the output voltage signal\n",
      "print \"\\n3. The amplitude of the output voltage vo is = %.f mV\"%vo"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "1. For the DC load line\n",
        "The operating point Q is specified by 1.045 mA\n",
        "VCE=12.2 V\n",
        "The intercept of the dc load line on the VCE-axis(X-axis) is = 15 V\n",
        "The intercept of the dc load line on the IC axis(Y-axis) is = 5.56 mA\n",
        "The DC load line is the straight line joining above two intercepts.\n",
        "\n",
        "2. For the AC load line\n",
        "The intercept of the ac load line on the VCE-axis(X-axis) is = 13.2 V\n",
        "The line joining the above intercept and the operating point Q extended to meet the IC axis(Y-axis) gives the AC load line\n",
        "\n",
        "3. The amplitude of the output voltage vo is = 80 mV\n"
       ]
      }
     ],
     "prompt_number": 39
    }
   ],
   "metadata": {}
  }
 ]
}