{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter-4 : Frequency Response Of An Op-Amp"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.1 - Page No 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "Vin= 0.5 # in V\n",
      "Av= 10 \n",
      "I_B_max= 1.5 # in micro amp\n",
      "I_B_max=I_B_max*10**-6 # in A\n",
      "# Let\n",
      "I1=100*I_B_max # in A\n",
      "R1= Vin/I1 # in ohm\n",
      "Rf= Av*R1 # in ohm\n",
      "# R2= R1 || Rf = R1 (approx.)\n",
      "R2= R1 # in ohm\n",
      "print \"Value of I1 = %0.f micro amp\" %(I1*10**6)\n",
      "print \"Value of R1 = %0.1f kohm\" %(R1*10**-3)\n",
      "print \"Value of R2 = %0.1f kohm\" %(R2*10**-3)\n",
      "print \"Value of Rf = %0.f kohm\" %(Rf*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Value of I1 = 150 micro amp\n",
        "Value of R1 = 3.3 kohm\n",
        "Value of R2 = 3.3 kohm\n",
        "Value of Rf = 33 kohm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.2 - Page No 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log10\n",
      "# Given data\n",
      "Vin= 50 # in mV\n",
      "Vin = Vin*10**-3 # in V\n",
      "I_B_max= 200 # in nA\n",
      "I_B_max=I_B_max*10**-9 # in A\n",
      "I1=100*I_B_max # in A(assumed)\n",
      "Av=100 \n",
      "R1= Vin/I1 # in \u03a9\n",
      "print \"The value of  R1 = %0.1f k\u03a9 (Standard value 2.2 k\u03a9)\" %(R1*10**-3)\n",
      "R1= 2.2 # kohm (standard value)\n",
      "Rf= Av*R1 # in kohm\n",
      "print \"The value of Rf = %0.f k\u03a9\" %Rf\n",
      "# R2 = R1 || Rf = R1 (approx)\n",
      "R2= R1 # in kohm\n",
      "print \"The value of R2 = %0.1f k\u03a9\" %R2\n",
      "Av= 20*log10(Av) # in dB\n",
      "C1= 100 # in pF\n",
      "R1= 1.5 # in k\u03a9\n",
      "C2= 3 # in pF\n",
      "print \"Voltage gain = %0.f dB\" %Av\n",
      "print \"Value of C1 = %0.f pF\" %C1\n",
      "print \"Value of C2 = %0.f pF\" %C2\n",
      "print \"Value of R1 = %0.1f k\u03a9\" %R1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of  R1 = 2.5 k\u03a9 (Standard value 2.2 k\u03a9)\n",
        "The value of Rf = 220 k\u03a9\n",
        "The value of R2 = 2.2 k\u03a9\n",
        "Voltage gain = 40 dB\n",
        "Value of C1 = 100 pF\n",
        "Value of C2 = 3 pF\n",
        "Value of R1 = 1.5 k\u03a9\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.3 - Page No 136\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "A_VD= 200 # in V/mV\n",
      "A_VD=A_VD*10**3 # in V/V\n",
      "B1=1 # in MHz\n",
      "B1=B1*10**6 # in Hz\n",
      "f1=B1 \n",
      "f0= f1/A_VD # in Hz\n",
      "print \"Cut-off frequency = %0.f Hz\" %f0"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Cut-off frequency = 5 Hz\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.4 - Page No 143\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Given data\n",
      "Vin= 15 # in volt\n",
      "SR= 0.8 # in V/micro sec\n",
      "SR=SR*10**6 # in V/sec\n",
      "omega= SR/Vin \n",
      "f= omega/(2*pi) # in Hz\n",
      "print \"Full power bandwidth = %0.1f kHz\" %(f*10**-3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Full power bandwidth = 8.5 kHz\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.5 - Page No 143\n",
      "    "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "SR= 2 # in V/micro sec\n",
      "del_v_in= 0.5 # in volt\n",
      "del_t=10 #in micro sec\n",
      "del_v_inBYdel_t= del_v_in/del_t # in V/micro sec\n",
      "# v_out= A_CL*v_in\n",
      "A_CL= SR/del_v_inBYdel_t \n",
      "print \"Closed-loop gain = %0.f \" %A_CL"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Closed-loop gain = 40 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.6 - Page No 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Vpp= 3 # in volts\n",
      "del_V= Vpp*(90-10)/100 # in volts\n",
      "del_t= 4 # in micro sec\n",
      "SR_required= del_V/del_t # in V/micro sec\n",
      "print \"The required SR = %0.1f V/micro sec\" %SR_required\n",
      "print \"(i)  The 741 op-amp has an SR of 0.5 volts per micro second. It is too slow so it cannot be used\"\n",
      "print \"(ii) The 318 op-amp has an SR of 50 volts per micro second. It is fast enough and can be used.\"\n",
      "SR= 50 # V/micro sec\n",
      "# Rise time using a 318 op-amp,\n",
      "del_t= del_V/SR # in micro sec \n",
      "del_t= del_t*10**3 # in ns\n",
      "print \"     The reise time using 318 op-amp = %0.f ns\" %del_t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The required SR = 0.6 V/micro sec\n",
        "(i)  The 741 op-amp has an SR of 0.5 volts per micro second. It is too slow so it cannot be used\n",
        "(ii) The 318 op-amp has an SR of 50 volts per micro second. It is fast enough and can be used.\n",
        "     The reise time using 318 op-amp = 48 ns\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 4.7 - Page No 144"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import pi\n",
      "# Given data\n",
      "Vout= 6 # in volts\n",
      "Vin= 20*10**-3 # in V\n",
      "Vrms= 1.414\n",
      "Vout_peak= 6*Vrms # in volts\n",
      "f_max= 15 # in kHz\n",
      "# Required closed loop gain\n",
      "A_CL= Vout/Vin \n",
      "# Required SR\n",
      "SRmax= 2*pi*Vout_peak*f_max # in V/micro sec\n",
      "print \"(i)  The 741 has an SR of 0.5 V/micro sec. It is too slow and would distort the sine wave output.\"\n",
      "print \"(ii) The 318 has an SR of 50 V/micro sec. It is fast enough to develop a 6 Vrms sine wave output at 15 kHz.\"\n",
      "f_1per= 15 # kHz\n",
      "# The gain bandwidth,\n",
      "GBW= 7*A_CL*f_1per # in kHz\n",
      "GBW= GBW*10**-3 # in MHz\n",
      "print \"     The gain bandwidth = %0.1f MHz\" %GBW\n",
      "print \"     The GBW for 318 op-amp is only 15 MHz. So even though the 318 op-amp satisfies the SR requirement but\"\n",
      "print \"     it does not have a large enough GBW to proved a gain of 300 (\u00b11 %) at 15 kHz\"\n",
      "\n",
      "A_CL= 10\n",
      "GBW10= 7*A_CL*f_1per # in kHz\n",
      "GBW10= GBW10*10**-3 # in MHz\n",
      "print \"GBW (Gain of 10) = %0.2f MHz\" %GBW10\n",
      "A_CL= 30\n",
      "GBW30= 7*A_CL*f_1per # in kHz\n",
      "GBW30= GBW30*10**-3 # in MHz\n",
      "print \"GBW (Gain of 30) = %0.2f MHz\" %GBW30\n",
      "print \"The 318 op-amp has a large enough gain bandwidth to operate both amplifiers.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(i)  The 741 has an SR of 0.5 V/micro sec. It is too slow and would distort the sine wave output.\n",
        "(ii) The 318 has an SR of 50 V/micro sec. It is fast enough to develop a 6 Vrms sine wave output at 15 kHz.\n",
        "     The gain bandwidth = 31.5 MHz\n",
        "     The GBW for 318 op-amp is only 15 MHz. So even though the 318 op-amp satisfies the SR requirement but\n",
        "     it does not have a large enough GBW to proved a gain of 300 (\u00b11 %) at 15 kHz\n",
        "GBW (Gain of 10) = 1.05 MHz\n",
        "GBW (Gain of 30) = 3.15 MHz\n",
        "The 318 op-amp has a large enough gain bandwidth to operate both amplifiers.\n"
       ]
      }
     ],
     "prompt_number": 30
    }
   ],
   "metadata": {}
  }
 ]
}