{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 6 : Field Effect Transistors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.1, Page No. 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# drain resistance transconductance and amplification factor\n",
      "\n",
      "import math\n",
      "from array import array\n",
      "#Variable declaration\n",
      "Vgs=array('d', [0.0, 0.0, 0.3])     #in V\n",
      "Vds=array('d',[5.0, 10.0, 10.0])    #in V\n",
      "Id=array('d',[8.0, 8.2, 7.6])       #in mA\n",
      "\n",
      "#Calcualtions\n",
      "dVds=Vds[1]-Vds[0]                  #in V\n",
      "dId=Id[1]-Id[0]                     #in mA\n",
      "rd=(dVds/dId)                       #in kilo-ohm\n",
      "dVgs=Vgs[2]-Vgs[1]                  #in V\n",
      "dId1=Id[1]-Id[2]                    #in mA\n",
      "gm=dId1/dVgs                        #in mA/volt\n",
      "mu=gm*rd                            #A/V\n",
      "\n",
      "#Result\n",
      "print(\"(i)  A.C. Drain resistance is ,(kilo-ohm)= %.f\"%rd)\n",
      "print(\"(ii) Transconductance is ,(mS)           = %.f\"%gm)\n",
      "print(\"(iii) Amplification factor is ,          = %.f\"%mu)\n",
      "#Transconductance and Amplification factor are calculated wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  A.C. Drain resistance is ,(kilo-ohm)= 25\n",
        "(ii) Transconductance is ,(mS)           = 2\n",
        "(iii) Amplification factor is ,          = 50\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.2, Page No. 184"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# mutual conductance\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "I1=1.0                  # in mA\n",
      "I2=1.2                  # in mA\n",
      "V1=-3.0                 # in V\n",
      "V2=-2.9                 # in V\n",
      "\n",
      "#Calculations\n",
      "del_ID=(I2-I1)\n",
      "del_VGS=V2-V1           # in V\n",
      "gm=del_ID/del_VGS\n",
      "\n",
      "#Result\n",
      "print(\"mutual conductance,gm(mS) = %.f\"%gm)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "mutual conductance,gm(mS) = 2\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.3, Page No. 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# pinch off voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "a=5.6*10**-6/2                  # channel width in m\n",
      "epsilon0=8.86*10**-12           # in F/m\n",
      "epsilon=12*epsilon0             # in F/m\n",
      "Nd=10**21                       # in m^-3\n",
      "e=1.6*10**-19                   # in V\n",
      "\n",
      "#Calculations\n",
      "Vp=e*Nd*a**2/(2*epsilon);\n",
      "\n",
      "#Result\n",
      "print(\"Pinch off voltage,Vp(V) = %.1f\"%Vp)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pinch off voltage,Vp(V) = 5.9\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.4, Page No. 185"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# ID gm and gmo\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "I_DES=8.7                 # in mA\n",
      "V1=-3.0                   # in V\n",
      "V_GS=-1.0                 # in V\n",
      "\n",
      "\n",
      "#Calculations\n",
      "gmo=-(2*I_DES/V1)\n",
      "ID=I_DES*(1-(V_GS/V1))**2\n",
      "gm=gmo*(1-(V_GS/V1));\n",
      "\n",
      "#Result\n",
      "print(\"(i).  ID(mA)  = %.3f\"%(math.floor(ID*1000)/1000))\n",
      "print(\"(ii). gmo(mS) = %.1f\"%gmo)\n",
      "print(\"(iii).gm(mA)  = %.3f\"%(math.floor(gm*1000)/1000))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i).  ID(mA)  = 3.866\n",
        "(ii). gmo(mS) = 5.8\n",
        "(iii).gm(mA)  = 3.866\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.5, Page No. 186"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Vgs\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "ID=3.0                         # in mA\n",
      "I_DSS=9.0                      # in mA\n",
      "Vp=-4.5                        # in V\n",
      "\n",
      "#Calculations\n",
      "Vgs=-Vp*(math.sqrt(ID/I_DSS)-1)\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"Vgs(V) = %.1f\"%Vgs)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Vgs(V) = -1.9\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.6, Page No. 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# voltage amplification\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "gm=3                  #Transconductance in mS\n",
      "rl=10                 #load resistance in kilo-ohm\n",
      "\n",
      "#Calculations\n",
      "av=gm*rl\n",
      "#Result\n",
      "print(\"the voltage aplification is ,= %.f\"%av)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the voltage aplification is ,= 30\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6.7, Page No. 196"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# output voltage\n",
      "\n",
      "import math\n",
      "#Variable declaration\n",
      "Rl=20.0                   #in kilo-ohm\n",
      "Rs=1.0                    #in kilo-ohm\n",
      "Rg=1.0                    #in M-ohm\n",
      "Cs=25.0                   #in micro-F\n",
      "mu=20.0                   #amplification factor\n",
      "rd=100.0                  #in kilo-ohm\n",
      "vi=2.0                    #in V\n",
      "f=1.0                     #in kilo-Hz\n",
      "\n",
      "#Calculations\n",
      "Xc=((1/(2*math.pi*f*10**3*Cs*10**-6)))\n",
      "A=((mu*Rl*10**3)/((rd+Rl)*10**3))\n",
      "Vo=A*vi\n",
      "\n",
      "#Result\n",
      "print(\"amplifier output signal voltage is ,(V)= %.2f\"%(math.floor(Vo*100)/100))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "amplifier output signal voltage is ,(V)= 6.66\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}