{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      " Chapter 4 :Transistor Characteristics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1 page no-203"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# minimum base current to work transistor in saturation region\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "vcc=12.0     # V\n",
      "rl=4.0       # Ohm\n",
      "alfa=0.98\n",
      "\n",
      "#Calculations\n",
      "ic=vcc/rl\n",
      "B=alfa/(1-alfa)\n",
      "ibmin=ic/B\n",
      "\n",
      "#Result\n",
      "print(\"Ic(saturation)= %d mA\\nBeta = %.0f \\nIb(min) = %.1f micro A\"%(ic,B,ibmin*1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ic(saturation)= 3 mA\n",
        "Beta = 49 \n",
        "Ib(min) = 61.2 micro A\n"
       ]
      }
     ],
     "prompt_number": 70
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 page no-206"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# maximum allowable value of RB for transistor in cut off\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "t1=75.0\n",
      "t2=25.0\n",
      "icbo=2.0         # at T1=25\n",
      "vbe=0.1\n",
      "vbb=5\n",
      "\n",
      "#Calculations\n",
      "icbo2=icbo*2**((t1-t2)/10)\n",
      "Rb=(vbb-vbe)/icbo2\n",
      "\n",
      "#Result\n",
      "print(\"Icbo at 75\u00b0C = %.0f micro A\\nRb = %.1f K-Ohm\"%(icbo2,Rb*1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Icbo at 75\u00b0C = 64 micro A\n",
        "Rb = 76.6 K-Ohm\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 page no-207 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# temperature increase before transistor comes of cut off\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "vbb=-1.0      # V\n",
      "Rb=50.0       # K-Ohm\n",
      "vbe=-0.1\n",
      "\n",
      "#Calculations\n",
      "Icbo=(vbe-vbb)/Rb\n",
      "t=math.log(Icbo*1000/2)*10/(math.log(2))\n",
      "\n",
      "#Result\n",
      "print(\"Icbo = %.0f micro A\"%(Icbo*1000))\n",
      "print(\"Delta_T = %d\u00b0C \\nHence, T = %d\u00b0C\"%(math.ceil(t),math.ceil(t)+25))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Icbo = 18 micro A\n",
        "Delta_T = 32\u00b0C \n",
        "Hence, T = 57\u00b0C\n"
       ]
      }
     ],
     "prompt_number": 72
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 page no-207"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculation of ib ic and vbc for transistor AF 114\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "vce = - 0.07   # V \n",
      "vbe = - 0.21   # V\n",
      "vcc=-9.0\n",
      "rc=1.0         # K-Ohm\n",
      "rb=30.0        # K-Ohm\n",
      "\n",
      "#Calculations\n",
      "ic=(vcc-vce)/rc\n",
      "ib=(vcc-vbe)/rb\n",
      "vbc=vbe-vce\n",
      "\n",
      "#Result\n",
      "print(\"Ic = %.2f mA\\nIB = %.3f mA\\nVbc = %.2f V\"%(ic,ib,vbc))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ic = -8.93 mA\n",
        "IB = -0.293 mA\n",
        "Vbc = -0.14 V\n"
       ]
      }
     ],
     "prompt_number": 73
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example 4.8 page no-208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculation of resistance in CE configuration\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "alfa=0.98\n",
      "Ie=-2.0      # in mA IE is negative because it is NPN transistor\n",
      "Ic=-alfa*Ie\n",
      "Ib=(1-alfa)*(-Ie)\n",
      "vbe=0.6      # V\n",
      "vcc=12.0     # V\n",
      "re=100.0     # ohm\n",
      "r2= 20000.0  # ohm\n",
      "r1=3.3       # k-Ohm\n",
      "\n",
      "#Calculations\n",
      "vbn=vbe-(Ie*re*10**-3)\n",
      "Ir2=vbn*10**3/r2\n",
      "Ir1=Ir2+Ib\n",
      "vr1=vcc-((Ir1+Ic)*r1)-vbn\n",
      "R1=vr1/Ir1\n",
      "\n",
      "#Result\n",
      "print(\"Ic = %.2f mA\\nIb = %.0f micro A\\nV_BN =%.1f V\"%(Ic,Ib*1000,vbn))\n",
      "print(\"IR1 = %.0f micro A\\nIR2 = %.0f micro A\\nIrc = %.2f mA\"%(Ir1*1000,Ir2*1000,Ir1+Ic))\n",
      "print(\"R1 = %d K-Ohm\"%(math.ceil(R1)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ic = 1.96 mA\n",
        "Ib = 40 micro A\n",
        "V_BN =0.8 V\n",
        "IR1 = 80 micro A\n",
        "IR2 = 40 micro A\n",
        "Irc = 2.04 mA\n",
        "R1 = 56 K-Ohm\n"
       ]
      }
     ],
     "prompt_number": 74
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 page no-208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Barrier Potential\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "eps=12/(36*math.pi*10**11)   # F/cm\n",
      "mup=500.0                    # cm^2/V-Sec\n",
      "\n",
      "#Calculations\n",
      "Vb=(2.54/1000)**2/(2*eps*mup)\n",
      "\n",
      "#Result\n",
      "print(\"VB = %.1f*10^3*W^2/rho_B\"%(Vb/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "VB = 6.1*10^3*W^2/rho_B\n"
       ]
      }
     ],
     "prompt_number": 75
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 page no-210"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Av Ai and Ap of transistor in CB configuration\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "alfa=0.96\n",
      "Rl=5000.0\n",
      "x=80.0\n",
      "\n",
      "#Calculations\n",
      "Av=alfa*Rl/x\n",
      "pg=Av*alfa\n",
      "\n",
      "#Result\n",
      "print(\"Power Gain = %.1f\"%pg)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power Gain = 57.6\n"
       ]
      }
     ],
     "prompt_number": 76
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11 page no-211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Av Ai and Ap of Transistor in CE configuration\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "alfa = 0.96\n",
      "B=alfa/(1-alfa)\n",
      "x=80.0\n",
      "Rl=75000.0   # ohm\n",
      "\n",
      "#Calculations\n",
      "Av=B*Rl/x\n",
      "Ap=Av*B\n",
      "\n",
      "#Result\n",
      "print(\"power gain = %.0f\"%Ap)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "power gain = 540000\n"
       ]
      }
     ],
     "prompt_number": 77
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 page no-211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Junction voltages for open collector transistor\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "ico=2.0          # micro A\n",
      "ieo=1.6          # micro A\n",
      "alfa = 0.98\n",
      "ie=2.0           # micro A\n",
      "T=301.6\n",
      "\n",
      "#Calculations\n",
      "vt=T/11600.0\n",
      "ve=vt*math.log(1+(ie/ieo))\n",
      "vc=vt*math.log(1+(alfa*ie/ico))\n",
      "\n",
      "#Result\n",
      "print(\"Ve = %.4f V\"%ve)\n",
      "print(\"Vc = %.4f V\\nV_CE = %.4f V\"%(vc,vc-ve))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ve = 0.0211 V\n",
        "Vc = 0.0178 V\n",
        "V_CE = -0.0033 V\n"
       ]
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13 page no-212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# variation in Vi corresponding to variation in Vo\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "rs=200.0       # Ohm\n",
      "vz=100.0       # V\n",
      "rz=20.0        # Ohm\n",
      "il=50.0        # mA\n",
      "iz=0.01        # mA\n",
      "ilmax=100.0    # mA\n",
      "\n",
      "#calculations\n",
      "izmin=0.1*ilmax\n",
      "vl=vz+iz*rz\n",
      "v1=vl+((il/1000)+iz)*rs\n",
      "vldash=vl+1\n",
      "izdash=(vldash-100)/rz\n",
      "it=(il/1000)+izdash\n",
      "vt=vldash+(rs*it)\n",
      "\n",
      "#Result\n",
      "print(\"V_L = %.1f V\"%vl)\n",
      "print(\"V1 = %.1fV\"%v1)\n",
      "print(\"Increase in Iz = %.2f mA\"%izdash)\n",
      "print(\"Total Current = %.1f A\\nTotal Voltage = %.1f V\\nchange in V1 =%.0fV\"%(it,vt,vt-v1))\n",
      "print(\"\\nA change of 11 V in V, on the input side produces a change of\")\n",
      "print(\"1V on the output side due to zener diode action\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "V_L = 100.2 V\n",
        "V1 = 112.2V\n",
        "Increase in Iz = 0.06 mA\n",
        "Total Current = 0.1 A\n",
        "Total Voltage = 123.2 V\n",
        "change in V1 =11V\n",
        "\n",
        "A change of 11 V in V, on the input side produces a change of\n",
        "1V on the output side due to zener diode action\n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14 page no-226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Design of bias circuit for zero drain current drift\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "vp=-3.0       # V\n",
      "idss=1.75     # mA\n",
      "rd=5.0        # K-Ohm\n",
      "gmo=1.8       # mA/V\n",
      "\n",
      "#Calculations\n",
      "#(a)\n",
      "id=idss*(1-(vgs/vp))**2\n",
      "#(b)\n",
      "vgs=vp-0.63   # V\n",
      "#(c)\n",
      "rs=-vgs/0.08\n",
      "#(d)\n",
      "gm=gmo*(vgs-vp)/vp\n",
      "Av=gm*rd\n",
      "\n",
      "#Rezult\n",
      "print(\"(a)Id for zero drift current\\nId = %.2f mA\"%id)\n",
      "print(\"\\n(b)\\nVgs = %.2f V\\n\\n(c)\\nRs = %d K-Ohm\\n\\n(d)\\ngm = %.3f mA/V\\nAv = %.2f\"%(vgs,rs,gm,Av))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Id for zero drift current\n",
        "Id = 0.01 mA\n",
        "\n",
        "(b)\n",
        "Vgs = -3.63 V\n",
        "\n",
        "(c)\n",
        "Rs = 45 K-Ohm\n",
        "\n",
        "(d)\n",
        "gm = 0.378 mA/V\n",
        "Av = 1.89\n"
       ]
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      " Example 4.15 page no-228"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# pinch off voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "a=2*10**-4  # cm\n",
      "rho = 10.0  # Ohm-cm\n",
      "\n",
      "#Calculations\n",
      "eps=12.0/(36*math.pi*10**11) \n",
      "mup = 500.0 #cm^2/V-sec\n",
      "ena=1/(rho*mup)\n",
      "vp= (ena*a**2)/(2*eps)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Vp = %.2f V\"%vp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vp = 3.77 V\n"
       ]
      }
     ],
     "prompt_number": 81
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.16 page no-231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "print(\"Same as problem 4.15 in the same chapter\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Same as problem 4.15 in the same chapter\n"
       ]
      }
     ],
     "prompt_number": 82
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.17 page no-231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# pinch off voltage and channel half width\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "a=3*10**-4         # cm\n",
      "nd=10**15          # electrons/cm^3\n",
      "e=1.6*10**-19      # C\n",
      "\n",
      "#Calculations\n",
      "eps=12.0/(36*math.pi*10**11)\n",
      "vp=e*nd*a**2/(2*eps)\n",
      "b=a*(1-(1.0/2)**(1.0/2))\n",
      "\n",
      "#Result\n",
      "print(\"(a)\\nVp = %.1f V\"%vp)\n",
      "print(\"\\n(b)Vgs=Vp/2\\nb = %.2f * 10^-4 cm\"%(b*10**4))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Vp = 6.8 V\n",
        "\n",
        "(b)Vgs=Vp/2\n",
        "b = 0.88 * 10^-4 cm\n"
       ]
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.20 page no-241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# design of self bias circuit\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "vdd=30.0   # v\n",
      "rl=4.7     # k-ohm\n",
      "vd=20.0    # v\n",
      "\n",
      "#Calculations\n",
      "id=(vdd-vd)/rl\n",
      "del_id=1/rl\n",
      "delv=vdd-vd\n",
      "deli=2.5 \n",
      "rs=delv/(deli)\n",
      "\n",
      "#Result\n",
      "print(\"Id = %.1f mA\"%id)\n",
      "print(\"\\nfor Vd to be constant, it should be within \u00b11V.\")\n",
      "print(\"Delta_Id = \u00b1 %.1f mA\\nId(min) = %.3f mA\\nId(max) = %.3f mA\"%(del_id,id-del_id,id+del_id))\n",
      "print(\"Rs = %d K-Ohm\"%rs)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Id = 2.1 mA\n",
        "\n",
        "for Vd to be constant, it should be within \u00b11V.\n",
        "Delta_Id = \u00b1 0.2 mA\n",
        "Id(min) = 1.915 mA\n",
        "Id(max) = 2.340 mA\n",
        "Rs = 4 K-Ohm\n"
       ]
      }
     ],
     "prompt_number": 84
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.21 page no-243"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Voltage gain and output impedance of common source amplifier\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "rd=100*10**3    # Ohm\n",
      "gm=3000*10**-6\n",
      "rl=10000.0      # Ohm\n",
      "f=10**6         # Hz\n",
      "c=3*10**-12     # F\n",
      "r0= 9.09        # K-Ohm\n",
      "#Calculations\n",
      "Av=(-gm*rd*rl)/(rd+rl)\n",
      "xc=1/(2*math.pi*f*c)\n",
      "z0 = (r0*xc)/math.sqrt(r0**2 + (xc/1000)**2)\n",
      "\n",
      "#Result\n",
      "print(\"(a)\\nAv = %.1f\"%Av)\n",
      "print(\"\\n(b)\\nXc = %d K-Ohm\"%(xc/1000))\n",
      "print(\"Z0 = %.2f K-Ohm\"%(z0/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)\n",
        "Av = -27.3\n",
        "\n",
        "(b)\n",
        "Xc = 53 K-Ohm\n",
        "Z0 = 8.96 K-Ohm\n"
       ]
      }
     ],
     "prompt_number": 85
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.22 page no-245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# calculation of Vgs Id and Vds\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "idss=5*10**-3        # mA\n",
      "vp = -5.0            # V\n",
      "rs =5000.0           # Ohm\n",
      "rl=2.0               # k-ohm\n",
      "vdd=10.0\n",
      "\n",
      "#Calculations\n",
      "#Vgs^2+11Vgs+25=0 fro equation of Id and Vgs\n",
      "vgs=(-11+math.sqrt(121-100))/2\n",
      "id=idss*(1-(vgs/vp))**2\n",
      "x=id*rl*1000\n",
      "y=id*rs\n",
      "vds =vdd-x-y\n",
      "\n",
      "#Result\n",
      "print(\"Vgs = %.2fV\\nId = %.2f mA\\nVds = %.1f V\\nThe FET must be conducting.\"%(vgs,id*1000,vds))\n",
      "print(\"\\nIf VGS = -7.8V, the FET in cut off. Therefore Vp = -5V.\")\n",
      "print(\"Therefore VGS is chosen as -3.2V\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vgs = -3.21V\n",
        "Id = 0.64 mA\n",
        "Vds = 5.5 V\n",
        "The FET must be conducting.\n",
        "\n",
        "If VGS = -7.8V, the FET in cut off. Therefore Vp = -5V.\n",
        "Therefore VGS is chosen as -3.2V\n"
       ]
      }
     ],
     "prompt_number": 86
    }
   ],
   "metadata": {}
  }
 ]
}