diff options
author | kinitrupti | 2017-05-12 18:53:46 +0530 |
---|---|---|
committer | kinitrupti | 2017-05-12 18:53:46 +0530 |
commit | 6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d (patch) | |
tree | 22789c9dbe468dae6697dcd12d8e97de4bcf94a2 /Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb | |
parent | d36fc3b8f88cc3108ffff6151e376b619b9abb01 (diff) | |
download | Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.gz Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.tar.bz2 Python-Textbook-Companions-6279fa19ac6e2a4087df2e6fe985430ecc2c2d5d.zip |
Removed duplicates
Diffstat (limited to 'Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb')
-rwxr-xr-x | Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb | 579 |
1 files changed, 579 insertions, 0 deletions
diff --git a/Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb b/Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb new file mode 100755 index 00000000..ea42a24d --- /dev/null +++ b/Analog_Integrated_Circuits_by_Pramod_Sharma/Chapter04.ipynb @@ -0,0 +1,579 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2a4ca46418f96503536124ea941a5521b6b652077fc912eba380767a1297ae00" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "Chapter04 : Basic Application of an Op-amp" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.2 : page 119" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "# given data\n", + "# KCL at node (b) (6-V)/30+(8-V)/40+(0-V)/30=0 \n", + "V=48/11 #in volts\n", + "print \"Voltage V = %0.2f Volt\"%V\n", + "# KCL at node (a) (3-V)/10+(4-V)/20=(V-Vo)/40\n", + "Vo=-(20-7*V) #in Volts\n", + "print \"Output Voltage of the circuit Vo = %0.2f Volt\"%Vo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Voltage V = 4.36 Volt\n", + "Output Voltage of the circuit Vo = 10.55 Volt\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.3 : page 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from sympy import symbols, N\n", + "V1, V2 = symbols('V1 V2')\n", + "R1 = 11 # Kohm\n", + "R2 = 10 # Kohm\n", + "Ra = 99 # kohm\n", + "Ro = 100 # kohm\n", + "Va = Ra/(Ra+R1)*V1\n", + "Vo1 = (1+Ro/R2)*Va\n", + "A = Vo1/V1\n", + "Vo2 = -Ro/R2*V2\n", + "B = Vo2/V2\n", + "print \"Value of A : \",N(A,2)\n", + "print \"Value of B : \",N(B,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of A : 9.9\n", + "Value of B : -10.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.4 : page 120" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "from sympy import symbols, N, solve\n", + "Va, R1, R3, Vb = symbols('Va R1 R3 Vb')\n", + "Ro = 100 # kohm\n", + "Voa = -2*Va\n", + "# Vo = Voa+Vob\n", + "eqn = Voa+Ro/R1*Va\n", + "R1 = solve(eqn, R1)[0] # kohm\n", + "print \"value of R1 = %0.2f kohm\"%R1\n", + "R2=R1 # kohm\n", + "V1 = R3*Vb/(R2+R3)\n", + "Vob = (1+Ro/R1)*V1\n", + "R3 = solve(Vob-Vb,R3)[0]\n", + "print \"value of R2 = %0.2f kohm\"%R2\n", + "\n", + "print \"value of R3 = %0.2f kohm\"%R3" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "value of R1 = 50.00 kohm\n", + "value of R2 = 50.00 kohm" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "\n", + "value of R3 = 25.00 kohm\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.5 : page 121" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from sympy import symbols, solve, N\n", + "Vo = symbols('Vo')\n", + "R1 = 10 # kohm\n", + "R2 = 20 # kohm\n", + "Ro = 100 # kohm\n", + "V1 = -2 # V\n", + "V2 = +3 # V\n", + "I1 = V1/R1 # A\n", + "I2 = V2/R2 # A\n", + "If = (0-Vo)/Ro\n", + "eqn = I1+I2-If\n", + "Vo = solve(eqn, Vo)[0]\n", + "print \"Output voltage, Vo =\",N(Vo,2),\"Volt\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output voltage, Vo = 5.0 Volt\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.7 : page 123" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy as np\n", + "from sympy import symbols\n", + "Vo, Vx, Vy = symbols('Vo Vx Vy')\n", + "R1 = 2 # kohm\n", + "R2 = 2 # kohm\n", + "R3 = 2 # kohm\n", + "R4 = 8 # kohm\n", + "R5 = 1 # kohm\n", + "R6 = 7 # kohm\n", + "V1 = 1 # V\n", + "# Node X\n", + "Vz=1 # V\n", + "# KCL at node Y\n", + "eqn1 = 3*Vy-2*Vx-1\n", + "# KCL at node X\n", + "eqn2 = Vy-2*Vx+1\n", + "A=np.array([[-2,3],[-2,1]])\n", + "B=np.array([[1,-1]])\n", + "X=np.linalg.solve(A,B)\n", + "Vx = X[0][1] # V\n", + "Vo = Vx/R5*(R5+R6)\n", + "print \"Output Voltage, Vo = %0.f V\"%Vo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output Voltage, Vo = 4 V\n" + ] + } + ], + "prompt_number": 20 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.9 : page 130" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# given data\n", + "R1=10 #in Kohm\n", + "R4=8 #in Kohm\n", + "R5=3 #in Kohm\n", + "RF=45 #in Kohm\n", + "AD=(1+2*R4/R5)*(RF/R1) \n", + "print \"Gain for the instrumention amplifier is : \",AD" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Gain for the instrumention amplifier is : 28.5\n" + ] + } + ], + "prompt_number": 23 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.10 : page 131" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# given data\n", + "VA=3 #in mV\n", + "VB=5 #in mV\n", + "R1=10 #in Kohm\n", + "R2=10 #in Kohm\n", + "R3=45 #in Kohm\n", + "R4=8 #in Kohm\n", + "R5=3 #in Kohm\n", + "RF=45 #in Kohm\n", + "I=(VA-VB)/R5 #in mA\n", + "VoA=VA+I*R4 #in mVs\n", + "VoB=VB-I*R4 #in mVs\n", + "print \"Output of op-amp A1 = %0.2f mV\" %VoA\n", + "print \"Output of op-amp A2 = %0.2f mV\" %VoB\n", + "Vo1=(1+RF/R1)*(R3/(R3+R2))*VoB \n", + "Vo2=-(RF/R1)*VoA \n", + "Vo=Vo1+Vo2 #in mV\n", + "print \"Combined output of the circuit = %0.2f mV\"%Vo\n", + "# Answer in the textbook is not accurate." + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Output of op-amp A1 = -2.33 mV\n", + "Output of op-amp A2 = 10.33 mV\n", + "Combined output of the circuit = 57.00 mV\n" + ] + } + ], + "prompt_number": 29 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.12 : page 135" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# given data\n", + "RF=10 #in Kohm\n", + "R1=10 #in Kohm\n", + "R2=R1 #in Kohm\n", + "R3=R1 #in Kohm\n", + "R5max=50 #in Kohm\n", + "ADmin=5 #unitless\n", + "ADmax=200 #unitless\n", + "#Formula : ADmin=1+2*R4/R5max\n", + "R4=(ADmin-1)*(R5max/2) #in Kohm\n", + "#Formula : ADmax=1+2*R4/R5min\n", + "R5min=(2*R4)/(ADmax-1) #in Kohm\n", + "print \"Thus design values of resistors in Kohm are :\" \n", + "print \"R1 = \",R1,\"kohm\" \n", + "print \"R2 = \",R2,\"kohm\" \n", + "print \"R3 = \",R3,\"kohm\" \n", + "print \"R4 = \",R4,\"kohm\" \n", + "print \"RF = \",RF,\"kohm\" \n", + "print \"R5min = %0.f kohm\"%R5min\n", + "print \"R5max = \",R5max,\"kohm\" " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Thus design values of resistors in Kohm are :\n", + "R1 = 10 kohm\n", + "R2 = 10 kohm\n", + "R3 = 10 kohm\n", + "R4 = 100.0 kohm\n", + "RF = 10 kohm\n", + "R5min = 1 kohm\n", + "R5max = 50 kohm\n" + ] + } + ], + "prompt_number": 37 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.13 : page 136" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# given data\n", + "Vdc=10 #in Volt\n", + "R1=10 #in Kohm\n", + "R2=10 #in Kohm\n", + "R3=100 #in Kohm\n", + "RF=100 #in Kohm\n", + "# Part(i) Balance Bridge : RA=RB=RC=RT=150ohm and VAB=0\n", + "Vo = 0 # V\n", + "print \"(i) Balance bridge have output voltage Vo = %0.f volt\" %Vo\n", + "RA=150 #in ohm\n", + "RB=150 #in ohm\n", + "RC=150 #in ohm\n", + "RT=150 #in ohm\n", + "VAB=0 #in Volt\n", + "Vo=(-RF/R1)*VAB \n", + "# Part(ii) Unbalance Bridge : RT=200ohm\n", + "RT=200 #in ohm\n", + "VA=(RA/(RA+RT))*Vdc \n", + "VB=(RB/(RB+RC))*Vdc \n", + "VAB=VA-VB #in Volt\n", + "Vo=(-RF/R1)*VAB \n", + "print \"(ii) Unbalance bridge have output voltage Vo = %0.1f Volt\" %Vo" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "(i) Balance bridge have output voltage Vo = 0 volt\n", + "(ii) Unbalance bridge have output voltage Vo = 7.1 Volt\n" + ] + } + ], + "prompt_number": 40 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.15 : page 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy as np\n", + "# given data\n", + "Gain=10 #Unitless\n", + "fb=10 #in KHz\n", + "#Assuming fa=fb/10\n", + "fa=fb/10 #in KHz\n", + "# Formula : fa=1/(2*pi*RF*CF)\n", + "RFCF=1/(2*np.pi*fa) \n", + "#Assuming R1=1Kohm\n", + "R1=1 #in Kohm\n", + "RF=10*R1 #in Kohm\n", + "CF=RFCF/RF #in uF\n", + "Rcomp=(R1*RF)/(R1+RF) # in Kohm\n", + "print \"Value of RF = %0.2f kohm\"%RF\n", + "print \"Value of CF = %0.3f uF\"%CF\n", + "print \"Value of Rcomp = %0.f ohm\"%(Rcomp*1000)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of RF = 10.00 kohm\n", + "Value of CF = 0.016 uF\n", + "Value of Rcomp = 909 ohm\n" + ] + } + ], + "prompt_number": 44 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.16 : page 146" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "#Using superposition theorem\n", + "CF=10 #in uF\n", + "R1=1/(3*CF*10**-6) #in KOhm\n", + "R2=1/(2*CF*10**-6) #in KOhm\n", + "print \"Value of R1 = %0.2f kohm \"%(R1/1000) \n", + "print \"Value of R2 = %0.2f kohm \"%(R2/1000) " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of R1 = 33.33 kohm \n", + "Value of R2 = 50.00 kohm \n" + ] + } + ], + "prompt_number": 45 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.22 : page 156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import numpy as np\n", + "# given data\n", + "fa=1.5 #in KHz\n", + "fmax=1.5 #in KHz\n", + "C1=0.1 #in uF\n", + "RF=1/(2*np.pi*fa*C1) #in Kohm\n", + "fb=10*fa #in Khz\n", + "R1=1/(2*np.pi*fb*C1) #in Kohm\n", + "CF=(R1*C1)/RF #in uF\n", + "Rcomp=RF #in Kohm\n", + "print \"Value of resistance RF = %0.2f kohm\"%(RF)\n", + "print \"Value of resistance R1 = %0.2f ohm\"%(R1*1000)\n", + "print \"Value of Capacitance CF = %0.2f uF\"%(CF)\n", + "print \"Value of resistance Rcomp = %0.2f kohm\"%(Rcomp)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of resistance RF = 1.06 kohm\n", + "Value of resistance R1 = 106.10 ohm\n", + "Value of Capacitance CF = 0.01 uF\n", + "Value of resistance Rcomp = 1.06 kohm\n" + ] + } + ], + "prompt_number": 46 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "Exa 4.25 : page 159" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "from __future__ import division\n", + "# given data\n", + "C1=0.1 #in uF\n", + "f=100 #in Hz\n", + "T=1/f #in sec\n", + "# Given also R1C1=0.2*T \n", + "R1=(0.2*T)/(C1*10**-6) #in ohm\n", + "RF=0.05/(C1*10**-6) #in ohm\n", + "CF=(R1*C1)/RF #in uF\n", + "print \"Value of resistance R1 = %0.2f ohm\"%(R1/1000)\n", + "print \"Value of resistance RF = %0.2f kohm\"%(RF/1000)\n", + "print \"Value of Capacitance CF = %0.2e uF\"%(CF)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of resistance R1 = 20.00 ohm\n", + "Value of resistance RF = 500.00 kohm\n", + "Value of Capacitance CF = 4.00e-03 uF\n" + ] + } + ], + "prompt_number": 47 + } + ], + "metadata": {} + } + ] +}
\ No newline at end of file |