{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 4 Operational Amplifier" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.1 Pg 79" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " closed loop gain of an op-amp is = 35.00\n", " the input impedance Zin = 10.00 kohm \n", " the output impedance Z0 = 0.020 ohm \n" ] } ], "source": [ "from __future__ import division\n", "# For an op-amp circuit find a) closed loop gain Acl b) input impedance Zin c) output impedance Zo\n", "ro = 85 # # ohm\n", "A = 150*10**3 # # ohm\n", "R2 = 350*10**3 # # ohm # Feedback resistance\n", "R1 = 10*10**3 # # ohm # Input resistance\n", "\n", "# a) closed loop gain\n", "# ACL = abs(Vo/Vin) = abs(R2/R1)\n", "ACL = abs(R2/R1) #\n", "print ' closed loop gain of an op-amp is = %0.2f'%ACL# # 1/beta = ACL\n", "beta = (1/ACL) #\n", "\n", "# b) the input impedance Zin\n", "Zin = R1 #\n", "print ' the input impedance Zin = %0.2f'%(Zin/1e3),'kohm '#\n", "\n", "# c0 the output impedance Z0\n", "Z0 = (ro)/(1+(beta*A))#\n", "print ' the output impedance Z0 = %0.3f'%Z0,' ohm '#" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.2 Pg 80" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The difference voltage is = 10.00 V \n", " The open loop gain is = 2.00 \n" ] } ], "source": [ "# Determine the differece voltage and open loop gain of an op-amp\n", "V1 = -5 # # volt # input voltage\n", "V2 = 5 # # volt\n", "Vo = 20 # #volt # output voltage\n", "\n", "# the difference voltage is given by \n", "Vd = V2-V1 #\n", "print ' The difference voltage is = %0.2f'%Vd,' V '\n", "\n", "# open loop gain \n", "A = (Vo/Vd)#\n", "print ' The open loop gain is = %0.2f'%A,' '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.3 Pg 80" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The difference voltage is = 5.00 V \n", " The open loop gain is = 4.00 \n" ] } ], "source": [ "# Determine the differece voltage and open loop gain of an op-amp\n", "V1 = -5 # # volt # input voltage\n", "V2 = 0 # # volt # GND\n", "Vo = 20 # #volt # output voltage\n", "\n", "# the difference voltage is given by \n", "Vd = V2-V1 #\n", "print ' The difference voltage is = %0.2f'%Vd,' V '\n", "\n", "# open loop gain \n", "A = (Vo/Vd)#\n", "print ' The open loop gain is = %0.2f'%A,' '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.4 Pg 81" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The difference voltage is = 5.00 V \n", " The open loop gain is = 4.00 \n" ] } ], "source": [ "# Determine the differece voltage and open loop gain of an op-amp\n", "V1 = 0 # # volt # input voltage # GND\n", "V2 = 5 # # volt \n", "Vo = 20 # #volt # output voltage\n", "\n", "# the difference voltage is given by \n", "Vd = V2-V1 #\n", "print ' The difference voltage is = %0.2f'%Vd,' V '\n", "\n", "# open loop gain \n", "A = (Vo/Vd)#\n", "print ' The open loop gain is = %0.2f'%A,' '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.5 Pg 81" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The difference voltage is = -10.00 V \n", " The open loop gain is = 2.00 \n" ] } ], "source": [ "# Determine the differece voltage and open loop gain of an op-amp\n", "V1 = 5 # # volt # input voltage # GND\n", "V2 = -5 # # volt \n", "Vo = -20 # #volt # output voltage\n", "\n", "# the difference voltage is given by \n", "Vd = V2-V1 #\n", "print ' The difference voltage is = %0.2f'%Vd,' V '\n", "\n", "# open loop gain \n", "A = (Vo/Vd)#\n", "print ' The open loop gain is = %0.2f'%A,' '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.6 Pg 82" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The Closed loop gain of an inverting op-amp is = -2.50 \n", "The |Ac| Closed loop gain of an inverting op-amp is = 2.50 \n", "The output voltage of an inverting op-amp is = -25.00 V \n" ] } ], "source": [ "from __future__ import division\n", "# To find closed loop gain and output voltage Vo of an inverting op-amp\n", "R1 = 10 # #kilo ohm # input resistance\n", "R2 = 25 # # kilo ohm # feedback resistance\n", "Vin = 10 # #volt # input voltage\n", "\n", "# Closed loop gain of an inverting op-amp\n", "Ac = -(R2/R1) #\n", "print 'The Closed loop gain of an inverting op-amp is = %0.2f'%Ac,' '\n", "Ac = abs(Ac)#\n", "print 'The |Ac| Closed loop gain of an inverting op-amp is = %0.2f'%Ac,' '\n", "\n", "# the output voltage of an inverting op-amp\n", "Vo = -(R2/R1)*Vin #\n", "print 'The output voltage of an inverting op-amp is = %0.2f'%Vo,' V '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.7 Pg 82" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The Closed loop gain of an non-inverting op-amp is = 3.50 \n", " The output voltage of an non-inverting op-amp is = 35.00 V \n" ] } ], "source": [ "# To find closed loop gain and output voltage Vo of an non-inverting op-amp\n", "R1 = 10 # #kilo ohm # input resistance\n", "R2 = 25 # # kilo ohm # feedback resistance\n", "Vin = 10 # #volt # input voltage\n", "\n", "# Closed loop gain of an non-inverting op-amp\n", "Ac = 1+(R2/R1) #\n", "Ac = abs(Ac)#\n", "print ' The Closed loop gain of an non-inverting op-amp is = %0.2f'%Ac,' '\n", "\n", "# the output voltage of an inverting op-amp\n", "Vo = (1+R2/R1)*Vin #\n", "print ' The output voltage of an non-inverting op-amp is = %0.2f'%Vo,' V '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.8 Pg 83" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The closed loop gain of differntial op-amp is = 2.50 \n", "The output voltage of an non-inverting op-amp is= 50.00 V \n" ] } ], "source": [ "# to find out closed loop gain and output voltage Vo\n", "R1 = 10 # #kilo ohm # input resistance\n", "R3 = 10 # #kilo ohm # input resistance\n", "R2 = 25 # # kilo ohm # feedback resistance\n", "R4 = 25 # # kilo ohm # feedback resistance\n", "Vin2 = 10 # #volt # input voltage\n", "Vin1 = -10 # #volt # input voltage\n", "\n", "# closed loop gain of differntial op-amp is given by\n", "Ac = (R2/R1) #\n", "Ac = abs(Ac)# \n", "print 'The closed loop gain of differntial op-amp is = %0.2f'%Ac,' '\n", "\n", "# the output voltage of an non-inverting op-amp is given by\n", "Vo = (R2/R1)*(Vin2-Vin1) #\n", "print 'The output voltage of an non-inverting op-amp is= %0.2f'%Vo,' V '" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 4.9 Pg 84" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " The upper voltage is = 2.86 V \n", " The lower voltage is = -2.86 V \n" ] } ], "source": [ "# Determine the non-inverting input voltage\n", "R1 = 10 # #kilo ohm # input resistance\n", "R2 = 25 # #kilo ohm # feedback resistance\n", "Voh = 10 # # volt #output voltage\n", "Vol = -10 # # volt # output voltage\n", "\n", "# upper voltage\n", "V = (R1/(R1+R2)*Voh) #\n", "print ' The upper voltage is = %0.2f'%V,' V '\n", "\n", "# Lower voltage\n", "V = (R1/(R1+R2)*Vol) #\n", "print ' The lower voltage is = %0.2f'%V,' V '" ] } ], "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 }