{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#Chapter 10 , Field Effect Transistors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.1 , Page Number 344"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Gate-to-source resistance :  100.0 Mega-ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VGS = 10.0                    #Gate-source voltage (in volts)\n",
    "IG = 0.1 * 10**-6             #Gate current (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "RGS = VGS/IG                  #Gate-to-source resistance (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Gate-to-source resistance : \",RGS*10**-6,\"Mega-ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.2 , Page Number 344"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AC drain resistance of the JFET :  12.5 kilo-ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "dVDS = 1.5                  #Change in drain-source voltage (in volts)\n",
    "dID = 120.0 * 10**-6        #Change in drain current (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "rd = dVDS/dID               #AC drain resistance (in ohm) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"AC drain resistance of the JFET : \",rd*10**-3,\"kilo-ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.3 , Page Number 344"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Transconductance :  2000.0 micro-siemens.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "dID = 0.3 * 10**-3            #Change in drain current (in Ampere)\n",
    "dVGS = 0.15                   #Changein gate-to-source voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "gm = dID/dVGS                 #Transconductance (in siemen) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Transconductance : \",gm*10**6,\"micro-siemens.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.4 , Page Number 345"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AC drain resistance :  35.0 kilo-ohm.\n",
      "Transconductance :  2.8 mA/V.\n",
      "Amplification factor :  98.0 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "dVDS = 7.0                  #Change in drain-source voltage (in volts)\n",
    "dID1 = 0.2 * 10**-3         #Change in drain current1 (in Ampere)\n",
    "dID2 = -0.7 * 10**-3        #Change in drain current2 (in Ampere)\n",
    "dVGS = -0.25                #Changein gate-to-source voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "rd = dVDS/dID1              #AC drain resistance (in ohm)\n",
    "gm = dID2/dVGS              #Transconductance (in Ampere per volt)\n",
    "u = rd*gm                   #Amplification factor\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"AC drain resistance : \",rd*10**-3,\"kilo-ohm.\"\n",
    "print \"Transconductance : \",gm*10**3,\"mA/V.\"\n",
    "print \"Amplification factor : \",u,\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.5 , Page Number 345"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Transconductance :  2.22 mA/V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IDSS = 10.0 * 10**-3                #Drain-source saturation current (in Ampere)\n",
    "Vp = -4.5                           #Pinch-off voltage (in volts)\n",
    "IDS = 2.5 * 10**-3                  #Drain-source voltage (in volts)   \n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGS = Vp*(1-(IDS/IDSS)**0.5)        #Gate-to-source voltage (in volts)\n",
    "gm = -2*IDSS/Vp*(1- VGS/Vp)         #Transconductance (in Ampere per volt)  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Transconductance : \",round(gm*10**3,2),\"mA/V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.6 , Page Number 345"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VGSoff :  -2.0 mV.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "gm = 10.0 * 10**-3                #Transconductance (in siemens)\n",
    "IDSS = 10.0 * 10**-6              #Drain-source saturation current (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGSoff = (-2*IDSS)/gm             #Gate-to-source voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VGSoff : \",VGSoff*10**3,\"mV.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.7 , Page Number 345"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Minimum value of VDS :  -4.0 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vp = -4.0              #Pinch-off voltage (in volts)\n",
    "VGS = -2.0             #Gate-source voltage (in volts)\n",
    "IDSS = 10.0 * 10**-3   #Drain-source saturation current (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "ID = IDSS*(1 - VGS/Vp)**2          #Drain current (in Ampere)\n",
    "VDSmin = Vp                        #Minimum drain-source voltage (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Minimum value of VDS : \",VDSmin,\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.8 , Page Number 346"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ID :  3.8667 mA.\n",
      "gmo :  5.8 mS.\n",
      "gm :  3.867 mS.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IDSS = 8.7 * 10**-3    #Drain-source saturation current (in Ampere)\n",
    "Vp = -3.0              #Pinch-off voltage (in volts)\n",
    "VGS = -1.0             #Gate-source voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "ID = IDSS*(1 - VGS/Vp)**2          #Drain current (in Ampere)\n",
    "gmo = -2*IDSS/Vp                   #Transconductance for VGS = 0 (in Ampere per volt)  \n",
    "gm = gmo*(1 - VGS/Vp)              #Transconductance (in Ampere per volt)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"ID : \",round(ID*10**3,4),\"mA.\"\n",
    "print \"gmo : \",round(gmo*10**3,1),\"mS.\"\n",
    "print \"gm : \",round(gm*10**3,3),\"mS.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.9 , Page Number 346"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ID :  2.1 mA.\n",
      "gmo :  5.6 mS.\n",
      "gm :  2.8 mS.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IDSS = 8.4 * 10**-3    #Drain-source saturation current (in Ampere)\n",
    "Vp = -3.0              #Pinch-off voltage (in volts)\n",
    "VGS = -1.5             #Gate-source voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "ID = IDSS*(1 - VGS/Vp)**2          #Drain current (in Ampere)\n",
    "gmo = -2*IDSS/Vp                   #Transconductance for VGS = 0 (in Ampere per volt)  \n",
    "gm = gmo*(1 - VGS/Vp)              #Transconductance (in Ampere per volt)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"ID : \",round(ID*10**3,4),\"mA.\"\n",
    "print \"gmo : \",round(gmo*10**3,1),\"mS.\"\n",
    "print \"gm : \",round(gm*10**3,3),\"mS.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.10 , Page Number 346"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VGS :  -1.902 V.\n",
      "gm :  2.31 mS.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vp = -4.5              #Pinch-off voltage (in volts)\n",
    "IDSS = 9.0 * 10**-3    #Drain-source saturation current (in Ampere)\n",
    "IDS = 3.0 * 10**-3     #Drain-source current (in Ampere) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGS = Vp*(1-(IDS/IDSS)**0.5)        #Gate-to-source voltage (in volts)\n",
    "gm = -2*IDSS/Vp*(1 - VGS/Vp)        #Transconductance (in Ampere per volt)  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VGS : \",round(VGS,3),\"V.\"\n",
    "print \"gm : \",round(gm*10**3,2),\"mS.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.11 , Page Number 349"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drain-source voltage :  6.2 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VGG = 1.5                   #Gate supply voltage (in volts)\n",
    "VDD = 15.0                  #Drain supply voltage (in volts)\n",
    "RD = 1.5 * 10**3            #Drain resistance (in ohm)\n",
    "RG = 2.0 * 10**6            #Gate resistance (in ohm)\n",
    "IDSS = 15.0 * 10**-3        #Drain current in saturation (in Ampere)\n",
    "Vp = -4.0                   #Pinch-off voltage (in volts)\n",
    "VS = 0.0                    #Source voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGS = -VGG                  #Gate-to-source voltage (in volts)\n",
    "ID = IDSS*(1 - VGS/Vp)**2   #Drain current (in Ampere)\n",
    "VD = VDD - ID*RD            #Drain voltage (in volts)\n",
    "VDS = VD - VS               #Drain-to-source voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Drain-source voltage : \",round(VDS,1),\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.12 , Page Number 349"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ID =  3.0 mA.\n",
      "VDS =  -7.5 V.\n",
      "VD =  -7.5 V.\n",
      "VG =  -3.0 V.\n",
      "VS =  0 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VGS = VGG = -3.0                #Gate-source voltage (in volts)\n",
    "IDSS = 12.0 * 10**-3            #Drain current in saturation (in Ampere)\n",
    "Vp = -6.0                       #pinch-off voltage (in volts) \n",
    "VDD = 3.0                       #Drain voltage (in volts) \n",
    "RD = 3.5 * 10**3                #Drain resistance (in ohm) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "ID = IDSS*(1 - VGS/Vp)**2   #Drain current (in Ampere)\n",
    "VDS = VDD - ID*RD           #Drain-source voltage (in volts)\n",
    "VD = VDS                    #Drain voltage (in volts)\n",
    "VG = VGG                    #Gate voltage (in volts)\n",
    "VS = 0                      #Source voltage (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"ID = \",ID*10**3,\"mA.\"\n",
    "print \"VDS = \",VDS,\"V.\"           \n",
    "print \"VD = \",VD,\"V.\"             \n",
    "print \"VG = \",VG,\"V.\"             \n",
    "print \"VS = \",VS,\"V.\"             \n",
    "\n",
    "#Calculation error in the value of VDS and VD in the book."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.13 , Page Number 350"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drain-source voltage :  18.2 V.\n",
      "Gate-source voltage :  -0.8 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VDD = 25.0               #Drain Supply (in volts)\n",
    "RD = 3.0 * 10**3         #Drain resistance (in ohm)\n",
    "RS = 400.0               #Source resistance (in ohm)\n",
    "ID = 2.0 * 10**-3        #Drain current (in Ampere) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "VDS = VDD - ID*(RD + RS) #Drain-source voltage (in volts)\n",
    "VGS = -ID*RS             #Gate-source voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Drain-source voltage : \",VDS,\"V.\"\n",
    "print \"Gate-source voltage : \",VGS,\"V.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.14 , Page Number 350"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RS :  2.5 kilo-ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VDD = 25.0                  #Drain voltage (in volts)\n",
    "RG1 = 1.2 * 10**6           #Gate1 resistance (in ohm)\n",
    "RG2 = 0.6 * 10**6           #Gate2 resistance (in ohm)\n",
    "ID = 4.0 * 10**-3           #Drain current (in Ampere)\n",
    "VDS = 8.0                   #Drain-source voltage (in volts) \n",
    "Vp = -4.0                   #Pinch-off voltage (in volts)  \n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGS = Vp*(1 - (ID/IDSS)**0.5)    #Gate-source voltage (in volts)\n",
    "VG = VDD*RG2/(RG1 + RG2)    #Gate voltage (in volts)\n",
    "RS = (VG - VGS)/ID          #Source voltage (in ohm)   \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"RS : \",round(RS*10**-3,1),\"kilo-ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.15 , Page Number 350"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drain current at operating point :  4.46 mA.\n",
      "Since , value of ID at operating point is almost equal to previously computed value of Id. Therefore , FET is operated in pinch-off region.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Vp = -2.0                       #pinch-off voltage (in volts)\n",
    "IDSS = 5.0 * 10**-3             #Drain current in saturation (in Ampere)\n",
    "RL = 910.0                      #Load resistance (in ohm)\n",
    "RF = 2.29 * 10**3               #Resistance (in ohm)\n",
    "R1 = 12.0 * 10**6               #Resistance1 (in ohm)\n",
    "R2 = 8.57 * 10**6               #Resistance2 (in ohm)\n",
    "VDD = 24.0                      #Drain supply voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VG = VDD*R2/(R1 + R2)           #Gate voltage (in volts)\n",
    "ID = 4.46 * 10**-3               #Drain current (in Ampere)  \n",
    "VGS = VG - ID*RF                #Gate-source voltage (in volts)\n",
    "ID1 = (VG - VGS)/RF             #Drain current at operating point (in Ampere)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Drain current at operating point : \",round(ID1*10**3,3),\"mA.\"\n",
    "print \"Since , value of ID at operating point is almost equal to previously computed value of Id. Therefore , FET is operated in pinch-off region.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.16 , Page Number 353"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voltage gain :  -30.0 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "gm = 2500.0 * 10**-6       #Transconductance (in siemens)\n",
    "RL = 12.0 * 10**3          #Load resistance (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "A = -gm*RL                 #Voltage gain  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Voltage gain : \",A,\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.17 , Page Number 353"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VOltage gain :  -59.9 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "gm = 4000.0 * 10**-6       #Transconductance (in siemens)\n",
    "RL = 15.0 * 10**3          #Load resistance (in ohm)\n",
    "RD = 10.0 * 10**6          #Drain resistance (in ohm)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "A = -gm*RD*RL/(RD + RL)    #Voltage gain\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VOltage gain : \",round(A,1),\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.18 , Page Number 353"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RD :  5.0 kilo-ohm.\n",
      "RS :  1.0 kilo-ohm.\n",
      "Av :  -20.0 .\n",
      "Rin :  500.0 kilo-ohm.\n",
      "Rout :  4.0 kilo-ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "VGS = -1.0              #Gate-source voltage (in volts)\n",
    "VDS = 4.0               #Drain-source voltage (in volts)\n",
    "IDS = 1.0 * 10**-3      #Drain-source current (in Ampere)\n",
    "gm = 5.0 * 10**-3       #Transconductance (in siemens)\n",
    "RDS = 20.0 * 10**3      #Drain-source resistance (in ohm)\n",
    "RG = 500.0 * 10**3      #Gate resistance (in ohm)   \n",
    "VDD = 10.0              #Drain supply voltage (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "RS = abs(VGS/IDS)             #Source resistance (in ohm)\n",
    "RD = (VDD - VDS)/IDS - RS     #Drain resistance (in ohm) \n",
    "Av = -gm*(RD*RDS/(RD + RDS))  #Voltage gain\n",
    "Rin = RG                      #Input impedance (in ohm)\n",
    "Rout = RD*RDS/(RD + RDS)      #Output impedance (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"RD : \",RD*10**-3,\"kilo-ohm.\"\n",
    "print \"RS : \",RS*10**-3,\"kilo-ohm.\"\n",
    "print \"Av : \",Av,\".\"\n",
    "print \"Rin : \",Rin*10**-3,\"kilo-ohm.\"\n",
    "print \"Rout : \",Rout*10**-3,\"kilo-ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.19 , Page Number 355"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Input impedance :  1.33 Mega-ohm.\n",
      "Output impedance :  345.0 ohm.\n",
      "Voltage gain :  0.85 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "RL = 25.0 * 10**3               #Load resistance (in ohm)\n",
    "RS = 2.5 * 10**3                #Source Resistance (in ohm)\n",
    "R1 = 4.0 * 10**6                #Resistance1 (in ohm)\n",
    "R2 = 2.0 * 10**6                #Resistance2 (in ohm)\n",
    "gm = 2500.0 * 10**-6            #Transconductance (in siemens)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Zin = R1*R2/(R1 + R2)           #Input impedance (in ohm)\n",
    "Zout = RS*1/gm/(RS + 1/gm)      #Output impedance (in ohm)\n",
    "Av = gm*RS*RL/(RS + RL)/(1 + gm*(RS*RL)/(RS + RL))       #Voltage gain\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Input impedance : \",round(Zin*10**-6,2),\"Mega-ohm.\"\n",
    "print \"Output impedance : \",round(Zout),\"ohm.\"\n",
    "print \"Voltage gain : \",round(Av,2),\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.20 , Page Number 369"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drain current :  1.25 mA.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IDon = 5.0 * 10**-3              #Drain current in on state (in Ampere)\n",
    "VGS = 8.0                        #Gate-source voltage (in volts)\n",
    "VGST = 4.0                       #Gate-source T voltage (in volts)\n",
    "VGS1 = 6.0                       #Gate-source voltage1 (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "K = IDon/(VGS - VGST)**2         #K (in Ampere per volt-square) \n",
    "ID = K*(VGS1 - VGST)**2          #Drain current (in Ampere) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Drain current : \",round(ID*10**3,2),\"mA.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 10.21 , Page Number 369"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "VGS :  6.0 V.\n",
      "ID :  0.001 A.\n",
      "VDS :  9.0 V.\n",
      "Av :  12.0 .\n",
      "Vout :  0.96 V.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "IDon = 4.0 * 10**-3              #Drain current in on state (in Ampere)\n",
    "VGS = 8.0                        #Gate-source voltage (in volts)\n",
    "VGST = 4.0                       #Gate-source T voltage (in volts)\n",
    "gm = 2000.0 * 10**-6             #Transconductance (in siemens)\n",
    "VDD = 15.0                       #Drain supply voltage (in volts)\n",
    "RD = 6.0 * 10**3                 #Drain resistance (in ohm)\n",
    "RD2 = 40.0 * 10**3               #Resistance (in ohm)\n",
    "RD1 = 60.0 * 10**3               #Resistance (in ohm) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "VGS = VDD/(RD1 + RD2)*RD2        #Gate-source voltage (in volts)\n",
    "K = IDon/4**2         #K (in Ampere per volt-square)\n",
    "ID = K*(VGS - VGST)**2           #Drain current (in Ampere)\n",
    "VDS = VDD - ID*RD                #Drain-source voltage (in volts)\n",
    "Av = gm*RD                       #Voltage gain\n",
    "Vout = Av*0.08                   #Output voltage (in volts)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"VGS : \",VGS,\"V.\"\n",
    "print \"ID : \",ID,\"A.\"\n",
    "print \"VDS : \",abs(VDS),\"V.\"\n",
    "print \"Av : \",Av,\".\"\n",
    "print \"Vout : \",Vout,\"V.\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}