{ "metadata": { "name": "", "signature": "sha256:a753b8fe0eef12e4693a9f55407a90702bc2bbc9eb7b04a290c07424ac34ac87" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Chapter 18: Operational amplifiers

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 1, page no. 279

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Vi2 = 2.45;# in Volts\n", "Vi1 = 2.35;# in Volts\n", "A0 = 120;# open-loop voltage gain\n", "\n", "#calculation:\n", "Vo = A0*(Vi2 - Vi1)\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n the output voltage is \",round(Vo,2),\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " the output voltage is 12.0 V" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 2, page no. 281

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Vg = 150E3;# differential voltage gain \n", "CMRR = 90;# in dB\n", "\n", "#calculation:\n", "CMG = Vg/(10**(CMRR/20))\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n common-mode gain is \",round(CMG,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " common-mode gain is 4.74" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 3, page no. 282

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Vg = 120;# differential voltage gain \n", "Vi = 3;# in Volts\n", "Vo = 0.024;# in Volts\n", "\n", "#calculation:\n", "CMG = Vo/Vi\n", "CMRR = 20*(1/2.303)*math.log(Vg/CMG)\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n common-mode gain is \",round(CMG,3),\" and CMRR is \",round(CMRR,2),\" dB\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " common-mode gain is 0.008 and CMRR is 83.51 dB" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 4, page no. 283

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Rf = 2000;# in ohms\n", "Ri = 1000;# in ohms\n", "Vi1 = 0.4;# in Volts\n", "Vi2 = -1.2;# in Volts\n", "\n", "#calculation:\n", "Vo1 = -1*Rf*Vi1/Ri\n", "Vo2 = -1*Rf*Vi2/Ri\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n output voltage when the input voltage is 0.4V is \",round(Vo1,2),\" V \"\n", "print \" and when the input voltage is -1.2V is \",round(Vo2,2),\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " output voltage when the input voltage is 0.4V is -0.8 V \n", " and when the input voltage is -1.2V is 2.4 V\n" ] } ], "prompt_number": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 5, page no. 283

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Ii = 100E-9;# in Amperes\n", "T = 20;# in \u00b0C\n", "Rf = 1E6;# in ohms\n", "Ri = 10000;# in ohms\n", "\n", "#calculation:\n", "A = -1*Rf/Ri\n", "Vos = Ii*Ri*Rf/(Ri+Rf)\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n (a)the voltage gain is \",round(A,2),\"\"\n", "print \"\\n (b)output offset voltage is \",round(Vos*1000,2),\" mV\"\n", "print \"\\n (c)The effect of input bias current can be minimised by ensuring \"\n", "print \"that both inputs have the same driving resistance.\" \n", "print \"This means that a resistance of value of 9.9 kohm (from part (b)) \"\n", "print \"should be placed between the non-inverting (+) terminal and earth.\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " (a)the voltage gain is -100.0 \n", "\n", " (b)output offset voltage is 0.99 mV\n", "\n", " (c)The effect of input bias current can be minimised by ensuring \n", "that both inputs have the same driving resistance.\n", "This means that a resistance of value of 9.9 kohm (from part (b)) \n", "should be placed between the non-inverting (+) terminal and earth.\n" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 6, page no. 284

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Vg = 40;# in dB\n", "bf = 5000;# in Hz\n", "Ri = 10000;# in ohms\n", "\n", "#calculation:\n", "A = 10**(Vg/20)\n", "Rf = A*Ri\n", "f = A*bf\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n the voltage gain is \",round(A,2),\", Rf = \",round(Rf/1000,2),\"kohm and frequency = \",round(f/1000,2),\" kHz\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " the voltage gain is 100.0 , Rf = 1000.0 kohm and frequency = 500.0 kHz" ] } ], "prompt_number": 6 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 7, page no. 286

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "Vi = -0.4;# in Volts\n", "R1 = 4700;# in ohms\n", "R2 = 10000;# in ohms\n", "\n", "#calculation:\n", "A = 1 + (R2/R1)\n", "Vo = A*Vi\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n(a) the voltage gain is \",round(A,2),\"\"\n", "print \"\\n(b) output voltageis \",round(Vo,2),\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", "(a) the voltage gain is 3.13 \n", "\n", "(b) output voltageis -1.25 V" ] } ], "prompt_number": 7 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 8, page no. 287

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "V1 = 0.5;# in Volts\n", "V2 = 0.8;# in Volts\n", "V3 = 1.2;# in Volts\n", "R1 = 10000;# in ohms\n", "R2 = 20000;# in ohms\n", "R3 = 30000;# in ohms\n", "Rf = 50000;# in ohms\n", "\n", "#calculation:\n", "Vo = -1*Rf*(V1/R1 + V2/R2 + V3/R3)\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n output voltageis \",round(Vo,2),\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " output voltageis -6.5 V" ] } ], "prompt_number": 8 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 10, page no. 289

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from __future__ import division\n", "import math\n", "from scipy import integrate\n", "#initializing the variables:\n", "Vs = -0.75;# in Volts\n", "R = 200000;# in ohms\n", "C = 2.5E-6;# in Farads\n", "t = 0.1;# in secs\n", "\n", "#calculation:\n", "f = lambda x,a : a*1\n", "y, err = integrate.quad(f, 0, 0.1, args=(-0.75,))\n", "Vo = (-1/(C*R))*y\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n output voltage is \",Vo,\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " output voltage is 0.15 V" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Example 11, page no. 290

" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "from __future__ import division\n", "import math\n", "#initializing the variables:\n", "V1a = 0.005;# in Volts\n", "V2a = 0;# in Volts\n", "V1b = 0;# in Volts\n", "V2b = 0.005;# in Volts\n", "V1c = 0.05;# in Volts\n", "V2c = 0.025;# in Volts\n", "V1d = 0.025;# in Volts\n", "V2d = 0.05;# in Volts\n", "R1 = 10000;# in ohms\n", "R2 = 10000;# in ohms\n", "R3 = 100000;# in ohms\n", "Rf = 100000;# in ohms\n", "\n", "#calculation:\n", "Vo1 = -1*Rf*V1a/R1\n", "Vo2 = (R3/(R2+R3))*(1 + (Rf/R1))*V2b\n", "Vo3 = -1*Rf*(V1c-V2c)/R1\n", "Vo4 = (R3/(R2+R3))*(1 + (Rf/R1))*(V2d-V1d)\n", "\n", "\n", "#Results\n", "print \"\\n\\n Result \\n\\n\"\n", "print \"\\n (a)output voltage is \",round(Vo1,2),\" V\"\n", "print \"\\n (b)output voltage is \",round(Vo2,2),\" V\"\n", "print \"\\n (c)output voltage is \",round(Vo3,2),\" V\"\n", "print \"\\n (d)output voltage is \",round(Vo4,2),\" V\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "\n", "\n", " Result \n", "\n", "\n", "\n", " (a)output voltage is -0.05 V\n", "\n", " (b)output voltage is 0.05 V\n", "\n", " (c)output voltage is -0.25 V\n", "\n", " (d)output voltage is 0.25 V" ] } ], "prompt_number": 10 } ], "metadata": {} } ] }