summaryrefslogtreecommitdiff
path: root/sample_notebooks/karansingh/Ch4.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'sample_notebooks/karansingh/Ch4.ipynb')
-rw-r--r--sample_notebooks/karansingh/Ch4.ipynb397
1 files changed, 397 insertions, 0 deletions
diff --git a/sample_notebooks/karansingh/Ch4.ipynb b/sample_notebooks/karansingh/Ch4.ipynb
new file mode 100644
index 00000000..5c8ea38c
--- /dev/null
+++ b/sample_notebooks/karansingh/Ch4.ipynb
@@ -0,0 +1,397 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:31068ba7d72c538c2034ff141729c374b5adab63db5f8b55f3d177e0fb459ae4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4:Operational Amplifier"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.1 : Page 245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# For an op-amp circuit find a) closed loop gain Acl b) input impedance Zin c) output impedance Zo\n",
+ "\n",
+ "from __future__ import division\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 = ',ACL,' ' # 1/beta = ACL\n",
+ "beta = (1/ACL) \n",
+ "\n",
+ "# b) the input impedance Zin\n",
+ "Zin = R1 \n",
+ "print ' the input impedance Zin = ',Zin,' ohm ' \n",
+ "\n",
+ "# c0 the output impedance Z0\n",
+ "Z0 = (ro)/(1+(beta*A)) \n",
+ "print ' the output impedance Z0 = %0.3f'%Z0,' ohm ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " closed loop gain of an op-amp is = 35.0 \n",
+ " the input impedance Zin = 10000 ohm \n",
+ " the output impedance Z0 = 0.020 ohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.2 : Page 245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determine the differece voltage and open loop gain of an op-amp\n",
+ " \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 = ',Vd,' V ' \n",
+ "\n",
+ "# open loop gain \n",
+ "A = (Vo/Vd) \n",
+ "print ' The open loop gain is = ',A,' ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The difference voltage is = 10 V \n",
+ " The open loop gain is = 2.0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.3 : Page 246"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determine the differece voltage and open loop gain of an op-amp\n",
+ " \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 = ',Vd,' V ' \n",
+ "\n",
+ "# open loop gain \n",
+ "A = (Vo/Vd) \n",
+ "print ' The open loop gain is = ',A,' ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The difference voltage is = 5 V \n",
+ " The open loop gain is = 4.0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.4 : Page 247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determine the differece voltage and open loop gain of an op-amp\n",
+ " \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 = ',Vd,' V ' \n",
+ "\n",
+ "# open loop gain \n",
+ "A = (Vo/Vd) \n",
+ "print ' The open loop gain is = ',A,' ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The difference voltage is = 5 V \n",
+ " The open loop gain is = 4.0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.5 : Page 247"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Determine the differece voltage and open loop gain of an op-amp\n",
+ " \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 = ',Vd,' V ' \n",
+ "\n",
+ "# open loop gain \n",
+ "A = (Vo/Vd) \n",
+ "print ' The open loop gain is = ',A,' ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The difference voltage is = -10 V \n",
+ " The open loop gain is = 2.0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.6 : Page 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 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 = ',Ac,' ' \n",
+ "Ac = abs(Ac) \n",
+ "print 'The |Ac| Closed loop gain of an inverting op-amp is = ',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 = ',Vo,' V ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Closed loop gain of an inverting op-amp is = -2.5 \n",
+ "The |Ac| Closed loop gain of an inverting op-amp is = 2.5 \n",
+ "The output voltage of an inverting op-amp is = -25.0 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.7 : Page 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 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 = ',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 = ',Vo,' V ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Closed loop gain of an non-inverting op-amp is = 3.5 \n",
+ "The output voltage of an non-inverting op-amp is = 35.0 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.8 : Page 249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 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 = ',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= ',Vo,' V ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The closed loop gain of differntial op-amp is = 2.5 \n",
+ "The output voltage of an non-inverting op-amp is= 50.0 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 4.9 : Page 249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# 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.3f'%V,' V ' \n",
+ "\n",
+ "# Lower voltage\n",
+ "V = (R1/(R1+R2)*Vol) \n",
+ "print ' The lower voltage is = %0.3f'%V,' V ' "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " The upper voltage is = 2.857 V \n",
+ " The lower voltage is = -2.857 V \n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file