summaryrefslogtreecommitdiff
path: root/Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-28 16:53:23 +0530
committerThomas Stephen Lee2015-08-28 16:53:23 +0530
commitdb0855dbeb41ecb8a51dde8587d43e5d7e83620f (patch)
treeb95975d958cba9af36cb1680e3f77205354f6512 /Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb
parent5a86a20b9de487553d4ef88719fb0fd76a5dd6a7 (diff)
downloadPython-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.gz
Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.tar.bz2
Python-Textbook-Companions-db0855dbeb41ecb8a51dde8587d43e5d7e83620f.zip
add books
Diffstat (limited to 'Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb')
-rw-r--r--Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb618
1 files changed, 618 insertions, 0 deletions
diff --git a/Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb b/Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb
new file mode 100644
index 00000000..4b5636a7
--- /dev/null
+++ b/Linear_Integrated_Circuits_by_J._B._Gupta/chapter06.ipynb
@@ -0,0 +1,618 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter- 6 : Active Filters"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.1 - Page No 203"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import pi\n",
+ "# Given data\n",
+ "f_H= 2 # in kHz\n",
+ "f_H= f_H*10**3 # in Hz\n",
+ "C=0.01 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "R= 1/(2*pi*f_H*C) # in ohm\n",
+ "R=R*10**-3 # in kohm\n",
+ "# R may be taken a pot of 10 k ohm\n",
+ "R=10 # in k ohm\n",
+ "# Since the passbond gain is 2.5, so\n",
+ "# 1+Rf/R1= 2.5 or Rf= 1.5*R1\n",
+ "# Since Rf||R1\n",
+ "R1= R*2.5/1.5 # in k ohm\n",
+ "Rf= R1*1.5 # in k ohm\n",
+ "print \"Value of R1 = %0.2f k ohm (Standard value 18 k ohm)\" %R1\n",
+ "print \"Value of Rf = %0.f k ohm (Standard value 27 k ohm)\" %Rf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of R1 = 16.67 k ohm (Standard value 18 k ohm)\n",
+ "Value of Rf = 25 k ohm (Standard value 27 k ohm)\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.2 - Page No 205\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Given data\n",
+ "f_H= 2 # in kHz\n",
+ "f_H= f_H*10**3 # in Hz\n",
+ "C=0.033 # in micor F\n",
+ "C=C*10**-6 # in F\n",
+ "C_desh= C \n",
+ "R= 1/(2*pi*f_H*C) # in ohm\n",
+ "R=R*10**-3 # in kohm\n",
+ "R=2.7 # k ohm (Standard value)\n",
+ "R_desh= R \n",
+ "# So 2*R= Rf*R1/(Rf+R1) = 0.586*R1**2/(1.586*R1)\n",
+ "R1= 2*R*1.586/(0.586) # in k ohm\n",
+ "print \"The value of R1 = %0.1f k ohm (Standard value 15 k ohm) \" %R1\n",
+ "R1= 15 # k ohm (Standard value)\n",
+ "Rf= 0.586*R1 # in k ohm\n",
+ "print \"The value of Rf = %0.2f k ohm (Standard value 10 k ohm) \" % Rf "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R1 = 14.6 k ohm (Standard value 15 k ohm) \n",
+ "The value of Rf = 8.79 k ohm (Standard value 10 k ohm) \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.3 - Page No 205 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "# Given data\n",
+ "f_H= 1 # in kHz\n",
+ "f_H= f_H*10**3 # in Hz\n",
+ "C=0.0047 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "C_desh= C \n",
+ "R= 1/(2*pi*f_H*C) # in ohm\n",
+ "R=R*10**-3 # in kohm\n",
+ "R=math.floor(R) \n",
+ "R_desh= R \n",
+ "R1=R # in k ohm\n",
+ "Rf= 0.586*R1 # in k ohm\n",
+ "Rf= math.ceil(Rf) # in k ohm\n",
+ "print \"Value of R' = R = %0.f k ohm\" %R\n",
+ "print \"Value of C' = C = %0.4f micro F\" %(C*10**6)\n",
+ "print \"Value of R1 = %0.f k ohm\" %R1\n",
+ "print \"Value of Rf = %0.1f k ohm\" %Rf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of R' = R = 33 k ohm\n",
+ "Value of C' = C = 0.0047 micro F\n",
+ "Value of R1 = 33 k ohm\n",
+ "Value of Rf = 20.0 k ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.4 - Page No 206\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "f= 1 # in kHz\n",
+ "f= f*10**3 # in Hz\n",
+ "# Vout/Vin= 10\n",
+ "R1= 100 # in k ohm\n",
+ "R1=R1*10**3 # in ohm\n",
+ "R2= 1000 # in k ohm\n",
+ "R2=R2*10**3 # in ohm\n",
+ "omega= 2*pi*f \n",
+ "# Vout/Vin at a 3 dB frequency of 1 kHz = 1/sqrt(2) = omega*R2*C/sqrt(1+omega**2*R1**2*C2)\n",
+ "C= math.sqrt(1/(omega**2*(2*R2**2-R1**2))) # in F\n",
+ "print \"Value of R1 = %0.f k ohm\" %(R1*10**-3)\n",
+ "print \"Value of R2 = %0.f k ohm\" %(R2*10**-6)\n",
+ "print \"Value of C = %0.4e F\" %C"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of R1 = 100 k ohm\n",
+ "Value of R2 = 1 k ohm\n",
+ "Value of C = 1.1282e-10 F\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.5 - Page No 207\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R= 2.1 # in k ohm\n",
+ "R=R*10**3 # in ohm\n",
+ "R1= 20 # in k ohm\n",
+ "R1=R1*10**3 # in ohm\n",
+ "Rf= 60 # in k ohm\n",
+ "Rf=Rf*10**3 # in ohm\n",
+ "C=0.05 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "fL= 1/(2*pi*R*C) # in Hz\n",
+ "print \"Low cut-off frequency = %0.3f kHz\" %(fL*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Low cut-off frequency = 1.516 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.6 - Page No 211\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R= 10 # in k ohm\n",
+ "R=R*10**3 # in ohm\n",
+ "R_desh= R # in ohm\n",
+ "C=0.1 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "C_desh=0.0025 # in micro F\n",
+ "C_desh=C_desh*10**-6 # in F\n",
+ "fH= 1/(2*pi*R_desh*C_desh) # in Hz\n",
+ "print \"Higher cut-off frequency = %0.3f kHz\"%(fH*10**-3)\n",
+ "fL= 1/(2*pi*R*C) # in Hz\n",
+ "print \"Lower cut-off frequency = %0.2f Hz\" %fL\n",
+ "BW= fH-fL \n",
+ "print \"Bandwidth = %0.1f kHz\" %(BW*10**-3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Higher cut-off frequency = 6.366 kHz\n",
+ "Lower cut-off frequency = 159.15 Hz\n",
+ "Bandwidth = 6.2 kHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.7 - Page No 212\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "fc= 1 # in kHz\n",
+ "fc=fc*10**3 # in Hz\n",
+ "Q=5 \n",
+ "Af=8 \n",
+ "# Let C=C1=C2=0.01 # in micro F\n",
+ "C1= 0.01 # in micro F\n",
+ "C1=C1*10**-6 # in F\n",
+ "C2=C1 # in F\n",
+ "C=C2 # in F\n",
+ "R1= Q/(2*pi*fc*C*Af) # in ohm\n",
+ "R1=R1*10**-3 # in kohm\n",
+ "R1=math.ceil(R1) \n",
+ "R2= Q/(2*pi*fc*C*(2*Q**2-Af)) # in ohm\n",
+ "R2=R2*10**-3 # in kohm\n",
+ "R2=math.ceil(R2) \n",
+ "R3= Q/(pi*fc*C) # in ohm\n",
+ "R3=R3*10**-3 # in kohm\n",
+ "R3=math.ceil(R3) \n",
+ "# The value of R2_desh required to change the centre frequency from 1 kHz to 2 kHz is\n",
+ "f_desh_c= 2000 # in Hz\n",
+ "R2_desh= R2*(fc/f_desh_c)**2 # in kohm\n",
+ "print \"Value of R1 = %0.f kohm\" %R1\n",
+ "print \"Value of R2 = %0.f kohm\" %R2\n",
+ "print \"Value of R3 = %0.f kohm\" %R3\n",
+ "print \"Value of R2_desh = %0.f ohm\" %(R2_desh*10**3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of R1 = 10 kohm\n",
+ "Value of R2 = 2 kohm\n",
+ "Value of R3 = 160 kohm\n",
+ "Value of R2_desh = 500 ohm\n"
+ ]
+ }
+ ],
+ "prompt_number": 30
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.8 - Page No 212\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "C= 0.1 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "R1= 2 # in kohm\n",
+ "R1=R1*10**3 # in ohm\n",
+ "R2= 2/3 # in kohm\n",
+ "R2=R2*10**3 # in ohm\n",
+ "R3= 200 # in kohm\n",
+ "R3=R3*10**3 # in ohm\n",
+ "# R1= Q/(2*pi*fc*C*Af) (i)\n",
+ "# R2= Q/(2*pi*fc*C*(2*Q**2-Af)) (ii)\n",
+ "# R3= Q/(pi*fc*C) (iii)\n",
+ "# From (i) and (iii)\n",
+ "Af= R3/(2*R1) \n",
+ "# From (ii) and (iii)\n",
+ "Q= math.sqrt(1/2*(R3/(2*R2)+Af)) \n",
+ "# From (iii)\n",
+ "fc= Q/(R3*pi*C) # in Hz\n",
+ "omega_o= 2*pi*fc # in radians/second\n",
+ "print \"The value of gain = %0.f\" %Af \n",
+ "print \"Value of Q = %0.f\" %Q\n",
+ "print \"Centre frequency = %0.f radians/second\" %omega_o"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of gain = 50\n",
+ "Value of Q = 10\n",
+ "Centre frequency = 1000 radians/second\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.9 - Page No 213\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import pi\n",
+ "# Given data\n",
+ "fL= 200 # in Hz\n",
+ "fH= 1 # in kHz\n",
+ "fH=fH*10**3 # in Hz\n",
+ "#Let the capacitor C_desh be of 0.01 micro F \n",
+ "C_desh= 0.01*10**-6 # in F\n",
+ "R_desh= 1/(2*pi*fH*C_desh) # in ohm\n",
+ "R_desh=R_desh*10**-3 # in kohm\n",
+ "R_desh= 18 # in kohm\n",
+ "# Let \n",
+ "C=0.05*10**-6 # in F\n",
+ "R= 1/(2*pi*fL*C) # in ohm\n",
+ "R=R*10**-3 # in kohm\n",
+ "R= 18 # in k ohm\n",
+ "Rf= 10 # in kohm\n",
+ "print \"Value of Rf' = Rf = R1' = R1 = %0.f kohm\" %Rf\n",
+ "print \"Value of R = R' = %0.f kohm\" %R\n",
+ "print \"Value of C'= %0.2f micro F\" %(C_desh*10**6)\n",
+ "print \"Value of C = %0.2f micro F\" %(C*10**6)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of Rf' = Rf = R1' = R1 = 10 kohm\n",
+ "Value of R = R' = 18 kohm\n",
+ "Value of C'= 0.01 micro F\n",
+ "Value of C = 0.05 micro F\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.11 - Page No 214\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "fL= 200 # in Hz\n",
+ "fH= 1 # in kHz\n",
+ "fH=fH*10**3 # in Hz\n",
+ "fc= math.sqrt(fL*fH) # in Hz\n",
+ "Q= fc/(fH-fL) \n",
+ "print \"The value of Q for filter = %0.3f\" %Q"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of Q for filter = 0.559\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.12 - Page No 216\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "f_H= 200 # in Hz\n",
+ "f_L= 2*10**3 # in Hz\n",
+ "C= 0.05*10**-6 # in F\n",
+ "# For low-pass filter,\n",
+ "R_desh= 1/(2*pi*f_H*C) # in \u03a9\n",
+ "R_desh= R_desh*10**-3 # in k\u03a9\n",
+ "print \"The value of R' = %0.1f k\u03a9 (standard value 20 k\u03a9)\" %R_desh\n",
+ "# For high-pass filter,\n",
+ "R= 1/(2*pi*f_L*C) # in \u03a9\n",
+ "R= R*10**-3 # in k\u03a9\n",
+ "print \"The value of R = %0.2f k\u03a9 (standard value 1.8 k\u03a9)\" %R"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R' = 15.9 k\u03a9 (standard value 20 k\u03a9)\n",
+ "The value of R = 1.59 k\u03a9 (standard value 1.8 k\u03a9)\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.13 - Page No 218"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from numpy import pi\n",
+ "# Given data\n",
+ "C= 0.068*10**-6 # in F\n",
+ "f_N= 50 # in Hz\n",
+ "R= 1/(2*pi*f_N*C) # in \u03a9\n",
+ "R= R*10**-3 # in k\u03a9\n",
+ "print \"The value of R = %0.1f k\u03a9 (standard value 47 k\u03a9)\" %R"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of R = 46.8 k\u03a9 (standard value 47 k\u03a9)\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.14 - Page No 218 "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "fN= 60 # in Hz\n",
+ "# Let\n",
+ "C= 0.06 # in micro F\n",
+ "C=C*10**-6 # in F\n",
+ "R= 1/(2*pi*fN*C) # in ohm\n",
+ "R=R*10**-3 # in kohm\n",
+ "print \"Value of R = %0.2f kohm (Standard value 47 kohm)\" %R\n",
+ "print \"For R/2, two 47 kohm resistors connected in parallel may be used and for 2C component, \"\n",
+ "print \"two parallel connected %0.2f micro F capacitors may be used\" %(C*10**6)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Value of R = 44.21 kohm (Standard value 47 kohm)\n",
+ "For R/2, two 47 kohm resistors connected in parallel may be used and for 2C component, \n",
+ "two parallel connected 0.06 micro F capacitors may be used\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example : 6.15 - Page No 219"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Given data\n",
+ "R= 15*10**3 # in \u03a9\n",
+ "C= 0.01*10**-6 # in F\n",
+ "f= 2*10**3 # in Hz\n",
+ "PhaseShift= -2*(math.atan(2*pi*f*R*C))*180/pi # in \u00b0\n",
+ "print \"The phase shift = %0.f\u00b0\" %PhaseShift\n",
+ "print \"i.e. %0.f\u00b0 (lagging)\" %abs(PhaseShift)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The phase shift = -124\u00b0\n",
+ "i.e. 124\u00b0 (lagging)\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file