summaryrefslogtreecommitdiff
path: root/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Analog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb')
-rwxr-xr-xAnalog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb958
1 files changed, 958 insertions, 0 deletions
diff --git a/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb b/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb
new file mode 100755
index 00000000..c99919b0
--- /dev/null
+++ b/Analog_Integrated_Circuits_by_R.S._Tomar/Chapter9.ipynb
@@ -0,0 +1,958 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:37cf075e7171812be5843be8bfa73abd6fa4ec1e75c4ee917f74396ed076786b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter9 - Active filters"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.2 - page : 273"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "fH=1 #kHz\n",
+ "Ap=2 #Pass band gain\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance is %0.2f micro F \" %C\n",
+ "R=1/(2*pi*fH*1000*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R \n",
+ "#Ap=1+Rf/Ri\n",
+ "RfBYRi=Ap-1 #Rf=Ri here\n",
+ "#R=Rf||Ri\n",
+ "Ri=2*R #kohm\n",
+ "Rf=Ri #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance is 0.05 micro F \n",
+ "Resistance R = 3.2 kohm \n",
+ "Resistance Ri = 6.4 kohm \n",
+ "Resistance Rf = 6.4 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.3 - page : 273"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "f0=800 #Hz\n",
+ "#For Butterworth filter : f0=fH=f_3dB\n",
+ "fH=f0 #Hz\n",
+ "f_3dB=f0 #Hz\n",
+ "BW=fH #Hz\n",
+ "print \"Bandwidth = %0.2f Hz \" %BW "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bandwidth = 800.00 Hz \n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.4 - page 274"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "fH=2 #kHz(Cutoff frequency)\n",
+ "Ap=1 #Pass band gain\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.05 #micro F#Chosen for the design between 0.01 & 1 micro F\n",
+ "print \"Capacitance = %0.2f micro F \" %C\n",
+ "R=1/(2*pi*fH*1000*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R\n",
+ "Rdash=R #/kohm(To eliminate the effect of offset)\n",
+ "print \"Resistance R* = %0.1f kohm \" %Rdash "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance = 0.05 micro F \n",
+ "Resistance R = 1.6 kohm \n",
+ "Resistance R* = 1.6 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.5 - page : 275"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "f0=1 #kHz(Cutoff frequency)\n",
+ "f0dash=1.5 #kHz(Cutoff frequency)\n",
+ "print \"Various design parameters are :-\"\n",
+ "#For Butterworth filter\n",
+ "fH=f0 #kHz\n",
+ "fHdash=f0dash #kHz\n",
+ "K=f0/f0dash #ratio\n",
+ "R=3.2 #kohm\n",
+ "Rdash=K*R #kohm\n",
+ "print \"Resistance Rdash = %0.1f kohm \" %Rdash \n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance = %0.2f micro F \" %C\n",
+ "fHdash=1/(2*pi*Rdash*1000*C*10**-6)/1000 #kHz\n",
+ "print \"Cutoff frequency is %0.1f kHz \" %fHdash "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Resistance Rdash = 2.1 kohm \n",
+ "Capacitance = 0.05 micro F \n",
+ "Cutoff frequency is 1.5 kHz \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.6 - page : 278"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "fL=400 #Hz\n",
+ "Ap=2 #Pass band gain\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.05 #micro F#Chosen for the design between 0.01 & 1 micro F\n",
+ "print \"Capacitance is %0.2f micro F \" %C\n",
+ "R=1/(2*pi*fL*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R\n",
+ "#Ap=1+Rf/Ri\n",
+ "RfBYRi=Ap-1 #Rf=Ri here\n",
+ "#R=Rf||Ri\n",
+ "Ri=2*R #kohm\n",
+ "Rf=Ri #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf\n",
+ "# Answer in the textbook are inaccurate."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance is 0.05 micro F \n",
+ "Resistance R = 7.96 kohm \n",
+ "Resistance Ri = 15.9 kohm \n",
+ "Resistance Rf = 15.9 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.7 - page : 279"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi\n",
+ "fL=400 #Hz\n",
+ "fLdash=800 #Hz\n",
+ "K=fL/fLdash #ratio\n",
+ "print \"Various parameters for retuning are :-\"\n",
+ "R=8.2 #kohm\n",
+ "Rdash=K*R #kohm\n",
+ "print \"Resistance Rdash = %0.2f kohm \" %Rdash\n",
+ "Rf=2*Rdash #kohm\n",
+ "Ri=2*Rdash #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various parameters for retuning are :-\n",
+ "Resistance Rdash = 4.10 kohm \n",
+ "Resistance Ri = 8.2 kohm \n",
+ "Resistance Rf = 8.2 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.8 - page : 285"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "f0=3 #kHz(Critical frequency)\n",
+ "Ap=4 #Pass band gain\n",
+ "#For Butterworth filter using sallen key\n",
+ "alfa=1.414; klp=1 #constant\n",
+ "fH=f0 #kHz\n",
+ "f_3dB=f0 #kHz\n",
+ "print \"Various design parameters are :-\"\n",
+ "C1=0.01 #micro F#Chosen for the design\n",
+ "print \"Capacitance C1 = %0.2f micro F \" %C1 \n",
+ "C2=alfa**2*C1/4 #micro F\n",
+ "print \"Capacitance C2 = %0.3f micro F \" %C2 \n",
+ "C2=0.004 # micro F\n",
+ "R=1/(2*pi*fH*10**3*sqrt(C1*10**-6*C2*10**-6))/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R\n",
+ "R=8.2 #kohm\n",
+ "#For offset minimization\n",
+ "Rdash=2*R #kohm\n",
+ "print \"Resistance R* = %0.2f kohm \" %Rdash \n",
+ "RfBYRi=Ap-1 #Rf=Ri here\n",
+ "#Ri=10 kohm chosen for design\n",
+ "Ri=10 #kohm\n",
+ "Rf=RfBYRi*Ri #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C1 = 0.01 micro F \n",
+ "Capacitance C2 = 0.005 micro F \n",
+ "Resistance R = 8.4 kohm \n",
+ "Resistance R* = 16.40 kohm \n",
+ "Resistance Ri = 10.0 kohm \n",
+ "Resistance Rf = 30.0 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.9 - page : 288"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "f0=2 #kHz(Critical frequency)\n",
+ "Ap=5 #dc gain\n",
+ "#For Butterworth filter using sallen key\n",
+ "alfa=1.414; klp=1 #constant\n",
+ "fH=f0 #kHz\n",
+ "f_3dB=f0 #kHz\n",
+ "Ap1=3-alfa #gain\n",
+ "RfBYRi=Ap1-1 #ratio\n",
+ "print \"Various design parameters are :-\" \n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R=klp/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R \n",
+ "#For offset minimization\n",
+ "#2*R=Rf||Ri=Rf/(RfBYRi+1)\n",
+ "Rf=2*R*(RfBYRi+1) #kohm\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf \n",
+ "Ri=Rf/RfBYRi #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri \n",
+ "#Ap=4 #dc gain in this case\n",
+ "Ap=4 #dc gain\n",
+ "Ap2=Ap/Ap1 #remainimg gain after 2nd order butterworth filter\n",
+ "RfdashBYRidash=Ap2-1 #ratio\n",
+ "#Ridash=10 #kohm chosen for design\n",
+ "Ridash=10 #kohm\n",
+ "print \"Resistance Ridash = %0.2f kohm \" %Ridash \n",
+ "Rfdash=RfdashBYRidash*Ridash #kohm\n",
+ "print \"Resistance Rfdash = %0.f kohm \" %Rfdash"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.05 micro F \n",
+ "Resistance R = 1.6 kohm \n",
+ "Resistance Rf = 5.0 kohm \n",
+ "Resistance Ri = 8.6 kohm \n",
+ "Resistance Ridash = 10.00 kohm \n",
+ "Resistance Rfdash = 15 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.10 - page : 289"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "f0=2 #kHz(Critical frequency)\n",
+ "fH=f0 #kHz\n",
+ "f_3dB=f0 #kHz\n",
+ "#For Butterworth filter using sallen key\n",
+ "alfa=1.414; klp=1 #constant\n",
+ "Ap=3-alfa # band pass gain\n",
+ "RfBYRi=Ap-1 #ratio\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C\n",
+ "R=1/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R \n",
+ "#For offset minimization\n",
+ "#2*R=Rf||Ri=Rf/(RfBYRi+1)\n",
+ "Rf=2*R*(RfBYRi+1) #kohm\n",
+ "print \"Resistance Rf = %0.1f kohm \" %Rf \n",
+ "Ri=Rf/RfBYRi #kohm\n",
+ "print \"Resistance Ri = %0.1f kohm \" %Ri \n",
+ "#Answer in the book is not accurate. Some calculation mistake is there while working for offset minimization."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.05 micro F \n",
+ "Resistance R = 1.6 kohm \n",
+ "Resistance Rf = 5.0 kohm \n",
+ "Resistance Ri = 8.6 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.11 - page : 290"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "f0=2 #kHz(Critical frequency)\n",
+ "fH=f0 #kHz\n",
+ "f_3dB=f0 #kHz\n",
+ "#For Bessel filter of 2nd order\n",
+ "alfa=1.73; klp=0.785 #constant\n",
+ "Ap=3-alfa # band pass gain\n",
+ "RfBYRi=Ap-1 #ratio\n",
+ "print \"Various design parameters are :-\" \n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R=klp/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R\n",
+ "#For offset minimization\n",
+ "#2*R=Rf||Ri=Rf/(RfBYRi+1)\n",
+ "Rf=2*R*(RfBYRi+1) #kohm\n",
+ "print \"Resistance Rf = %0.2f kohm \" %Rf \n",
+ "Ri=Rf/RfBYRi #kohm\n",
+ "print \"Resistance Ri = %0.2f kohm \" %Ri\n",
+ "# Answer in the textbook are inaccurate."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.05 micro F \n",
+ "Resistance R = 1.25 kohm \n",
+ "Resistance Rf = 3.17 kohm \n",
+ "Resistance Ri = 11.75 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.12 - page : 291"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "f0=.12 #kHz(Cutoff frequency)\n",
+ "fH=f0 #kHz\n",
+ "#For Butterworth filter of 2nd order\n",
+ "alfa=1.414; klp=1 #constant\n",
+ "Ap=3-alfa # band pass gain\n",
+ "RfBYRi=Ap-1 #ratio\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.33 #micro F#Chosen for the design choosing between 0.01 & 1 micro F\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R=klp/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.f kohm \" %R \n",
+ "#For offset minimization\n",
+ "#2*R=Rf||Ri=Rf/(RfBYRi+1)\n",
+ "Rf=2*R*(RfBYRi+1) #kohm\n",
+ "print \"Resistance Rf = %0.2f kohm \" %Rf\n",
+ "Ri=Rf/RfBYRi #kohm\n",
+ "print \"Resistance Ri = %0.f kohm \" %Ri \n",
+ "# Answer in the textbook are inaccurate."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.33 micro F \n",
+ "Resistance R = 4 kohm \n",
+ "Resistance Rf = 12.75 kohm \n",
+ "Resistance Ri = 22 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.13 - page : 295"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt, floor\n",
+ "fL=20 #Hz(Cutoff frequency)\n",
+ "#For Butterworth filter of 2nd order\n",
+ "alfa=1.414; klp=1 #constant\n",
+ "Ap=3-alfa # band pass gain\n",
+ "RfBYRi=Ap-1 #ratio\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.22 #micro F#Chosen for the design choosing between 0.01 & 1 micro F\n",
+ "print \"Capacitance C = %0.2f micro F \" %C\n",
+ "R=klp/(2*pi*fL*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R \n",
+ "#For offset minimization\n",
+ "#R=Rf||Ri=Rf/(RfBYRi+1)\n",
+ "Rf=R*(RfBYRi+1) #kohm\n",
+ "print \"Resistance Rf = %0.f kohm \" %Rf \n",
+ "Ri=Rf/RfBYRi #kohm\n",
+ "Ri=floor(Ri) #kohm\n",
+ "print \"Resistance Ri = %0.f kohm \" %Ri "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.22 micro F \n",
+ "Resistance R = 36.17 kohm \n",
+ "Resistance Rf = 57 kohm \n",
+ "Resistance Ri = 97 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.14 - page : 297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "fH=2 #kHz(Cutoff frequency)\n",
+ "Ap=4 #Pass band gain\n",
+ "print \"Butterworth filter = cascading of 1st and 2nd order high pass filter.\"\n",
+ "#Butterworth polynomial is (s+1)*(s**2+s+1)\n",
+ "alfa=1 #for sallen key\n",
+ "Ap2=3-alfa #gain for 2nd order filter\n",
+ "Ap1=Ap/Ap2 #gain for 1st order filter\n",
+ "#Design parameters for 1st order filter : \n",
+ "print \"Various design parameters for 1st order filter are :-\"\n",
+ "C=0.01 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R=1/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R\n",
+ "R=8.2 #kohm\n",
+ "#Ap1=Rf/Ri+1 with Ap1=2 we have Rf=Ri\n",
+ "Rf=2*R #kohm\n",
+ "Ri=2*R #kohm\n",
+ "print \"Resistance Rf = %0.2f kohm & Ri = %0.2f kohm \" %(Rf,Ri) \n",
+ "#Design parameters for 2nd order filter : \n",
+ "kLp=1/alfa #unitless\n",
+ "#Ap2=Rfdash/Ridash+1 with Ap2=2 we have Rfdash=Ridash\n",
+ "print \"Various design parameters for 2nd order filter are :-\" \n",
+ "C=0.033 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.3f micro F \" %C \n",
+ "R=kLp/(2*pi*fH*10**3*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R\n",
+ "Rf=2*R #kohm\n",
+ "Ri=2*R #kohm\n",
+ "print \"Resistance Rfdash =%0.1f kohm & Ridash = %0.1f kohm \" %(Rf,Ri) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Butterworth filter = cascading of 1st and 2nd order high pass filter.\n",
+ "Various design parameters for 1st order filter are :-\n",
+ "Capacitance C = 0.01 micro F \n",
+ "Resistance R = 7.96 kohm \n",
+ "Resistance Rf = 16.40 kohm & Ri = 16.40 kohm \n",
+ "Various design parameters for 2nd order filter are :-\n",
+ "Capacitance C = 0.033 micro F \n",
+ "Resistance R = 2.41 kohm \n",
+ "Resistance Rfdash =4.8 kohm & Ridash = 4.8 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.15 - page : 301"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "fL=200 #Hz\n",
+ "fH=1 #kHz\n",
+ "Ap=4 #Pass band gain\n",
+ "fc=sqrt(fH*1000*fL) #Hz(Cutoff frequency)\n",
+ "BW=fH*1000-fL #Hz\n",
+ "Q=fc/BW #Quality Factor\n",
+ "print \"Quality factor is %0.2f \" %Q\n",
+ "print \"As Q<12, it is a wide band filter.\"\n",
+ "Ap1=2 #Pass band gain for high pass section\n",
+ "print \"Various design parameters for high pass section are :-\"\n",
+ "C=0.033 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.3f micro F \" %C\n",
+ "R=1/(2*pi*fL*C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.1f kohm \" %R \n",
+ "#Ap1=Rf/Ri+1 with Ap1=2 we have Rf=Ri\n",
+ "Rf=2*R #kohm\n",
+ "Ri=2*R #kohm\n",
+ "print \"Resistance Rf = %0.f kohm & Ri = %0.f kohm \" %(Rf,Ri) \n",
+ "Ap2=2 #Pass band gain for low pass section\n",
+ "print \"Various design parameters for low pass section are :-\"\n",
+ "C=0.033 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.3f micro F \" %C \n",
+ "K=fL/(fH*1000) #unitless\n",
+ "Rdash=K*R #kohm\n",
+ "print \"Resistance Rdash = %0.1f kohm \" %Rdash \n",
+ "#Ap1=Rf/Ri+1 with Ap1=2 we have Rf=Ri\n",
+ "Rf=2*Rdash #kohm\n",
+ "Ri=2*Rdash #kohm\n",
+ "print \"Resistance Rf = %0.f kohm & Ri = %0.f kohm \" %(Rf,Ri) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Quality factor is 0.56 \n",
+ "As Q<12, it is a wide band filter.\n",
+ "Various design parameters for high pass section are :-\n",
+ "Capacitance C = 0.033 micro F \n",
+ "Resistance R = 24.1 kohm \n",
+ "Resistance Rf = 48 kohm & Ri = 48 kohm \n",
+ "Various design parameters for low pass section are :-\n",
+ "Capacitance C = 0.033 micro F \n",
+ "Resistance Rdash = 4.8 kohm \n",
+ "Resistance Rf = 10 kohm & Ri = 10 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 48
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.16 - page : 306"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "print \"Part(a)\"\n",
+ "fc=1.2 #kHz\n",
+ "Q=4 #Quality Factor\n",
+ "Ap=10 #Pass band gain\n",
+ "print \"Here 2*Q**2=32>AP=10, hence it can be designed using single op-amp.\"\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.05 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "#fc/Q=1/(pi*R2*C)\n",
+ "R2=Q/(fc*1000)/pi/(C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R2 = %0.1f kohm \" %R2 \n",
+ "R1=R2/(2*Ap) #kohm\n",
+ "print \"Resistance R1 = %0.2f kohm \" %R1 \n",
+ "R3=R1*1000/(4*pi**2*R1*1000*R2*1000*(C*10**-6)**2*(fc*1000)**2-1) #ohm\n",
+ "print \"Resistance R3 = %0.2f ohm \" %R3 \n",
+ "print \"Part(b)\"\n",
+ "R3=460 #ohm\n",
+ "fc_new=1.5 #kHz\n",
+ "fc_old=1.2 #kHz\n",
+ "R3new=R3*(fc_old/fc_new)**2 #ohm\n",
+ "print \"Resistance R3 should be changed from %0.2f ohm to %0.2f ohm\" %(R3, R3new) \n",
+ "#Answer for R3 is wrong in the book"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Part(a)\n",
+ "Here 2*Q**2=32>AP=10, hence it can be designed using single op-amp.\n",
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.05 micro F \n",
+ "Resistance R2 = 21.2 kohm \n",
+ "Resistance R1 = 1.06 kohm \n",
+ "Resistance R3 = 482.29 ohm \n",
+ "Part(b)\n",
+ "Resistance R3 should be changed from 460.00 ohm to 294.40 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 52
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.17 - page : 308"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "fL=3 #kHz\n",
+ "fH=3.6 #kHz\n",
+ "Ap=-6 #Pass band gain\n",
+ "fc=sqrt(fH*fL)*1000 #Hz\n",
+ "BW=(fH-fL)*1000 #Hz\n",
+ "Q=fc/BW #Quality factor\n",
+ "print \"Quality factor is %0.2f\" %Q\n",
+ "print \"Here 1<=Q<=12 criteria fulfills, hence it can be designed using single op-amp.\"\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=0.01 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "#fc/Q=1/(pi*R2*C)\n",
+ "R2=1/pi/(BW)/(C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R2 = %0.f kohm \" %R2 \n",
+ "R1=-R2/(2*Ap) #kohm\n",
+ "print \"Resistance R1 = %0.2f kohm \" %R1 \n",
+ "R3=R1*1000/(4*pi**2*R1*1000*R2*1000*(C*10**-6)**2*(fc)**2-1) #ohm\n",
+ "print \"Resistance R3 = %0.f ohm \" %R3\n",
+ "print \"Design Verification : \"\n",
+ "print \"(i) Is 2*Q**2>|Ap| ?\\n\", 2*Q**2>abs(Ap) \n",
+ "print \"For op-amp 741, GBW=1 MHz\"\n",
+ "GBW=1 #MHz\n",
+ "print \"Is GBW*10**6>20*Q**2*fc ?\\n\",GBW*10**6>20*Q**2*fc\n",
+ "print \"2nd criteria failed. The op-amp should have higher GBW product. Use LF411\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Quality factor is 5.48\n",
+ "Here 1<=Q<=12 criteria fulfills, hence it can be designed using single op-amp.\n",
+ "Various design parameters are :-\n",
+ "Capacitance C = 0.01 micro F \n",
+ "Resistance R2 = 53 kohm \n",
+ "Resistance R1 = 4.42 kohm \n",
+ "Resistance R3 = 491 ohm \n",
+ "Design Verification : \n",
+ "(i) Is 2*Q**2>|Ap| ?\n",
+ "True\n",
+ "For op-amp 741, GBW=1 MHz\n",
+ "Is GBW*10**6>20*Q**2*fc ?\n",
+ "False\n",
+ "2nd criteria failed. The op-amp should have higher GBW product. Use LF411\n"
+ ]
+ }
+ ],
+ "prompt_number": 56
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.18 - page : 310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "Ap=-10 #Pass band gain\n",
+ "Q=22 #Quality factor\n",
+ "fc=50 #Hz\n",
+ "R=60 #dB/decade(Roll off rate)\n",
+ "print \"\"\"Roll off rate of single op-amp=20 dB/decade.\n",
+ "No. of stages will be 3.\n",
+ "Desired design can be obtained by cascading three stages.\"\"\"\n",
+ "n=3 #no. of op-amps(as single op-amp has 20 dB/decade)\n",
+ "fc1=fc #Hz\n",
+ "fc2=fc #Hz\n",
+ "fc3=fc #Hz\n",
+ "Q1=Q*sqrt(2**(1/n)-1) #Quality factor of each stage\n",
+ "Q2=Q1 #Quality factor\n",
+ "Q3=Q1 #Quality factor\n",
+ "Ap1=-(-Ap)**(1/n) #Band pass gain of each stage\n",
+ "Ap2=Ap1 #Band pass gain\n",
+ "Ap3=Ap1 #Band pass gain\n",
+ "#Design of a single op-amp\n",
+ "C=0.1 #micro F#Chosen for the design\n",
+ "print \"Various design parameters for a single stages are :\"\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R2=Q1/pi/(fc)/(C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R2 = %0.f kohm \" %R2 \n",
+ "R1=-R2/(2*Ap1) #kohm\n",
+ "print \"Resistance R1 = %.f kohm \" %R1 \n",
+ "R3=R1/(4*pi**2*R1*1000*R2*1000*(C*10**-6)**2*(fc)**2-1) #kohm\n",
+ "print \"Resistance R3 = %0.1f ohm \" %R3 \n",
+ "#Answer for R2 is wrong in the book."
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Roll off rate of single op-amp=20 dB/decade.\n",
+ "No. of stages will be 3.\n",
+ "Desired design can be obtained by cascading three stages.\n",
+ "Various design parameters for a single stages are :\n",
+ "Capacitance C = 0.10 micro F \n",
+ "Resistance R2 = 714 kohm \n",
+ "Resistance R1 = 166 kohm \n",
+ "Resistance R3 = 1.4 ohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 60
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex 9.20 - page : 326"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "from math import pi, sqrt\n",
+ "fNO=50 #Hz\n",
+ "Q=20 #Quality Factor\n",
+ "print \"Various design parameters are :-\"\n",
+ "C=1 #micro F#Chosen for the design\n",
+ "print \"Capacitance C = %0.2f micro F \" %C \n",
+ "R=1/(2*pi*fNO)/(C*10**-6)/1000 #kohm\n",
+ "print \"Resistance R = %0.2f kohm \" %R \n",
+ "#Q=(RA+RB)/4/RA\n",
+ "RA=1 #kohm(chosen for the design)\n",
+ "RB=Q*4*RA-RA #kohm\n",
+ "print \"Resistance RA = %0.f kohm \" %RA \n",
+ "print \"Resistance RB = %0.f kohm \" %RB"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Various design parameters are :-\n",
+ "Capacitance C = 1.00 micro F \n",
+ "Resistance R = 3.18 kohm \n",
+ "Resistance RA = 1 kohm \n",
+ "Resistance RB = 79 kohm \n"
+ ]
+ }
+ ],
+ "prompt_number": 62
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file