{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3: Inverting and Non Inverting Amplifiers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.1 Page No 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Rf=100*(10**3)      #Feedback Resistance in ohms\n",
      "Ri=10*(10**3)       #Input Resistance in ohms\n",
      "Ei=1.0                #Input volts\n",
      "\n",
      "#Calculation \n",
      "I=Ei/Ri              #Equation for current through Rf\n",
      "Vout=-(Rf/Ri)*Ei      #Equation for Output Voltage\n",
      "Acl=-(Rf/Ri)          #Closed loop gain of the amplifier \n",
      "\n",
      "#Result\n",
      "print\"(a) Current through Rf  is\",I*1000,\"mA\"\n",
      "print\"(b) Value of output voltage is \",Vout,\"V\"\n",
      "print\"(c) Value of closed loop gain is\",Acl"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Current through Rf  is 0.1 mA\n",
        "(b) Value of output voltage is  -10.0 V\n",
        "(c) Value of closed loop gain is -10\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.2 Page No 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Vout=10.0         #output voltage\n",
      "I=0.1*(10**-3)   #current through Rf in amperes\n",
      "Rl=25*(10**3)    #Load resistance in ohms\n",
      "\n",
      "#Calculation\n",
      "Il=Vout/Rl\n",
      "Iout=I+Il\n",
      "\n",
      "#Result\n",
      "print\"(a) Value of load current is\",Il*1000,\"m\"\n",
      "print\"(b) Total current into the output pin of the opamp is \",Iout*1000,\"mA\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Value of load current is 0.4 m\n",
        "(b) Total current into the output pin of the opamp is  0.5 mA\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.3 Page No 49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Rf=250*(10**3)#Feedback Resistance in Ohms\n",
      "Ri=10*(10**3)#Input Resistance in Ohms\n",
      "Ei=0.5#Input voltage\n",
      "\n",
      "#Calculation\n",
      "I=Ei/(Ri)\n",
      "VRf=I*Rf\n",
      "Ei1=-0.5\n",
      "Vout=-(Rf/Ri)*Ei1\n",
      "\n",
      "#Result\n",
      "print\"(a) Value of current through Rf is\",I,\"A\"\n",
      "print\"(b) Voltage through Rf is \",VRf,\"V\"\n",
      "print\"(c) Output Voltage is\",Vout,\"V\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Value of current through Rf is 5e-05 A\n",
        "(b) Voltage through Rf is  12.5 V\n",
        "(c) Output Voltage is 12.5 V\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.4 Page No 49"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Vout=12.5      #in volts\n",
      "Il=2*10**-3    #in amperes\n",
      "\n",
      "#Calculation\n",
      "Rl=Vout/Il     #Load resistance in ohm\n",
      "I=0.05*10**-3\n",
      "Iout=I+Il\n",
      "\n",
      "#Result\n",
      "print\"(a) Value of Load Resistance is\",Rl/1000,\"kohm\"\n",
      "print\"(b) Value of output current is \",Iout*1000,\"mA\"\n",
      "print\"(c)The circuit input resistance is Rl=10Kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Value of Load Resistance is 6.25 kohm\n",
        "(b) Value of output current is  2.05 mA\n",
        "(c)The circuit input resistance is Rl=10Kohm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.5 Page No 50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Rf=20*10**3\n",
      "Ri=10*10**3\n",
      "\n",
      "#calculation\n",
      "Acl=-(Rf/Ri)  #Voltage Gain\n",
      "\n",
      "#Result\n",
      "print\" Value of Voltage Gain is\",Acl"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of Voltage Gain is -2\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.6 Page No 51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Ei=-5         #input voltage\n",
      "Acl=-2        #Voltage Gain\n",
      "\n",
      "#Calculation\n",
      "Vout=Ei*Acl   #output voltage\n",
      "\n",
      "#Result\n",
      "print\" Value of Output Voltage is\",Vout,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of Output Voltage is 10 V\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.7 Page No :51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Ri=10*10**3       #input resistance in ohm\n",
      "Gain= 25\n",
      "\n",
      "#Calculation\n",
      "Rf=Gain*Ri        #feedback resistance in ohm\n",
      "\n",
      "#result\n",
      "print\" Value of Rf is\",Rf/1000,\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of Rf is 250 kohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.8 Page No 52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "E1=2\n",
      "E2=3\n",
      "E3=1        #input voltage\n",
      "R=10*10**3  #in ohm\n",
      "\n",
      "#calculation\n",
      "Vout=-(E1+E2+E3)\n",
      "\n",
      "#result\n",
      "print\" Value of o/p voltage is  \",Vout,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of o/p voltage is   -6 V\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.9 Page No 53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "E1=2.0\n",
      "E2=3.0\n",
      "E3=-1.0      #input voltage\n",
      "R=10*10**3   #in ohm\n",
      "\n",
      "#Calculation\n",
      "Vout=-(E1+E2+E3)\n",
      "\n",
      "#result\n",
      "print\" Value of o/p voltage is\",Vout"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of o/p voltage is -4.0\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.11 Page No 56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "#Channel 1\n",
      "Ri= 10*10**3      #Choosing Input resistance\n",
      "Acl = -10.0 \n",
      "\n",
      "#Calculation\n",
      "Rf1 = - (Acl * Ri)\n",
      "#Channel 2\n",
      "Acl1 = -5\n",
      "Rf2 = - (Acl1 * Ri)\n",
      "#channel 3\n",
      "Acl2 = -2\n",
      "Rf3 = - (Acl2 * Ri)\n",
      "\n",
      "#result\n",
      "print\" Value of Rf1 =  \",Rf1/1000,\"kohm\"\n",
      "print\" Value of Rf2 =  \",Rf2/1000,\"kohm\"\n",
      "print\" Value of Rf3 =  \",Rf3/1000,\"kohm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of Rf1 =   100.0 kohm\n",
        " Value of Rf2 =   50 kohm\n",
        " Value of Rf3 =   20 kohm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.12 Page No 57"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "R1=100000.0\n",
      "R2=100000.0\n",
      "R3=100000.0\n",
      "R=100000.0     #in ohm\n",
      "Rf=33*10**3    #in ohm\n",
      "E1=5\n",
      "E2=5\n",
      "E3=-1  #in volts\n",
      "n=3.0          #number of inputs\n",
      "\n",
      "#Calculation\n",
      "Vout=-(E1+E2+E3)/n   #output voltage\n",
      "\n",
      "#Result\n",
      "print\" Value of output voltage is\",Vout,\"V\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of output voltage is -3.0 V\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.13 Page No 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Rf = 40*10**3\n",
      "R1 = 10*10**3\n",
      "\n",
      "#calculation\n",
      "Acl = (Rf + R1)/R1\n",
      "print\"(a) Value of Voltage Gain =   \",Acl\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Value of Voltage Gain =    5\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.14 Page No 59"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given \n",
      "Acl = 10.0    # Gain is positive, so choose noninvering amplifier\n",
      "R1 = 10*10**3\n",
      "\n",
      "#Calculation\n",
      "Rf = (Acl*R1)-R1\n",
      "\n",
      "#Result\n",
      "print\" Value of Rf is\",Rf/1000,\"kohm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": []
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.15 Page No 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "Ei=4.0       #in volts\n",
      "Rl=10*10**3  #in ohm\n",
      "I=0          #in ampere\n",
      "\n",
      "#Calculation\n",
      "Vout=Ei      #output voltage\n",
      "Il=Vout/Rl   #load current\n",
      "I0=I+Il      #output current \n",
      "\n",
      "#Result\n",
      "print\" Value of o/p voltage is\",Vout,\"V\"\n",
      "print\" Value of load current is \",Il*1000,\"mA\"\n",
      "print\" Value of output current is \",I0*1000,\"mA\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Value of o/p voltage is 4.0 V\n",
        " Value of load current is  0.4 mA\n",
        " Value of output current is  0.4 mA\n"
       ]
      }
     ],
     "prompt_number": 11
    }
   ],
   "metadata": {}
  }
 ]
}