summaryrefslogtreecommitdiff
path: root/Power_Electronics/Power_electronics_ch_12_2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Power_Electronics/Power_electronics_ch_12_2.ipynb')
-rwxr-xr-xPower_Electronics/Power_electronics_ch_12_2.ipynb1030
1 files changed, 1030 insertions, 0 deletions
diff --git a/Power_Electronics/Power_electronics_ch_12_2.ipynb b/Power_Electronics/Power_electronics_ch_12_2.ipynb
new file mode 100755
index 00000000..46f69125
--- /dev/null
+++ b/Power_Electronics/Power_electronics_ch_12_2.ipynb
@@ -0,0 +1,1030 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12: Integrated Citcuits and Operational Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.1, Page No.442"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# dc currents and voltage of differential amplifier\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "Vcc = 12 # collector voltage\n",
+ "Vee = -12 # emitter voltage\n",
+ "Rc = 4.1*10**3 # Collector resistance\n",
+ "Re = 3.8*10**3 # emitter resistance\n",
+ "Vbe = 0.7 # voltage across base-emitter junction\n",
+ "\n",
+ "#Calculations\n",
+ "Ie = (Vcc-Vbe)/Re\n",
+ "Ic = 0.5*Ie\n",
+ "Vo = Vcc-Ic*Rc\n",
+ "\n",
+ "#Result\n",
+ "print(\"Ie = %.4f mA\\nIc = %.3f mA\\nVo = %.1f V\"%(Ie*1000,Ic*1000,Vo))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ie = 2.9737 mA\n",
+ "Ic = 1.487 mA\n",
+ "Vo = 5.9 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.2, Page No.442"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Differential amplifier parameters\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vcc = 12 # collector voltage\n",
+ "Vee = -12 # emitter voltage\n",
+ "Rc = 1*10**6 # Collector resistance\n",
+ "Re = 1*10**6 # emitter resistance\n",
+ "Vbe = 0.7 # voltage across base-emitter junction\n",
+ "vi = 2.1*10**-3 # AC input voltage\n",
+ "beta = 75 \n",
+ "\n",
+ "#Calculations\n",
+ "#(a)\n",
+ "Ie = (Vcc-Vbe)/Re\n",
+ "ie = 0.5*Ie\n",
+ "re = (25*10**-3)/ie\n",
+ "re_dash = 4420.0#value used in the book\n",
+ "#(b)\n",
+ "g = Rc/(2*re_dash)\n",
+ "g = math.floor(g*10)/10\n",
+ "#(c)\n",
+ "vo = g*vi\n",
+ "vo = math.floor(vo*10000)/10000\n",
+ "#(d)\n",
+ "Zi = 2*beta*re\n",
+ "#(e)\n",
+ "cmg = Rc/(re+2*Re)\n",
+ "cmg = math.ceil(cmg*1000)/1000\n",
+ "#(f)\n",
+ "cmrr = g/cmg\n",
+ "#(g)\n",
+ "cmrr_db = 20*math.log10(cmrr)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) re = %d ohm\\n(b) voltage gain for differential input = %.1f\\n(c) AC output voltage = %.4f V\"%(re,g,vo))\n",
+ "print(\"(d) input impedance = %d k-ohm\\n(e) CMRR = %.2f\\n(g) CMRR' = %.1f dB\"%(Zi/1000,cmrr,cmrr_db))\n",
+ "\n",
+ "#Answer for re is wong in the book "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) re = 4424 ohm\n",
+ "(b) voltage gain for differential input = 113.1\n",
+ "(c) AC output voltage = 0.2375 V\n",
+ "(d) input impedance = 663 k-ohm\n",
+ "(e) CMRR = 226.65\n",
+ "(g) CMRR' = 47.1 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.3, Page No. 447"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Op-amp with negative feedback\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ag = 100000.0 # open loop gain of Op-amp\n",
+ "fb = 0.01 # feed back factor\n",
+ "vi = 2*10**-3 # input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "g = Ag/(1+(fb*Ag))\n",
+ "# b\n",
+ "v = vi*g\n",
+ "# c\n",
+ "Ev = v/Ag\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) Closed loop gain = %.1f \\n(b) Output = %.4f V\\n(c) Error voltage = %.3f*10^-6 V\"%(g,v,Ev*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Closed loop gain = 99.9 \n",
+ "(b) Output = 0.1998 V\n",
+ "(c) Error voltage = 1.998*10^-6 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.4, Page No. 447"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Op-amp with negative feedback\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ag = 15000.0 # open loop gain of Op-amp\n",
+ "fb = 0.01 # feed back factor\n",
+ "vi = 2*10**-3 # input voltage\n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "g = Ag/(1+(fb*Ag))\n",
+ "# b\n",
+ "v = vi*g\n",
+ "# c\n",
+ "Ev = v/Ag\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) Closed loop gain = %.3f \\n(b) Output = %.4f V\\n(c) Error voltage = %.3f*10^-5 V\"%(g,v,Ev*10**5))\n",
+ "print(\"\\nComparison conclusion:\\nA decrease in open loop gain causes a corresponding increase in error voltage,\")\n",
+ "print(\"thus keeping the output voltage nearly constant.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Closed loop gain = 99.338 \n",
+ "(b) Output = 0.1987 V\n",
+ "(c) Error voltage = 1.325*10^-5 V\n",
+ "\n",
+ "Comparison conclusion:\n",
+ "A decrease in open loop gain causes a corresponding increase in error voltage,\n",
+ "thus keeping the output voltage nearly constant.\n"
+ ]
+ }
+ ],
+ "prompt_number": 49
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.5, Page No. 448"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# input/output impedances\n",
+ "\n",
+ "import math\n",
+ "#variable declaration\n",
+ "g = 100000.0 # open loop gain\n",
+ "Zi = 2*10**6 # input impedance\n",
+ "Zo = 75 # output impedance\n",
+ "beta = 0.01 # feedback factor\n",
+ "\n",
+ "#Calculations\n",
+ "D = 1+ beta*g\n",
+ "Zi_cl = Zi*D\n",
+ "Zo_cl = Zo/D\n",
+ "\n",
+ "#Result\n",
+ "print(\"Closed loop input impedance = %.0f M-ohm\\nClosed loop output impedance = %.4f ohm\"%(Zi_cl/10**6,Zo_cl))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Closed loop input impedance = 2002 M-ohm\n",
+ "Closed loop output impedance = 0.0749 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.6, Page No.448"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# closed loop gain and disensitivity\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "g = 100000.0 # open loop gain\n",
+ "beta = 0.001 # feedback factor\n",
+ "\n",
+ "#calculations\n",
+ "clg = g/(1+ beta*g)\n",
+ "D = 1+g*beta\n",
+ "\n",
+ "# Result\n",
+ "print(\"Closed loop gain = %.1f \\nDesensitivity = %.0f \"%(clg,D))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Closed loop gain = 990.1 \n",
+ "Desensitivity = 101 \n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.7, Page No.448"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# closed loop gain and upper cut off frequency\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f = 10**6 # unity gain frequency\n",
+ "alg = 100000.0 # open loop gain\n",
+ "b1 = 0.001 # feedback factor in case 1\n",
+ "b2 = 0.01 # feedback factor in case 2\n",
+ "b3 = 0.1 # feedback factor in case 3\n",
+ "\n",
+ "#calculations\n",
+ "# a\n",
+ "f1 = f/alg\n",
+ "# b\n",
+ "g2 = alg/(1+alg*b1)\n",
+ "f2 = f/g2\n",
+ "# c\n",
+ "g3 = alg/(1+alg*b2)\n",
+ "f3 = f/g3\n",
+ "# d\n",
+ "g4 = alg/(1+alg*b3)\n",
+ "f4 = f/g4\n",
+ "\n",
+ "#Result\n",
+ "print(\"Open loop,\\tgain = %.0f \\tf2 = %d Hz\"%(alg,f1))\n",
+ "print(\"Closed loop,\\tgain = %.1f \\tf2 = %d Hz\"%(g2,f2))\n",
+ "print(\"Closed loop,\\tgain = %.1f \\tf2 = %d Hz\"%(g3,f3))\n",
+ "print(\"Closed loop,\\tgain = %.3f \\tf2 = %d Hz\"%(g4,f4))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Open loop,\tgain = 100000 \tf2 = 10 Hz\n",
+ "Closed loop,\tgain = 990.1 \tf2 = 1010 Hz\n",
+ "Closed loop,\tgain = 99.9 \tf2 = 10010 Hz\n",
+ "Closed loop,\tgain = 9.999 \tf2 = 100010 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.8, Page No.449"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Slew rating\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Imax = 10*10**-6 # maximum current\n",
+ "C = 4000*10**-12 # capacitance in pF\n",
+ "\n",
+ "#Calculations\n",
+ "sr = Imax/C\n",
+ "\n",
+ "#Result\n",
+ "print(\"Slew rate = %.1f V/ms\"%(sr/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Slew rate = 2.5 V/ms\n"
+ ]
+ }
+ ],
+ "prompt_number": 63
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.9, Page No. 449"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# slew rate distortion\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "sr = 0.4 # Slew rate\n",
+ "V = 6 # peak value of voltage\n",
+ "f = 10*10**3 # frequency\n",
+ "\n",
+ "#Calculations\n",
+ "slope = 2*math.pi*f*V\n",
+ "\n",
+ "#Result\n",
+ "print(\"Initial slope of sine wave =%.5f V/micro-sec\"%(slope/10**6))\n",
+ "print(\"\\nSince the slew rate of amplifier is %.1f V/micro-sec, there is no slew rate distortion.\"%(sr))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Initial slope of sine wave =0.37699 V/micro-sec\n",
+ "\n",
+ "Since the slew rate of amplifier is 0.4 V/micro-sec, there is no slew rate distortion.\n"
+ ]
+ }
+ ],
+ "prompt_number": 70
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.10, Page No. 449"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Slew rate distortion \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "sr = 0.5*10**6 # slew rate\n",
+ "V = 10 # peak value of input signal\n",
+ "f = 10*10**3 # frequency\n",
+ "\n",
+ "#calculations\n",
+ "# a\n",
+ "slope = 2*math.pi*f*V\n",
+ "# b\n",
+ "Vp = sr/(2*math.pi*f)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) Initial slope of sine wave = %.3f V/micro-sec\"%(slope/10**6))\n",
+ "print(\"Since initial slope is more than the slew rate of amplifier, slew rate distortion will occur.\")\n",
+ "print(\"\\n(b) To eliminate slew rate distortion,\\n Vp = %.2f V\"%Vp)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Initial slope of sine wave = 0.628 V/micro-sec\n",
+ "Since initial slope is more than the slew rate of amplifier, slew rate distortion will occur.\n",
+ "\n",
+ "(b) To eliminate slew rate distortion,\n",
+ " Vp = 7.96 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 72
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.11, Page No.451"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# inverting amplifier\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "A = 100000.0 # open loop gain\n",
+ "Zo = 75.0 # output impedance\n",
+ "f = 1.0*10**6 # unity gain frequency\n",
+ "R1 = 1.0*10**3 # Source Resistance \n",
+ "Rf = 100.0*10**3 # feedback resistance\n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "g = -Rf/R1\n",
+ "# b\n",
+ "beta = R1/(R1+Rf)\n",
+ "D = 1+(A*beta)\n",
+ "# c\n",
+ "f2 = beta*f\n",
+ "# d\n",
+ "Zi_cl = R1\n",
+ "\n",
+ "#result\n",
+ "print(\"(a) Gain = %f\\n(b) disensitivity = %.1f\"%(g,D))\n",
+ "print(\"(c) closed loop upper cut off frequency = %.1f*10^3 Hz\\n(d) closed loop input impedance = %.0f ohm\"%(f2/1000,Zi_cl))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Gain = -100.000000\n",
+ "(b) disensitivity = 991.1\n",
+ "(c) closed loop upper cut off frequency = 9.9*10^3 Hz\n",
+ "(d) closed loop input impedance = 1000 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 79
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.12, Page No. 453"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# closed loop voltage gain, input/output impedance(refering to fig 12.11)\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "R2 = 100.0*10**3 # Resistance R2\n",
+ "R1 = 100.0 # Resistance R1\n",
+ "A = 100000.0 # open loop gain\n",
+ "Zin = 2*10**6 # input impedance\n",
+ "Zo = 75 # output impedance\n",
+ "\n",
+ "# Calculations\n",
+ "g = (R1+R2)/R1\n",
+ "beta = R1/(R1+R2)\n",
+ "Zi_dash = (1+A*beta)*Zin\n",
+ "Zo_dash = Zo/(1+A*beta)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Closed loop gain = %.0f \\nClosed loop input impedance = %.1f M-ohm\\nClosed loop output impedance = %.3f ohm\"%(g,Zi_dash/10**6,Zo_dash))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Closed loop gain = 1001 \n",
+ "Closed loop input impedance = 201.8 M-ohm\n",
+ "Closed loop output impedance = 0.743 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 84
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.13, Page No.454"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Op-amp parameters(refering to fig. 12.13)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "A = 100000.0 # open loop gain\n",
+ "f = 1.0*10**6 # unity gain frequency\n",
+ "R3 = 150 *10**3 # Resistance R3\n",
+ "Ci = 1*10**-6 # inpuut capacitor\n",
+ "R2 = 100*10**3 # Resistance R2\n",
+ "Cb = 1*10**-6 # Bias capacitor\n",
+ "R1 = 1.0*10**3 # Resistance R1\n",
+ "Co = 1*10**-6 # output capacitance\n",
+ "Rl = 15*10**3 # load resistance\n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "A = (R1+R2)/R1\n",
+ "# b\n",
+ "beta = 1/A\n",
+ "f2 = f/A\n",
+ "# c\n",
+ "fc1 = 1/(2*math.pi*Ci*R3)\n",
+ "fc2 = 1/(2*math.pi*Cb*Rl)\n",
+ "fc3 = 1/(2*math.pi*Co*R1)\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) Avf = %.0f \\n\\n(b) f2' =%.1f*10^3 Hz\"%(A,f2/1000))\n",
+ "print(\"\\n(c) The critical frequencies are,\\n fc = %.3f Hz\\n fc = %.2f Hz\\n fc = %.2f Hz\"%(fc1,fc2,fc3))\n",
+ "print(\"\\n(d) Evidently the lower cut off frequency is the highest of the above three critical frequencies, i.e. %.2f Hz\"%fc3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Avf = 101 \n",
+ "\n",
+ "(b) f2' =9.9*10^3 Hz\n",
+ "\n",
+ "(c) The critical frequencies are,\n",
+ " fc = 1.061 Hz\n",
+ " fc = 10.61 Hz\n",
+ " fc = 159.15 Hz\n",
+ "\n",
+ "(d) Evidently the lower cut off frequency is the highest of the above three critical frequencies, i.e. 159.15 Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 93
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.14, Page No.455"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage(referring fig.12.14)\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "v1 = 0.5 # input voltage 1\n",
+ "v2 = 1.5 # input voltage 2\n",
+ "v3 = 0.2 # input voltage 3\n",
+ "R1 = 10.0*10**3 # resistance R1\n",
+ "R2 = 10.0*10**3 # resistance R2\n",
+ "R3 = 10.0*10**3 # resistance R3\n",
+ "Rf = 50.0*10**3 # feedback resistance\n",
+ "\n",
+ "#Calculations\n",
+ "vo = -Rf*((v1/R1)+(v2/R2)+(v3/R3))\n",
+ "\n",
+ "#Result\n",
+ "print(\"Output Voltage = %.0f V\"%vo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Output Voltage = -11 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 95
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.15, Page No.455"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 96
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.16, Page No.456"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 97
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.17, Page No. 457"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# difference amplifier(referring fig. 12.18)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1 = 50.0*10**3 # Resistance R1\n",
+ "R2 = 10.0*10**3 # Resistance R2\n",
+ "Vs1 = 4.5 # input voltage at channel 1\n",
+ "Vs2 = 5.0 # input voltage at channel 2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "vo = R1*(Vs2-Vs1)/R2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Output voltage = %.1f V\"%vo)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Output voltage = 2.5 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 99
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.18, Page No.458"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# CMRR in dB\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "A = 50.0 # gain of difference amplifier\n",
+ "v = 2.0 # input voltage\n",
+ "vo = 5.0*10**-3 # output voltage \n",
+ "\n",
+ "#Calculations\n",
+ "Vcom = 0.5*(v+v)\n",
+ "Acom = vo/Vcom\n",
+ "cmrr = A/Acom\n",
+ "cmrr = 20*math.log10(cmrr)\n",
+ "\n",
+ "#Result\n",
+ "print(\"CMRR = %.2f dB\"%(cmrr))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "CMRR = 86.02 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 101
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.19, Page No.458"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical Example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical Example\n"
+ ]
+ }
+ ],
+ "prompt_number": 102
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.20, Page No.459"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical Example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical Example\n"
+ ]
+ }
+ ],
+ "prompt_number": 103
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.21, Page No.466"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# two pole high pass filter(referring fig. 12.32)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "R1 = 10.0*10**3 # Resistance R1\n",
+ "R2 = 5.6*10**3 # Resistance R2\n",
+ "R = 1.0*10**3 # Resistance R\n",
+ "C = 0.01 *10**-6 # capacitance \n",
+ "vi = 1.6*10**-3 # input voltage \n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "A = 1+(R2/R1)\n",
+ "# b\n",
+ "vo = A*vi\n",
+ "# c\n",
+ "pi = math.ceil(math.pi*10000)/10000\n",
+ "fc = 1/(2*pi*R*C)\n",
+ "# d\n",
+ "gain = 0.707*A\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) midband gain = %.2f\\n(b) output voltage = %.3f mV\\n(c) fc = %.2f Hz\\n(d) Gain = %.3f\"%(A,vo*1000,fc,gain))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) midband gain = 1.56\n",
+ "(b) output voltage = 2.496 mV\n",
+ "(c) fc = 15915.46 Hz\n",
+ "(d) Gain = 1.103\n"
+ ]
+ }
+ ],
+ "prompt_number": 112
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.22, Page No. 466"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Low pass filter(referring fig. 12.30)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "vi = 1.1*10**-3 # input voltage\n",
+ "R = 10*10**3 # Resistance\n",
+ "C = 0.001*10**-6 # Capacitance\n",
+ "R1 = 10*10**3 # Resistance R1\n",
+ "R2 = 5.6*10**3 # Resistance R2\n",
+ "\n",
+ "#Calculations\n",
+ "# a\n",
+ "A = (R1+R2)/R1\n",
+ "vo1 = A*vi\n",
+ "# b\n",
+ "fc = 1/(2*math.pi*R*C)\n",
+ "# c\n",
+ "vo = 0.707*vo1\n",
+ "\n",
+ "#Result\n",
+ "print(\"(a) Avf = %.2f\\n Vo = %.3f*10^-3 V\\n(b) fc = %.3f*10^3 Hz\\n(c) at f = fc,\\nVo = %.3f* 10^-3 V\"%(A,vo1*1000,fc/1000,vo*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Avf = 1.56\n",
+ " Vo = 1.716*10^-3 V\n",
+ "(b) fc = 15.915*10^3 Hz\n",
+ "(c) at f = fc,\n",
+ "Vo = 1.213* 10^-3 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 12.23, Page No.466"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file