{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 12 JFETS"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12.1 Page No 303"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The dc voltage from the drain to ground = 22.37 volts\n",
      "The source voltage to ground = 12.00 volts\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "R1= 20##  kΩ\n",
    "R2= 10##  kΩ\n",
    "R_E= 10##  kΩ\n",
    "R_D= 8.2##  kΩ\n",
    "V_G= 10##  V\n",
    "V_BE= 0.7##  V\n",
    "V_GS= -2##  V\n",
    "V_DD= 30##  V\n",
    "V_B= R2*V_DD/(R1+R2)##  V\n",
    "I_E= (V_B-V_BE)/R_E##  mA\n",
    "I_D= I_E##  mA\n",
    "# The dc voltage from the drain to ground \n",
    "V_D= V_DD-I_D*R_D##  V\n",
    "# The source voltage to ground \n",
    "Vs= V_G-V_GS##  V\n",
    "print \"The dc voltage from the drain to ground = %.2f volts\"%V_D\n",
    "print \"The source voltage to ground = %.2f volts\"%Vs"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12.2 Page No 307"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Part (i) When V_GS= -1\n",
      "The value of gm = 3000.00 µS\n",
      "Part (ii) When I_D= 2.5 mA\n",
      "The value of gm = 1500.00 µS\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "gmo= 3000##  µmhoS\n",
    "V_GSoff= -4##  V\n",
    "I_DSS= 10##  mA\n",
    "print \"Part (i) When V_GS= -1\"\n",
    "V_GS= -1##  V\n",
    "# The value of gm \n",
    "gm= gmo*(1-V_GS/V_GSoff)##  µS\n",
    "print \"The value of gm = %.2f µS\"%gm\n",
    "print \"Part (ii) When I_D= 2.5 mA\"\n",
    "I_D= 2.5##  mA\n",
    "# The value of gm \n",
    "gm= gmo*2*I_D/I_DSS##  µS\n",
    "print \"The value of gm = %.2f µS\"%gm"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12.3 Page No 311"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The output voltage = 12.79 mV\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "gm= 2000##  µS\n",
    "gm=gm*10**-6##  S\n",
    "R_D= 4.7##  kΩ\n",
    "Vin= 2##  mV\n",
    "R_L= 10##  kΩ\n",
    "r_D= R_D*R_L/(R_D+R_L)##  kΩ\n",
    "r_D= r_D*10**3##  Ω\n",
    "A= gm*r_D## unit less\n",
    "# The output voltage \n",
    "Vout= A*Vin##  mV\n",
    "print \"The output voltage = %.2f mV\"%Vout\n",
    "\n",
    "# Note: The calculated value of A = %.2f the book is wrong. Correct value of A6.39, So the answer in the book is wrong."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12.4 Page No 311"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The voltage gain = 0.84\n"
     ]
    }
   ],
   "source": [
    "# given data\n",
    "R_D= 7.5##  kΩ\n",
    "R_L= 3##  kΩ\n",
    "r_s= R_D*R_L/(R_D+R_L)##  kΩ\n",
    "r_s= r_s*10**3##  Ω\n",
    "gm= 2500*10**-6##  S\n",
    "# The voltage gain \n",
    "A= gm*r_s/(1+gm*r_s)## unit less\n",
    "print \"The voltage gain = %.2f\"%A"
   ]
  }
 ],
 "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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
