summaryrefslogtreecommitdiff
path: root/Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb
diff options
context:
space:
mode:
authorhardythe12015-05-05 14:21:39 +0530
committerhardythe12015-05-05 14:21:39 +0530
commitfba055ce5aa0955e22bac2413c33493b10ae6532 (patch)
treebe70ef4fccd07c9c88de778014219201b4ea971f /Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb
parent67068710030ddd6b6c809518c34af2e04e0bf7ca (diff)
downloadPython-Textbook-Companions-fba055ce5aa0955e22bac2413c33493b10ae6532.tar.gz
Python-Textbook-Companions-fba055ce5aa0955e22bac2413c33493b10ae6532.tar.bz2
Python-Textbook-Companions-fba055ce5aa0955e22bac2413c33493b10ae6532.zip
add books
Diffstat (limited to 'Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb')
-rwxr-xr-xOp-amp_and_linear_integrated_circuits_/Chapter_1.ipynb1301
1 files changed, 1301 insertions, 0 deletions
diff --git a/Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb b/Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb
new file mode 100755
index 00000000..4ab2c3b1
--- /dev/null
+++ b/Op-amp_and_linear_integrated_circuits_/Chapter_1.ipynb
@@ -0,0 +1,1301 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 1: Introduction to Differential Amplifier and Op-amp"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.1, Page No. 4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# output voltage of differential amplifier\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "v1 = 300*10**-6 # voltage at terminal 1\n",
+ "v2 = 240*10**-6 # voltage at terminal 2\n",
+ "Aid = 5000.0 # differential gain of amplifier \n",
+ "cmmr1 = 100 # CMMR for case 1\n",
+ "cmmr2 = 10**5 # CMMR for case 2\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "# case 1\n",
+ "Vid = v1-v2\n",
+ "Vcm = (v1+v2)/2\n",
+ "Acm = Aid/cmmr1\n",
+ "Vout = Aid*Vid+Acm*Vcm\n",
+ "Vout = Vout*1000 # mV\n",
+ "\n",
+ "# case 2\n",
+ "Acm2 = Aid/cmmr2\n",
+ "Vout2 = Aid*Vid+Acm2*Vcm\n",
+ "Vout2 = Vout2*1000 # mV\n",
+ "\n",
+ "Vout_ideal = Aid*Vid*1000 # mV\n",
+ "#Result\n",
+ "print(\"(i) CMMR = %d:\\nVout = %.1f mV\\n\\n(ii) CMMR = %d:\\nVout = %.4f mV\\n\\nIdeal Vout = %.0f mV\"%(cmmr1,Vout,cmmr2,Vout2,Vout_ideal))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) CMMR = 100:\n",
+ "Vout = 313.5 mV\n",
+ "\n",
+ "(ii) CMMR = 100000:\n",
+ "Vout = 300.0135 mV\n",
+ "\n",
+ "Ideal Vout = 300 mV\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.2, Page No.9"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Operating point values\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rc = 4.7*10**3 # collector resistor\n",
+ "Re = 3.3*10**3 # emitter resistor\n",
+ "Vcc = 12 # + supply voltage\n",
+ "Vee = -12 # - supply voltage\n",
+ "Vbe = 0.7 # base-emitter junction voltage\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Ie = (Vcc-Vbe)/(2*Re)\n",
+ "Ic = Ie\n",
+ "Vce = Vcc+Vbe-(Ic*Rc) \n",
+ "\n",
+ "#Result\n",
+ "print(\"Q point is (%.3f mA, %.3f V)\"%(Ic*1000,Vce))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q point is (1.712 mA, 4.653 V)\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.3, Page No. 14"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# differential amplifier parameters(refer fig. 1.14)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "hie = 2.8*10**3 # input impedance\n",
+ "Rc = 4.7*10**3 # collector resistance\n",
+ "Vcc = 15 # supply voltage\n",
+ "hfe = 100 # transistor current gain\n",
+ "Re = 6.8*10**3 # emitter resistance\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "Rin = 100 # input resistance\n",
+ "v1 = 70*10**-3 # input voltage 1\n",
+ "v2 = 40*10**-3 # input voltage 2\n",
+ "\n",
+ "# Calculations\n",
+ "# Operating point values\n",
+ "Ie = Ic = (Vcc-Vbe)/( (2*Re) + (Rin/hfe))\n",
+ "Vce = Vcc+Vbe-Ic*Rc\n",
+ "# Differential gain\n",
+ "Aid = (hfe*Rc)/(Rin+hie)\n",
+ "Aid = math.floor(Aid*1000)/1000\n",
+ "#Common mode gain\n",
+ "Acm = hfe*Rc/(2*Re*(1+hfe)+Rin+hie)\n",
+ "#CMMR\n",
+ "CMMR = 20*math.log10(Aid/Acm)\n",
+ "CMMR = math.floor(CMMR*1000)/1000\n",
+ "#output voltage\n",
+ "Vid = v1-v2\n",
+ "Vcm = (v1+v2)/2\n",
+ "Vout = Aid*Vid+Acm*Vcm\n",
+ "\n",
+ "#Result\n",
+ "print(\"(i) Operating point values:\\nIcq = %.3f mA\\nVcq = %.3f V\\n\\n(ii) Differential gain:\\nAid = %.3f\"%(Ic*1000,Vce,Aid))\n",
+ "print(\"\\n(iii) Common mode gain:\\nAcm = %.4f\"%(math.floor(Acm*10000)/10000))\n",
+ "print(\"\\n(iv) CMMR:\\nCMMR in dB = %.3f dB\\n\\n(v) Output Voltage:\\nVout = %.2f V\"%(CMMR,Vout))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) Operating point values:\n",
+ "Icq = 1.051 mA\n",
+ "Vcq = 10.758 V\n",
+ "\n",
+ "(ii) Differential gain:\n",
+ "Aid = 162.068\n",
+ "\n",
+ "(iii) Common mode gain:\n",
+ "Acm = 0.3414\n",
+ "\n",
+ "(iv) CMMR:\n",
+ "CMMR in dB = 53.527 dB\n",
+ "\n",
+ "(v) Output Voltage:\n",
+ "Vout = 4.88 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.4, Page No. 16"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# operating point , voltage gain and input/output impedance(refer fig 1.15)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Rc = 3.3*10**3 # collector resistor\n",
+ "Rin = 150 # inputr resistance\n",
+ "Re = 8.2*10**3 # emitter resistor\n",
+ "Vcc = 12 # supply voltage\n",
+ "beta = 100 # beta value\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "\n",
+ "#Calculations\n",
+ "# opearating point\n",
+ "Ie = Ic = (Vcc-Vbe)/( (2*Re) + (Rin/beta))\n",
+ "Ie = Ic = math.floor(Ic*10**6)/10**6\n",
+ "Vce = Vcc+Vbe-Ic*Rc\n",
+ "# Voltage gain\n",
+ "re = (26*10**-3)/Ie\n",
+ "Aid = Rc/re\n",
+ "# input and output impedance\n",
+ "Ri = 2*re*beta\n",
+ "Ro = Rc\n",
+ "\n",
+ "#Result\n",
+ "print(\"(i) Operating point values:\\nIcq = %.3f mA\\nVcq = %.4f V\\n\\n(ii) Voltage gain:\\nAid = %.2f\"%(Ic*1000,Vce,Aid))\n",
+ "print(\"\\n(iii)input and output impedances:\\nRi = %.3f k-ohm\\nRo = %.1f k-ohm\"%(Ri/1000,Ro/1000)) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) Operating point values:\n",
+ "Icq = 0.688 mA\n",
+ "Vcq = 10.4296 V\n",
+ "\n",
+ "(ii) Voltage gain:\n",
+ "Aid = 87.32\n",
+ "\n",
+ "(iii)input and output impedances:\n",
+ "Ri = 7.558 k-ohm\n",
+ "Ro = 3.3 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.5, Page No. 19"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# constant current in the circuit(refer fig 1.19(a)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vee = 20.0 # supply voltage\n",
+ "R1 = 4.7*10**3 # resistor R1\n",
+ "R2 = 4.7*10**3 # resistor R2\n",
+ "R3 = 2.2*10**3 # resistor R3\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "\n",
+ "#Calcualtions\n",
+ "Vb = (-Vee*R1)/(R1+R2)\n",
+ "Ve = Vb - Vbe\n",
+ "Ie = (Ve-(-Vee))/(R3) \n",
+ "I = Ie = math.floor(Ie*10**5)/10**5\n",
+ "\n",
+ "#Result\n",
+ "print(\"I = %.2f mA\"%(I*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I = 4.22 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 47
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.6, Page No.23"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Widlar current source(refer fig. 1.24)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ic2 = 20*10**-6 # required collector current of 2nd Trasistor\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "Vcc = 30 # supply voltage\n",
+ "R = 33.3*10**3 # Resistor R\n",
+ "Vt = 26*10**-3 # thermal voltage \n",
+ "\n",
+ "#Calculations\n",
+ "Ic1 = (Vcc-Vbe)/R\n",
+ "Re = Vt*math.log(Ic1/Ic2)/Ic2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Re = %.2f k-ohm\"%(Re/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Re = 4.92 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.7, Page No. 24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Widlar current source: value of Ic2\n",
+ "\n",
+ "import math\n",
+ "# Variable declaration\n",
+ "Iref = 1*10**-3 # reference current\n",
+ "Re = 5*10**3 # emitter resistor\n",
+ "Vt = 26*10**-3 # thermal voltage \n",
+ "\n",
+ "# Calculations\n",
+ "Ic2_1 = 12*10**-6 # assumed value 1\n",
+ "lhs1 = (Vt*math.log(Iref/Ic2_1))-(Ic2_1*Re)\n",
+ "Ic2_2 = 22*10**-6 # assumed value 2\n",
+ "lhs2 = (Vt*math.log(Iref/Ic2_2))-(Ic2_2*Re)\n",
+ "lhs2 = math.ceil(lhs2*10**5)/10**5\n",
+ "Ic2_3 = 20*10**-6 # assumed value 3\n",
+ "lhs3 = (Vt*math.log(Iref/Ic2_3))-(Ic2_3*Re)\n",
+ "\n",
+ "#Result\n",
+ "print(\"for Ic2 = %.0f micro-A, L.H.S = %.5f\"%(Ic2_1*10**6,lhs1))\n",
+ "print(\"for Ic2 = %.0f micro-A, L.H.S = %.5f\"%(Ic2_2*10**6,lhs2))\n",
+ "print(\"\\nhence actual value is less than but closer to %.0f micro-A\"%(Ic2_2*10**6))\n",
+ "print(\"\\nfor Ic2 = %f micro-A, L.H.S = %.4f\"%(Ic2_3*10**6,lhs3))\n",
+ "print(\"LHS is almost zero, so the value of Ic2 = %.0f micro-A\"%(Ic2_3*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "for Ic2 = 12 micro-A, L.H.S = 0.05499\n",
+ "for Ic2 = 22 micro-A, L.H.S = -0.01076\n",
+ "\n",
+ "hence actual value is less than but closer to 22 micro-A\n",
+ "\n",
+ "for Ic2 = 20.000000 micro-A, L.H.S = 0.0017\n",
+ "LHS is almost zero, so the value of Ic2 = 20 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 61
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.8, Page No.34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# level shifting network (refer fig. 1.42)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vi = 6.84 # input dc level\n",
+ "R2 = 270 # resistor R2\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "\n",
+ "# Calculations\n",
+ "R1 = ((Vi-Vbe)*R2)-R2\n",
+ "R1 = R1/1000\n",
+ "#Result\n",
+ "print(\"Required value of R to get 0V output level is %.3f k-ohm\"%(math.floor(R1*10**3)/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required value of R to get 0V output level is 1.387 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 69
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.9, Page No. 36"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# differential and common mode output \n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Aid = 80.0 # differential gain\n",
+ "CMMR = 95.0 # common mode rejection ratio\n",
+ "V1 = 2*10**-6 # input voltage 1\n",
+ "V2 = 1.6*10**-6 # input voltage 2\n",
+ "\n",
+ "#Calculations\n",
+ "Aid = 10**(Aid/20)\n",
+ "CMMR = 10.0**(CMMR/20)\n",
+ "Vid = Aid*(V1-V2)\n",
+ "Acm = Aid/CMMR\n",
+ "Vcm = Acm*(V1+V2)/2\n",
+ "\n",
+ "#Result\n",
+ "print(\"Vid = %.0f mV\\nVcm = %.2f micro-V\"%(Vid*10**3,Vcm*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vid = 4 mV\n",
+ "Vcm = 0.32 micro-V\n"
+ ]
+ }
+ ],
+ "prompt_number": 75
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.10, Page No. 37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Common mode output\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Aid = 125.0 # differential gain \n",
+ "CMMR = 60.0 # common mode rejection ratio\n",
+ "Vp = 4.0 # peak voltage \n",
+ "#Calculations\n",
+ "x = 10**(CMMR/20) # Aid/Acm\n",
+ "Acm = Aid/x\n",
+ "\n",
+ "#Result\n",
+ "print(\"Commode mode output is given by Acm*Vcm = %.1f*sin(200*pi*t)\"%(Vp*Acm))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Commode mode output is given by Acm*Vcm = 0.5*sin(200*pi*t)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.11, Page No.37"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Collector voltage and and differential voltage gain(refer fig 1.48)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "hfe = 100.0 # current gain\n",
+ "hie = 3.9*10**3 # inpput impedance\n",
+ "Rin = 1*10**3 # Source resistance\n",
+ "Re = 27*10**3 # Emitter resistance\n",
+ "Rc = 6.8*10**3 # collector resistance\n",
+ "Vcc = 15 # supply voltage\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Ie = Ic = (Vcc-Vbe)/((Rin/hfe)+2*Re)\n",
+ "Vout1 = Vout2 = Vcc-Ic*Rc\n",
+ "Aid = abs(hfe*Rc/(Rin+hie))\n",
+ "\n",
+ "#Result\n",
+ "print(\"Vc1 = Vc2 = %.2f V\\nAid = %f \"%(Vout1,Aid))\n",
+ "#Answer for Aid is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Vc1 = Vc2 = 13.20 V\n",
+ "Aid = 138.775510 \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.12, Page No. 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Value of Resistance Re\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vcc = 10.0 # Supply voltage\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "Rc = 47*10**3 # Collector resistance\n",
+ "hfe = 100.0 # current gain\n",
+ "Vceq = 8.6 # quiescent collector emitter voltage\n",
+ "\n",
+ "#Calculations\n",
+ "Ic = (Vcc+Vbe-Vceq)/Rc\n",
+ "Re =(Vcc-Vbe)/(2*((1+hfe)/hfe))\n",
+ "Re = math.floor(Re*10000)/10000\n",
+ "Re = Re/(Ic*1000) # k-ohm\n",
+ "\n",
+ "#Result\n",
+ "print(\"Re = %.2f k-ohm\"%(math.floor(Re*100)/100))\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Re = 103.03 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.13, Page No. 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Differential amplifier parameter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vbe = 0.712 # emitter-base junction voltage drop\n",
+ "hfe = 500.0 # current gain\n",
+ "hie = 18 *10**3 # inpput impedance\n",
+ "Rin = 50 # Source resistance\n",
+ "Re = 6.8*10**3 # Emitter resistance\n",
+ "Rc = 4.7*10**3 # collector resistance\n",
+ "Vcc = 10 # supply voltage\n",
+ "\n",
+ "#Calcualtions\n",
+ "#(i)\n",
+ "Ie = (Vcc -Vbe)/(2*Re)\n",
+ "Ic = (hfe/(1+hfe))*Ie\n",
+ "Vce = Vcc+Vbe-Ic*Rc\n",
+ "Vce = math.floor(Vce*1000)/1000\n",
+ "Ic = math.floor(Ic*10**7)/10**7\n",
+ "Ic = Ic *1000 # mA\n",
+ "#(ii)\n",
+ "Ad = hfe*Rc/(2*(Rin+hie))\n",
+ "Ad = math.floor(Ad*100)/100\n",
+ "#(iii)\n",
+ "Ri = 2*(Rin+hie)\n",
+ "Ro = Rc\n",
+ "\n",
+ "#Result\n",
+ "print(\"(i)\\nIcq =%.4f mA\\t\\tVce = %.3f V\\n\\n(ii)\\nAd = %.2f\\n\\n(iii)\\nRi = %.1f k-ohm\\t\\tRo = %.1f k-ohm\"%(Ic,Vce,Ad,Ri/1000.0,Ro/1000))\n",
+ "# answer for Ri is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i)\n",
+ "Icq =0.6815 mA\t\tVce = 7.508 V\n",
+ "\n",
+ "(ii)\n",
+ "Ad = 65.09\n",
+ "\n",
+ "(iii)\n",
+ "Ri = 36.1 k-ohm\t\tRo = 4.7 k-ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.14, Page No. 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Current through the transistors(refer fig 1.50)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Q2 = 0.5 # Area of Q2 /Area of Q1\n",
+ "Q3 = 0.25 # Area of Q3 /Area of Q1\n",
+ "Q4 = 0.125 # Area of Q4 /Area of Q1\n",
+ "Vcc = 15 # Supply voltage\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "R = 20*10**3 # Resistor R\n",
+ "\n",
+ "#Calculations\n",
+ "I1 = (Vcc-Vbe)/R\n",
+ "I2 = I1*Q2\n",
+ "I3 = I1*Q3\n",
+ "I4 = I1*Q4\n",
+ "\n",
+ "\n",
+ "#Result\n",
+ "print(\"I2 = %.3f mA\\nI3 = %.4f mA\\nI4 = %.3f mA\"%(math.floor(I2*10**6)/1000,math.floor(I3*10**7)/10000,I4*1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I2 = 0.357 mA\n",
+ "I3 = 0.1787 mA\n",
+ "I4 = 0.089 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ " example 1.15, Page No. 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Current calculation in the circuit\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vz = 6.2 # zener voltage\n",
+ "R1 = 4.7*10**3 # resistor R1\n",
+ "R3 = 2.2*10**3 # resistor R3\n",
+ "Vee = -20 # supply voltage\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "\n",
+ "#Calcualtions\n",
+ "Vb = Vee + Vz\n",
+ "Ve = Vee+Vz-Vbe\n",
+ "I = Ie = (Ve-Vee)/R3\n",
+ "\n",
+ "#Result\n",
+ "print(\"I = %.1f mA\"%(I*1000))\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I = 2.5 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 53
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.16, Page No.39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Differential amplifier\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ie = 10**-3 # Emitter current\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "Rc = 4.7*10**3 # colloector Resistance\n",
+ "Vcc = 12 # Supply voltage\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "Re = (Vcc-Vbe)/(Ie)\n",
+ "Ic = Ic1 = Ic2 = Ie/2\n",
+ "Vout = Vcc-Ic*Rc\n",
+ "\n",
+ "#Result\n",
+ "print(\"(i) Re = %.1f k-ohm\\n\\n(ii) Vout = %.2f V\"%(Re/1000,Vout))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) Re = 11.3 k-ohm\n",
+ "\n",
+ "(ii) Vout = 9.65 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.17, Page No. 40"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Ie3, Vce1 and differential mode gain(refer fig. 1.54)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "hfe = 250.0 # current gain\n",
+ "hie = 560 # inpput impedance for Q1 and Q2\n",
+ "Rin = 1.0*10**3 # Source resistance\n",
+ "Rb4 = 1.5*10**3 # Emitter resistance\n",
+ "Rc = 1.0*10**3 # collector resistance\n",
+ "Vcc = 12 # supply voltage\n",
+ "\n",
+ "# Calculations\n",
+ "I = (Vcc-Vbe)/Rb4\n",
+ "Ie3 = I\n",
+ "Ie1 = Ie2 = Ie3/2\n",
+ "Ic1 = Ie1\n",
+ "Vce1 = Vcc+Vbe-Ic1*Rc\n",
+ "Aid = hfe*Rc/(Rc+hie)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Ie3 = %.3f mA\\nVce1 = %.3f V\\nAid = %.2f\"%(Ie3*10**3,Vce1,math.floor(Aid*100)/100))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ie3 = 7.533 mA\n",
+ "Vce1 = 8.933 V\n",
+ "Aid = 160.25\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.18, Page No. 41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "print(\"Theoretical example\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Theoretical example\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.19, Page No. 41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# DC shift and curretn in the circuit (refer fig. 1.55)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vcc = 15.0 # supply voltage\n",
+ "R1 = 10.0*10**3 # Resistor R1\n",
+ "R2 = 5.0*10**3 # Resistor R2\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "\n",
+ "#Calculations\n",
+ "shift = (Vcc*R2/R1)+Vbe*(1-(R2/R1))\n",
+ "I = (Vcc-Vbe)/R1\n",
+ "\n",
+ "#Result\n",
+ "print(\"(Vin-Vout) = %.2f V\\n\\t I = %.2f mA\"%(shift, I*10**3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(Vin-Vout) = 7.85 V\n",
+ "\t I = 1.43 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.20, Page No. 41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# maximum possible closed loop gain\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "sr = 3*10**6 # slew rate in V/sec\n",
+ "dV = 0.4 # input voltage variation\n",
+ "dt = 12*10**-6 # time in which voltage varies\n",
+ "\n",
+ "#Calculations\n",
+ "A = sr/(dV/dt)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Maximum closed loop gain = %.0f\"%A)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum closed loop gain = 90\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.21, Page No. 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# input bias and input offset current\n",
+ "\n",
+ "import math\n",
+ "#Variable Declaration\n",
+ "Vbe = 0.7 # emitter-base junction voltage drop\n",
+ "beta1 = 100.0 # current gain for Q1\n",
+ "beta2 = 125.0 # current gain for Q1\n",
+ "Re = 39*10**3 # Emitter resistance\n",
+ "Rc = 4.7*10**3 # collector resistance\n",
+ "Vcc = 12 # supply voltage\n",
+ "\n",
+ "# Calculations\n",
+ "Ie = (Vcc-Vbe)/Re\n",
+ "Ie1 = Ie2 = Ie/2\n",
+ "Ib1 = Ie1/beta1\n",
+ "Ib2 = Ie2/beta2\n",
+ "Ib = (Ib1+Ib2)/2\n",
+ "Iios = abs(Ib1-Ib2)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Ib = %.4f micro-A\\nIios = %.5f micro-A\"%(Ib*10**6,Iios*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ib = 1.3038 micro-A\n",
+ "Iios = 0.28974 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.22, Page No. 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Maximum possible amplitude of output\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "f = 7000.0 # frequency of input sine wave\n",
+ "Icq = 8*10**-6 # collector current\n",
+ "Cc = 27*10**-12 # Capacitance\n",
+ "\n",
+ "#Calculations\n",
+ "S = Icq/Cc\n",
+ "Vm = S/(2*math.pi*f)\n",
+ "\n",
+ "#Result\n",
+ "print(\"Maximum amplitude of output = %.3f V\"%(math.floor(Vm*1000)/1000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Maximum amplitude of output = 6.736 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.23, Page No. 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Slew rate\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vm = 3.8 # output amplitude\n",
+ "tr = 4.5*10**-6 # required rise time\n",
+ "S_741 = 0.5*10**-6 # slew rate of IC741 op-amp\n",
+ "\n",
+ "#Calculations\n",
+ "del_V = (0.9-0.1)*Vm\n",
+ "S = del_V/tr\n",
+ "\n",
+ "#Result\n",
+ "print(\"Required slew rate = %.3f V/micro-s\"%(math.floor(S/10**3)/1000))\n",
+ "print(\"Slew rate of IC 741 is 0.5V/usec which is too low as compared to the required value. Hence Ic 741 cannot be used.\")"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Required slew rate = 0.675 V/micro-s\n",
+ "Slew rate of IC 741 is 0.5V/usec which is too low as compared to the required value. Hence Ic 741 cannot be used.\n"
+ ]
+ }
+ ],
+ "prompt_number": 34
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.24, Page No.43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Maximum gain using op-amp\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "S = 0.4*10**6 # op-amp slew rate in V/sec\n",
+ "Vm = 0.04 # maximum input \n",
+ "w = 1.13*10**5 # freq in rad/sec\n",
+ "\n",
+ "#Calculations\n",
+ "fm = w/(2*math.pi)\n",
+ "V = S/(2*math.pi*fm)\n",
+ "G = V/Vm\n",
+ "\n",
+ "#Result\n",
+ "print(\"Gain = %.1f \"%G)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Gain = 88.5 \n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.25, Page No. 43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# smallest and largest possible input bias current and input offset current\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Ie = 400*10**-6 # total emitter bias current\n",
+ "beta_min = 80 # minimum current gain\n",
+ "beta_max = 200 # maximum current gain\n",
+ "\n",
+ "#Calculation\n",
+ "Ie1 = Ie2 = Ie/2\n",
+ "Ib1_1 = Ib2_1 = Ie1/(1+beta_min) # for beta =80\n",
+ "Ib1_2 = Ib2_2 = Ie1/(1+beta_max)\n",
+ "\n",
+ "Ib_max = (Ib1_1+Ib2_1)/2\n",
+ "Ib_min = (Ib1_2+Ib2_2)/2\n",
+ "Iios = Ib_max-Ib_min\n",
+ "\n",
+ "#Result\n",
+ "print(\"Largest input bias current = %.3f micro-A\\nSmallest input bias current = %.3f micro-A\"%(Ib_max*10**6,Ib_min*10**6))\n",
+ "print(\"Largest input offset current = %.3f micro-A\"%(Iios*10**6))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Largest input bias current = 2.469 micro-A\n",
+ "Smallest input bias current = 0.995 micro-A\n",
+ "Largest input offset current = 1.474 micro-A\n"
+ ]
+ }
+ ],
+ "prompt_number": 44
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.26, Page No.43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Collector current for each transistor(refer fig. 1.59)\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "Vbe = 0.715 # emitter-base junction voltage drop\n",
+ "beta = 100.0 # Current gain\n",
+ "Vcc = 10 # input voltage\n",
+ "Rc1 = 5.6*10**3 # Collector resistance\n",
+ "Rc2 = 1.0*10**3 # Collector resistance\n",
+ "\n",
+ "#Calculations\n",
+ "I = (Vcc-Vbe)/Rc1\n",
+ "Ic2 = (beta/(beta+4))*I\n",
+ "\n",
+ "#Result\n",
+ "print(\"I = %.3f mA\\nIc2 = Ic3 = Ic4 = %.4f mA\"%(I*1000,math.floor(Ic2*10**7)/10000))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "I = 1.658 mA\n",
+ "Ic2 = Ic3 = Ic4 = 1.5942 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 50
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "example 1.27, Page No. 44"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Differential amplifier parameter\n",
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "beta = 100.0 # current gain\n",
+ "Vbe = 0.715 # emitter-base junction voltage drop\n",
+ "Vz = 6.2 # Zener Voltage\n",
+ "Iz = 41*10**-3 # Zener Current \n",
+ "Rc = 4.7*10**3 # Collector Current\n",
+ "Rin = 500 # input resistance\n",
+ "Rb = 68*10**3 # base voltage \n",
+ "Re = 2.7*10**3 # emitter resistance\n",
+ "Vcc = 10 # Supply Voltage\n",
+ "hie = 1000.0 # input resistance\n",
+ "\n",
+ "#Calculations\n",
+ "I = (Vcc-Vbe-Vz)/Rb\n",
+ "I = math.floor(I*10**8)/10**8\n",
+ "Ie3 = (Vcc-Vbe-Rb*I)/Re\n",
+ "Ie3 = math.ceil(Ie3*10**7)/10**7\n",
+ "Ic3 = (beta/(1+beta))*Ie3\n",
+ "Ic3 = math.floor(Ic3*10**7)/10**7\n",
+ "Ie = Ic3/2\n",
+ "Ie = math.floor(Ie*10**7)/10**7\n",
+ "Ic = beta*Ie/(1+beta)\n",
+ "Ic = math.ceil(Ic*10**7)/10**7\n",
+ "Vce = Vcc+Vbe-Ic*Rc\n",
+ "Vce = math.floor(Vce*10**4)/10**4\n",
+ "Aid = beta*Rc/(Rin+hie)\n",
+ "Ri = Rin+2*hie\n",
+ "\n",
+ "#Result\n",
+ "print(\"(i) Aid = %.3f\\n\\n(ii) input Resistance = %.1f k-ohm\\n\\n(iii) Icq = %.4f mA\\t\\tVceq = %.4f V\"%(Aid,Ri/1000,Ic*1000,Vce))\n",
+ "#Value for input resistance is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(i) Aid = 313.333\n",
+ "\n",
+ "(ii) input Resistance = 2.5 k-ohm\n",
+ "\n",
+ "(iii) Icq = 1.1256 mA\t\tVceq = 5.4246 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 77
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file