{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1> Chapter No 8 : Metal Semiconductor Field Effect Transistor <h1>"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1, Page No  323"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "I_DSS = 15.0    #in mA\n",
      "V_GS_off = -5.0    #in V\n",
      "V_GS = 0        #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "I_D = I_DSS*((1-(V_GS/V_GS_off))**2)     #in mA\n",
      "V_GS = -1                   #in V\n",
      "I_D1 = I_DSS*((1.0-(V_GS/V_GS_off))**2)         #in mA\n",
      "V_GS = -4             #in V\n",
      "I_D2 = I_DSS*((1-(V_GS/V_GS_off))**2)          #in mA\n",
      "\n",
      "#RESULTS\n",
      "print('When V_GS=0, the drain current is =%.f mA ' %I_D)\n",
      "print('When V_GS=-1V, the drain current is =%.2f mA ' %I_D1)\n",
      "print('The interplanner spacing is =%.2f  \u00c5' %I_D2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When V_GS=0, the drain current is =15 mA \n",
        "When V_GS=-1V, the drain current is =9.60 mA \n",
        "The interplanner spacing is =0.60  \u00c5\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4, Page No 327"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_DSS = 20.0            #in mA\n",
      "V_P = -8            #in V\n",
      "g_mo = 5000.0       #in \u00b5s\n",
      "V_GS = -4.0            #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "\n",
      "I_D = I_DSS*((1-(V_GS/V_P))**2)      #in mA\n",
      "g_m = g_mo*(1-(V_GS/V_P))            #in \u00b5s\n",
      "\n",
      "#RESULTS\n",
      "print('The value of drain current is =%.f mA ' %I_D)\n",
      "print('The transconductance is =%.f  \u00b5s' %g_m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of drain current is =5 mA \n",
        "The transconductance is =2500  \u00b5s\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5 Page No 327"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "\n",
      "\n",
      "#initialisation of variables\n",
      "I_D1 = 10.0        #in mA\n",
      "V_GS = -12.0    #in V\n",
      "V_GSth = -3.0    #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "K = I_D1/( (V_GS-V_GSth)**2 )         #in mA/V\n",
      "V_GS= -6                 #in V\n",
      "I_D = K*((V_GS-V_GSth)**2)         #in mA\n",
      "\n",
      "#RESULTS\n",
      "print('The value of I_D  is =%.2f mA ' %I_D)\n",
      "print('Approximation error')"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of I_D  is =1.11 mA \n",
        "Approximation error\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7, Page No 327"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V_GS = -2.0            #in V\n",
      "V_P = -5.0          #in V\n",
      "V_DS = V_GS-V_P     #in V\n",
      "I_DSS = 8.0      #in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "I_D = I_DSS*((1-(V_GS/V_P))**2)        #in mA\n",
      "\n",
      "#RESULTS\n",
      "print('The minimum value of V_DS is =%.f  V ' %V_DS)\n",
      "print('The drain current is =%.2f  mA' %I_D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum value of V_DS is =3  V \n",
        "The drain current is =2.88  mA\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8  Page No 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V_P = -2                 #in V\n",
      "I_DSS = 1.65             #in mA\n",
      "I_D = 0.8                #in mA\n",
      "V_DD = 24.0              #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "V_GS = V_P*(1- math.sqrt(I_D/I_DSS) )    #in V\n",
      "g_mo = -(2*I_DSS)/V_P           #in mS\n",
      "g_m = g_mo*(1-(V_GS/V_P))       #in mS\n",
      "\n",
      "#RESULTS\n",
      "print('The value of V_GS is =%.2f V  ' %V_GS)\n",
      "print('The value of g_m is =%.2f  mS' %g_m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of V_GS is =-0.61 V  \n",
        "The value of g_m is =1.15  mS\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.9 Page No 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "V_P = 5.0         #in V\n",
      "I_DSS = -40.0     #in mA\n",
      "I_D = -15.0         #in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "V_GS = V_P*(math.sqrt(I_D/I_DSS)-1 )       #in V\n",
      "\n",
      "#RESULTS\n",
      "print('The gate source voltage is =%.2f   V' %(V_GS*-1))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The gate source voltage is =1.94   V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.10, Page No 328"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_D1 = 1.9       #in mA\n",
      "I_D2 = 1.0       #in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "del_I_D = I_D1-I_D2          #in mA\n",
      "V_GS2 = -3.3              #in V\n",
      "V_GS1 = -3.0            #in V\n",
      "del_V_GS = V_GS1-V_GS2      #in V\n",
      "g_m = del_I_D/del_V_GS       #in mA/V\n",
      "g_m = g_m * 10**3         #in \u00b5 mhos\n",
      "\n",
      "#RESULTS\n",
      "print('The value of transconductance is =%.f \u00b5 mhos ' %g_m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of transconductance is =3000 \u00b5 mhos \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.11 Page No 329"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "V_DS1 = 14.0          #in V\n",
      "V_DS2 = 5.0          #in V\n",
      "del_V_DS = V_DS1-V_DS2      # in V\n",
      "I_D1 = 3.3            #in mA\n",
      "I_D2 = 3              # in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "del_I_D = I_D1-I_D2           #in mA\n",
      "r_d = del_V_DS/del_I_D          #in k ohms\n",
      "print('The drain resistance  is =%.f  k ohms' %r_d)\n",
      "V_GS1 = 0.4              #in V\n",
      "V_GS2 = 0.1             #in V\n",
      "del_V_GS = V_GS1-V_GS2     #in V\n",
      "I_D1 = 3.3             #in mA\n",
      "I_D2 = 0.71           #in mA\n",
      "del_I_D = I_D1-I_D2       # in mA\n",
      "g_m = del_I_D/del_V_GS    # in mA/V\n",
      "g_m = g_m * 10**3           # in \u00b5mhos\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The transconductance is =%.f \u00b5mhos  ' %g_m)\n",
      "Miu =r_d*10**3*g_m*10**-6\n",
      "print('Amplification factor is =%.f  ' %Miu)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain resistance  is =30  k ohms\n",
        "The transconductance is =8633 \u00b5mhos  \n",
        "Amplification factor is =259  \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.12 Page No 334"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "q = 1.6*10**-19         #in C\n",
      "N_D = 10**15*10**6      #electrons/m^3\n",
      "a = 3*10**-4            #in cm\n",
      "a=a*10**-2              #in m\n",
      "\n",
      "#CALCULATIONS\n",
      "Epsilon_o  = (36 * math.pi * 10**9)**-1\n",
      "Epsilon = 12*Epsilon_o\n",
      "V_P = (q*N_D*((a)**2))/(2*Epsilon)       #in V\n",
      "print('Pinch off voltage is =%.2f   V ' %V_P)\n",
      "V_GS = 1.0     #in V\n",
      "V_P = 2.0      #in V\n",
      "b = a*( 1-math.sqrt(V_GS/V_P) )         #in m\n",
      "b = b * 10**6              #in \u00b5m\n",
      "\n",
      "#RESULTS\n",
      "print('The channel half width  is =%.2f  \u00b5m' %b)\n",
      "# Note: In the book, the unit of channel half width is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pinch off voltage is =6.79   V \n",
        "The channel half width  is =0.88  \u00b5m\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.13 Page No 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "I_DSS = 8.0       #in mA\n",
      "V_P = -4.0           #in V\n",
      "a = 3*10**-4        #in cm\n",
      "N_D = 10**15        #in electrons/cm^3\n",
      "I_D = 3.0           #in mA\n",
      "\n",
      "#CALCULATIONS\n",
      "V_GS = V_P*( 1-math.sqrt(I_D/I_DSS) )           #in V\n",
      "V_DS_sat = V_GS-V_P                             #in V\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The value of V_GS is =%.2f   V' %V_GS)\n",
      "print('The value of V_DS_sat is =%.2f   V ' %V_DS_sat)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of V_GS is =-1.55   V\n",
        "The value of V_DS_sat is =2.45   V \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 8.14 Page No 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "V_P = -4            #in V\n",
      "I_DSS = 9.0       #in mA\n",
      "V_GS = -2.0       #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "I_D = I_DSS*(( 1-(V_GS/V_P) )**2)        #in mA\n",
      "\n",
      "#RESULTS\n",
      "print('The drain current is =%.2f mA ' %I_D)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The drain current is =2.25 mA \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 8.15 Page No 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "I_DSS = 12.0           #in mA\n",
      "V_P = -6.0             #in V\n",
      "V_GS = -1.0              #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "g_mo = (-2*I_DSS)/V_P      #in mA/V\n",
      "g_m = g_mo*(1-(V_GS/V_P))         #in mS\n",
      "\n",
      "#RESULTS\n",
      "print('The value of transconductance is =%.2f  mS' %g_m)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of transconductance is =3.33  mS\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 8.16 Page No 336"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "I_DSS = 10.0          #in mA\n",
      "V_P = -5.0            #in V\n",
      "V_GS = -2.5          #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "g_m = ((-2*I_DSS)/V_P)*(1-(V_GS/V_P))         #in mS .... correction\n",
      "I_D = I_DSS * ((1-(V_GS/V_P))**2)             #in mA\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The transconductance is =%.f mS ' %g_m)\n",
      "print('The drain current is =%.2f mA ' %I_D)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The transconductance is =2 mS \n",
        "The drain current is =2.50 mA \n"
       ]
      }
     ],
     "prompt_number": 14
    }
   ],
   "metadata": {}
  }
 ]
}