{

 "metadata": {

  "name": "",

  "signature": "sha256:80346364d9467878bde7610e6e58f2864052653b0338be581053adfe2d70b16b"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter5: Non-Linear Applications of IC OP-AMPs"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.1:pg-283"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.1\n",

      "\n",

      "\n",

      "R1=100.0;#kohm\n",

      "R2=86.0;#kohm\n",

      "Vsat=15.0;#V\n",

      "VUT=R2/(R1+R2)*Vsat;#V\n",

      "VLT=R2/(R1+R2)*-Vsat;#V\n",

      "print round(VUT,2),\"=VUT(V) \"\n",

      "print round(VLT,2),\"=VLT(V) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "6.94 =VUT(V) \n",

        "-6.94 =VLT(V) \n"

       ]

      }

     ],

     "prompt_number": 6

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.2:pg-283"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.2\n",

      "\n",

      "Rf=100;#kohm\n",

      "C=0.1;#micro F\n",

      "T=2*Rf*1000*C*10**-6;#s\n",

      "print T*10**3,\"Time period(ms)\"\n",

      "f=1/T;#Hz\n",

      "print f,\"Frequency(Hz) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "20.0 Time period(ms)\n",

        "50.0 Frequency(Hz) \n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.3:pg-287"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.3\n",

      "\n",

      "R=100.0;#kohm\n",

      "C=0.01;#micro F\n",

      "f=1/(2*R*10**3*C*10**-6);#Hz\n",

      "print f,\"Frequency(Hz) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "500.0 Frequency(Hz) \n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.4:pg-287"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.4\n",

      "\n",

      "f=1*1000.0;#HZ\n",

      "Vs=15.0;#V\n",

      "C=0.1;#micro F(Assumed)\n",

      "R=1.0/(2*f*C*10**-6);#Hz\n",

      "print \"For the required design value of R(kohm)  \",R/1000.0\n",

      "print \"R1 & R2 can be choosen as 10 kohm\"\n",

      "#/Answer in the book is wrong\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "For the required design value of R(kohm)   5.0\n",

        "R1 & R2 can be choosen as 10 kohm\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.5:pg-293"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.5\n",

      "\n",

      "Vo=0.7;#V\n",

      "Vsat=12.0;#V\n",

      "R1=10.0;#kohm\n",

      "R2=60.0;#kohm\n",

      "Vth=R1/(R1+R2)*Vo;#V\n",

      "iDmax=(Vsat-Vo)/R1-Vo/(R1+R2);#mA\n",

      "print iDmax,\": Maximum current(mA) \"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "1.12 : Maximum current(mA) \n"

       ]

      }

     ],

     "prompt_number": 15

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.7:pg-294"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.7\n",

      "\n",

      "\n",

      "R1=10.0;#kohm\n",

      "R2=16.0;#kohm\n",

      "C=10.0;#nF\n",

      "R=62.0;#kohm\n",

      "Beta=R1/(R1+R2);#unitless\n",

      "T=2*R*1000.0*C*10**-9*math.log((1+Beta)/(1-Beta));#seconds\n",

      "f=1.0/T;#Hz\n",

      "print round(f,1),\": Frequency of oscillations(Hz) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "994.5 : Frequency of oscillations(Hz) \n"

       ]

      }

     ],

     "prompt_number": 17

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex:5.8:pg-295"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.8\n",

      "\n",

      "\n",

      "#vo/v1=1+R2/R1;#\n",

      "#For v2/v1 i.e. gain=2, R1 & R2 should be equal\n",

      "Vpp=10.0;#V\n",

      "R1=10.0;#kohm\n",

      "R2=10.0;#kohm\n",

      "#Avg=1/T*integrate('Vpp*math.sin(2*%pi*t/T)','t',0,T/2);\n",

      "Avg=-Vpp/(2*math.pi)*(math.cos(math.pi)-math.cos(0));\n",

      "print round(Avg,2),\": Average output voltage(V) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "3.18 : Average output voltage(V) \n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.9:pg-296"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.9\n",

      "\n",

      "\n",

      "#vo/v1=-2;#Gain for -ve inputs\n",

      "voBYvi=-2;#Gain for -ve inputs\n",

      "#vo/v1=0;#Gain for non -ve inputs\n",

      "Rin=100;#kohm\n",

      "R1=100;#kohm(R1=Rin)\n",

      "R2=-R1*voBYvi;#kohm\n",

      "print R1,\"and\",R2,\"are Values of R1 & R2(kohm) \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "100 and 200 are Values of R1 & R2(kohm) \n"

       ]

      }

     ],

     "prompt_number": 27

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.11:pg-298"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.11\n",

      "\n",

      "\n",

      "f0=1.5;#kHz\n",

      "Vopp=6;#V\n",

      "Vsat=13.5;#V\n",

      "#Let R2=10kohm\n",

      "R2=10;#kohm\n",

      "R3=R2*2*Vsat/Vopp;#kohm\n",

      "#Let C1=0.05 micro F\n",

      "C1=0.05;#micro F\n",

      "R1=R3/(4*f0*1000*R2*1000*C1*10**-6);#kohm\n",

      "print R1,\",\",R2,\",\",R3,\"are Values of R1, R2 & R3(kohm) \"\n",

      "print C1,\": Value of C1(micro F)\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "15.0 , 10 , 45.0 are Values of R1, R2 & R3(kohm) \n",

        "0.05 : Value of C1(micro F)\n"

       ]

      }

     ],

     "prompt_number": 29

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex5.12:pg-299"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "#Ex 5.12\n",

      "\n",

      "\n",

      "tau=1;#ms\n",

      "#R1/R2=1.8:9;given range\n",

      "#Let R1/R2=1.8\n",

      "R1BYR2=1.8;#ratio\n",

      "Beta1=1.0/(R1BYR2+1);\n",

      "R1BYR2=9.0;#ratio\n",

      "Beta2=1.0/(R1BYR2+1);#unitless\n",

      "#For fmin\n",

      "Tmax=2.0*math.log((1+Beta1)/(1-Beta1));#ms\n",

      "fmin=1000.0/Tmax;#Hz\n",

      "#For fmax\n",

      "Tmin=2*math.log((1+Beta2)/(1-Beta2));#ms\n",

      "fmax=1/Tmin;#kHz\n",

      "print \"Frequency range is \",round(fmin),\" Hz to \",round(fmax,1),\" kHz\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Frequency range is  669.0  Hz to  2.5  kHz\n"

       ]

      }

     ],

     "prompt_number": 34

    }

   ],

   "metadata": {}

  }

 ]

}