{
 "metadata": {
  "name": "",
  "signature": "sha256:6ddc78aaecb14f72535c7221afdce9fdaaec875cc64d4211459abad2c8c70077"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter05:Field Effect Transistors (FETs)"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate saturation voltage and saturation current\n",
      "#given\n",
      "Vp=-4.#V          #pinch off voltage\n",
      "Idss=12.*10.**-3.;#A      #drain to source current with gate shorted\n",
      "Vgs=-2.;#V             #gate to source voltage\n",
      "Vds=Vgs-Vp;\n",
      "Id=Idss*(Vds/Vp)**2.;\n",
      "print '%s %.f %s' %(\"Saturation Voltage is =\",Vds,\"V\\n\");\n",
      "print '%s %.f %s' %(\"Saturation current is =\",Id*10**3,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Saturation Voltage is = 2 V\n",
        "\n",
        "Saturation current is = 3 mA\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find the value of drain current\n",
      "#given\n",
      "Vgso=-5.;#V          #gate to source cut off voltage\n",
      "Idss=20.*10.**-3.;#A     #drain to source current with gate shorted\n",
      "\n",
      "#At vgs = -2 V\n",
      "vgs=-2.;#V input voltage\n",
      "Id=Idss*(1.-(vgs/Vgso))**2.;          #Schockleys equation\n",
      "print '%s %.1f %s' %(\"Drain current is (At vgs = -2 V) =\",Id*10**3,\"mA\\n\");\n",
      "\n",
      "#At vgs = -4 V\n",
      "vgs=-4.;#V        input voltage\n",
      "Id=Idss*(1.-(vgs/Vgso))**2.;          #Schockleys equation\n",
      "print '%s %.1f %s' %(\"Drain current is (At vgs = -4 V) =\",Id*10**3,\"mA\\n\");\n",
      "\n",
      "#At vgs = -8 V\n",
      "print '%s' %(\"Drain current is 0 A (At vgs = -8 V) because gate is biased beyond cut off \");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Drain current is (At vgs = -2 V) = 7.2 mA\n",
        "\n",
        "Drain current is (At vgs = -4 V) = 0.8 mA\n",
        "\n",
        "Drain current is 0 A (At vgs = -8 V) because gate is biased beyond cut off \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate Vgs and Vds saturation\n",
      "#given\n",
      "import math\n",
      "Vp=5.#V          #pinch off voltage\n",
      "Idss=-15.*10.**-3.;#A      #drain to source current with gate shorted\n",
      "Id=-3.*10.**-3.;#A         #saturation current\n",
      "Vgs=Vp*(1.-math.sqrt(Id/Idss));\n",
      "Vds=Vgs-Vp;\n",
      "print '%s %.3f %s' %(\"The gate to source voltage (Vgs) is =\",Vgs,\"V\\n\");\n",
      "print '%s %.3f %s' %(\"The saturation voltage is Vds(sat) =\",Vds,\"V\");\n",
      "\n",
      "print '\\nThe value of Vgs = 2.115V and Vds= -2.885V in book because of the calculation error'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gate to source voltage (Vgs) is = 2.764 V\n",
        "\n",
        "The saturation voltage is Vds(sat) = -2.236 V\n",
        "\n",
        "The value of Vgs = 2.115V and Vds= -2.885V in book because of the calculation error\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate drain current Id for N channel\n",
      "#given\n",
      "Vp=5.#V          #pinch off voltage\n",
      "Idss=18.*10.**-3.;#A     #drain to source current with gate shorted\n",
      "\n",
      "#For Vgs= - 3 V\n",
      "Vgs=-3.;#V\n",
      "Id=Idss*(1.-(Vgs/(-Vp)))**2.;\n",
      "print '%s %.2f %s' %(\"The drain current Id(For Vgs= -3V) =\",Id*10**3,\"mA\\n\");\n",
      "\n",
      "#For Vgs= 2.5 V\n",
      "Vgs=2.5;#V\n",
      "Id=Idss*(1.-(Vgs/(-Vp)))**2.;\n",
      "print '%s %.1f %s' %(\"The drain current Id(For Vgs= 2.5V) =\",Id*10**3,\"mA\");\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain current Id(For Vgs= -3V) = 2.88 mA\n",
        "\n",
        "The drain current Id(For Vgs= 2.5V) = 40.5 mA\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate drain current Id for P channel\n",
      "#given\n",
      "Vp=-5.#V          #pinch off voltage\n",
      "Idss=18.*10.**-3.;#A     #drain to source current with gate shorted\n",
      "\n",
      "#For Vgs= -3V\n",
      "Vgs=-3.;#V\n",
      "Id=Idss*(1.-(Vgs/(-Vp)))**2.;\n",
      "print '%s %.2f %s' %(\"The drain current Id (For Vgs= -3V) =\",Id*10**3,\"mA\\n\");\n",
      "\n",
      "#For Vgs= 2.5V\n",
      "Vgs=2.5;#V\n",
      "Id=Idss*(1.-(Vgs/(-Vp)))**2.;\n",
      "print '%s %.1f %s' %(\"The drain current Id (For Vgs= 2.5V) =\",Id*10**3,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain current Id (For Vgs= -3V) = 46.08 mA\n",
        "\n",
        "The drain current Id (For Vgs= 2.5V) = 4.5 mA\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find the value of drain current\n",
      "#given\n",
      "Vt=2.;#V      #threshold voltage\n",
      "K=0.25*10.**-3.;# A/V**2      #conductivity parameter\n",
      "Vgs=3.;#V #gate supply\n",
      "Vds=2.;#V #saturation voltage\n",
      "Vdsm=Vgs-Vt;        #minimum voltage required to pinch off\n",
      "\n",
      "# Vds > Vdsm therefore the device is in saturation region\n",
      "\n",
      "Id=K*(Vgs-Vt)**2.;\n",
      "print '%s %.2f %s' %(\"The drain current is =\",Id*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain current is = 0.25 mA\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Find the value of Id\n",
      "#given\n",
      "Vt=1.5;#V      #threshold voltage\n",
      "Id=2.*10.**-3.;#A\n",
      "Vgs=3.;#V #gate supply\n",
      "Vds=5.;#V #saturation voltage\n",
      "Vdsm=Vgs-Vt;        #minimum voltage required to pinch off\n",
      "\n",
      "# Vds > Vdsm therefore the device is in saturation region\n",
      "\n",
      "# Calculating K\n",
      "K=Id/((Vgs-Vt)**2.);       # A/V**2      #conductivity parameter\n",
      "\n",
      "#Calculating Id for Vgs= 5 V and Vds= 6 V\n",
      "Vgs=5;#V #gate supply\n",
      "Vds=6;#V #saturation voltage\n",
      "Id=K*((Vgs-Vt)**2);\n",
      "print '%s %.2f %s' %(\"The drain current is =\",Id*1000,\"mA\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain current is = 10.89 mA\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 174"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Calculate the dynamic drain resistance\n",
      "#given\n",
      "gm=200.*10.**-6.;#S transconductance\n",
      "u=80.;#amplification factor\n",
      "rd=u/gm;\n",
      "print '%s %.f %s' %(\"The dynamic drain resistance is =\",rd/1000,\"k ohm\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The dynamic drain resistance is = 400 k ohm\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}