summaryrefslogtreecommitdiff
path: root/Electronic_Principles_/Chapter_21_New.ipynb
diff options
context:
space:
mode:
authorJovina Dsouza2014-06-18 12:43:07 +0530
committerJovina Dsouza2014-06-18 12:43:07 +0530
commit206d0358703aa05d5d7315900fe1d054c2817ddc (patch)
treef2403e29f3aded0caf7a2434ea50dd507f6545e2 /Electronic_Principles_/Chapter_21_New.ipynb
parentc6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff)
downloadPython-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2
Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip
adding book
Diffstat (limited to 'Electronic_Principles_/Chapter_21_New.ipynb')
-rw-r--r--Electronic_Principles_/Chapter_21_New.ipynb686
1 files changed, 686 insertions, 0 deletions
diff --git a/Electronic_Principles_/Chapter_21_New.ipynb b/Electronic_Principles_/Chapter_21_New.ipynb
new file mode 100644
index 00000000..23c2ea5f
--- /dev/null
+++ b/Electronic_Principles_/Chapter_21_New.ipynb
@@ -0,0 +1,686 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "CHAPTER 21 ACTIVE FILTERS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-1, Page 806"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.1.py\n",
+ "#what is the voltage gain, cutoff frequency & the frequency response?\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Rf=39.0 #feedback path resistance Rf (KOhm)\n",
+ "R1=1.0 #inverting input resistance R1(KOhm)\n",
+ "R2=12.0*10**3 #non-inverting input resistance R2(Ohm)\n",
+ "C=680*10**-12 #capacitance at non-inverting input(F)\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(Rf/R1)+1 # voltage gain\n",
+ "fc=(2*math.pi*R2*C)**-1 #cutoff frequency(Hz)\n",
+ "\n",
+ "#Result\n",
+ "print 'voltage gain Av = ',Av\n",
+ "print 'cutoff frequency fc = ',round((fc/1000),2),'KHz'\n",
+ "print 'frequency response:'\n",
+ "print 'voltage gain is 32 dB in pass band. response breaks at 19.5 KHz.'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage gain Av = 40.0\n",
+ "cutoff frequency fc = 19.5 KHz\n",
+ "frequency response:\n",
+ "voltage gain is 32 dB in pass band. response breaks at 19.5 KHz.\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-2, Page 807"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.2.py\n",
+ "#what is the voltage gain, cutoff frequency & frequency response?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "Rf=43.0 #feedback path resistance Rf (KOhm)\n",
+ "R1=0.220 #non-inverting input resistance R1(KOhm)\n",
+ "C=100*10**-12 #capacitance (F)\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(-Rf/R1) # voltage gain\n",
+ "fc=((2*math.pi*Rf*C)**-1)/10**6 #cutoff frequency(KHz)\n",
+ "\n",
+ "#Result\n",
+ "print 'voltage gain Av = ',round(Av,2)\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
+ "print 'voltage gain is 45.8 dB in pass band. response breaks at 37 KHz.'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage gain Av = -195.45\n",
+ "cutoff frequency fc = 37.01 KHz\n",
+ "voltage gain is 45.8 dB in pass band. response breaks at 37 KHz.\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-3, Page 811"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.3.py\n",
+ "#what are pole frequency, Q and cutoff frequency?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=30 #non-inverting input resistance R1(KOhm)\n",
+ "R2=30 #non-inverting input resistance R2(KOhm)\n",
+ "C2=1.64*10**-9 #feedback path capacitance (F)\n",
+ "C1=820*10**-12 #non-inverting input capacitance (F)\n",
+ "\n",
+ "#Calculation\n",
+ "Q=0.5*((C2/C1)**0.5) #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=fp #cutoff frequency(KHz)\n",
+ "\n",
+ "#Result\n",
+ "print ' Q = ',round(Q,3)\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = fp, ',round(fc,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Q = 0.707\n",
+ "pole frequency fp = 4.57 KHz\n",
+ "cutoff frequency fc = fp, 4.57 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-4, Page 811"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.4.py\n",
+ "#In figure 21-28, what are pole frequency, Q & cutoff frequency?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=51 #non-inverting input resistance R1(KOhm)\n",
+ "R2=51 #non-inverting input resistance R2(KOhm)\n",
+ "C2=440*10**-12 #feedback path capacitance (F)\n",
+ "C1=330*10**-12 #non-inverting input capacitance (F)\n",
+ "kc=0.786 #constant for bessel response \n",
+ "\n",
+ "#Calculation\n",
+ "Q=0.5*((C2/C1)**0.5) #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=kc*fp #cutoff frequency(KHz) \n",
+ "\n",
+ "#Result\n",
+ "print ' Q = ',round(Q,2)\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Q = 0.58\n",
+ "pole frequency fp = 8.19 KHz\n",
+ "cutoff frequency fc = 6.44 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-5, Page 812"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.5.py\n",
+ "#what are pole frequency and Q & cutoff and 3-dB frequencies?\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=22 #non-inverting input resistance R1(KOhm)\n",
+ "R2=22 #non-inverting input resistance R2(KOhm)\n",
+ "C2=27*10**-9 #feedback path capacitance (F)\n",
+ "C1=390*10**-12 #non-inverting input capacitance (F)\n",
+ "kc=1.38 #constant for bessel response \n",
+ "k0=0.99 #constant for bessel response\n",
+ "k3=1.54 #constant for bessel response\n",
+ "\n",
+ "#Calculation\n",
+ "Q=0.5*((C2/C1)**0.5) #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=kc*fp #cutoff frequency(KHz) \n",
+ "f3=k3*fp #3-dB frequency(KHz)\n",
+ "\n",
+ "#Result\n",
+ "print 'Q = ',round(Q,2)\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
+ "print '3-dB frequency f(3dB) = ',round(f3,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q = 4.16\n",
+ "pole frequency fp = 2.23 KHz\n",
+ "cutoff frequency fc = 3.08 KHz\n",
+ "3-dB frequency f(3dB) = 3.43 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-6, Page 817"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.6.py\n",
+ "#what are pole frequency, Q & cutoff frequency?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=47 #non-inverting input resistance R1(KOhm)\n",
+ "R2=47 #non-inverting input resistance R2(KOhm)\n",
+ "C2=330*10**-12 #feedback path capacitance (F)\n",
+ "C1=330*10**-12 #non-inverting input capacitance (F)\n",
+ "R3=51 #inverting input resistance R3(KOhm)\n",
+ "Rf=30.0 #feedback path resistance Rf (KOhm)\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(Rf/R3)+1 #voltage gain \n",
+ "Q=(3-Av)**-1 #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=fp #cutoff frequency(KHz) \n",
+ "\n",
+ "#Result\n",
+ "print ' Q = ',round(Q,2)\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ " Q = 0.71\n",
+ "pole frequency fp = 10.26 KHz\n",
+ "cutoff frequency fc = 10.26 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-7, Page 817"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.7.py\n",
+ "#In figure 21-33, what are pole frequency, Q & cutoff frequency?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=82 #non-inverting input resistance R1(KOhm)\n",
+ "R2=82 #non-inverting input resistance R2(KOhm)\n",
+ "C2=100*10**-12 #feedback path capacitance (F)\n",
+ "C1=100*10**-12 #non-inverting input capacitance (F)\n",
+ "R3=56 #inverting input resistance R3(KOhm)\n",
+ "Rf=15.0 #feedback path resistance Rf (KOhm)\n",
+ "kc=0.786 #constant for bessel response \n",
+ "\n",
+ "#Calculation\n",
+ "Av=(Rf/R3)+1 #voltage gain \n",
+ "Q=(3-Av)**-1 #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=kc*fp #cutoff frequency(KHz) \n",
+ "\n",
+ "#Result\n",
+ "print 'Q = ',round(Q,2)\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q = 0.58\n",
+ "pole frequency fp = 19.41 KHz\n",
+ "cutoff frequency fc = 15.26 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-8, Page 818"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.8.py\n",
+ "#In figure 21-34, what are pole frequency, Q, cutoff,resosnant & 3-dB frequencies, ripple depth in decibles?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=56 #non-inverting input resistance R1(KOhm)\n",
+ "R2=56 #non-inverting input resistance R2(KOhm)\n",
+ "C2=220*10**-12 #feedback path capacitance (F)\n",
+ "C1=220*10**-12 #non-inverting input capacitance (F)\n",
+ "R3=20.0 #inverting input resistance R3(KOhm)\n",
+ "Rf=39.0 #feedback path resistance Rf (KOhm)\n",
+ "kc=1.414 #constant for bessel response \n",
+ "k0=1.0 #constant for bessel response\n",
+ "k3=1.55 #constant for bessel response\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(Rf/R3)+1 #voltage gain \n",
+ "Q=(3-Av)**-1 #Q\n",
+ "fp=((2*math.pi*R1*(C1*C2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=kc*fp #cutoff frequency(KHz) \n",
+ "f0=k0*fp #resosnant frequency(KHz)\n",
+ "f3=k3*fp #3-dB frequency (KHz)\n",
+ "Av1=((1.01*Rf)/(0.99*R3))+1 #voltage gain considering 1% tolerance \n",
+ "Q1=(3-Av1)**-1 #Q\n",
+ "\n",
+ "#Result\n",
+ "print 'Q = ',Q\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
+ "print 'resonant frequency f0 = ',round(f0,2),'KHz'\n",
+ "print '3-dB frequency f(3-dB) = ',round(f3,2),'KHz'\n",
+ "print 'circuit produces 26-dB peak in response at 12.9 KHz, rolls off to 0 dB at cutoff and 3 dB down at 20 KHz'\n",
+ "print 'after considering tolerance in resistance, Q changed to',Q1,'approximately'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q = 20.0\n",
+ "pole frequency fp = 12.92 KHz\n",
+ "cutoff frequency fc = 18.27 KHz\n",
+ "resonant frequency f0 = 12.92 KHz\n",
+ "3-dB frequency f(3-dB) = 20.02 KHz\n",
+ "circuit produces 26-dB peak in response at 12.9 KHz, rolls off to 0 dB at cutoff and 3 dB down at 20 KHz\n",
+ "after considering tolerance in resistance, Q changed to 94.2857142857 approximately\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-9, Page 820"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.9.py\n",
+ "#what are pole frequency, Q & cutoff frequency?\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=24 #non-inverting input resistance R1(KOhm)\n",
+ "R2=12 #feedback path resistance R2(KOhm)\n",
+ "C=4.7*10**-9 #non-inverting input capacitance (F)\n",
+ "\n",
+ "#Calculation\n",
+ "Q=0.5*((R1/R2)**0.5) #Q\n",
+ "fp=((2*math.pi*C*(R1*R2)**0.5)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=fp #cutoff frequency(KHz) \n",
+ "\n",
+ "#Result\n",
+ "print 'Q = ',round(Q,2)\n",
+ "print 'pole frequency fp = ',math.ceil(fp),'KHz'\n",
+ "print 'cutoff frequency fc = ',math.ceil(fc),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q = 0.71\n",
+ "pole frequency fp = 2.0 KHz\n",
+ "cutoff frequency fc = 2.0 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-10, Page 821"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.10.py\n",
+ "#In figure 21-37, what are pole frequency, Q, cutoff,resosnant & 3-dB frequencies and ripple depth in decibles?\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=30 #non-inverting input resistance R1(KOhm)\n",
+ "R2=30 #feedback path resistance R2(KOhm)\n",
+ "C=1*10**-9 #non-inverting input capacitance (F)\n",
+ "R3=10.0 #inverting input resistance R3(KOhm)\n",
+ "Rf=15.0 #feedback path resistance Rf (KOhm)\n",
+ "kc=1.32 #constant for bessel response \n",
+ "k0=0.94 #constant for bessel response\n",
+ "k3=1.48 #constant for bessel response\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(Rf/R3)+1 #voltage gain \n",
+ "Q=(3-Av)**-1 #Q\n",
+ "fp=((2*math.pi*R1*C)**-1)/10**6 #pole frequency(KHz)\n",
+ "fc=fp/kc #cutoff frequency(KHz) \n",
+ "f0=fp/k0 #resosnant frequency(KHz)\n",
+ "f3=fp/k3 #3-dB frequency (KHz)\n",
+ "\n",
+ "#Result\n",
+ "print 'Q = ',Q\n",
+ "print 'pole frequency fp = ',round(fp,2),'KHz'\n",
+ "print 'cutoff frequency fc = ',round(fc,2),'KHz'\n",
+ "print 'resonant frequency f0 = ',round(f0,2),'KHz'\n",
+ "print '3-dB frequency f(3-dB) = ',round(f3,2),'KHz'\n",
+ "print 'circuit produces 6.3-dB peak in response at 5.65 KHz, rolls off to 0 dB at cutoff at 4.02 KHz and 3 dB down at 3.59 KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Q = 2.0\n",
+ "pole frequency fp = 5.31 KHz\n",
+ "cutoff frequency fc = 4.02 KHz\n",
+ "resonant frequency f0 = 5.64 KHz\n",
+ "3-dB frequency f(3-dB) = 3.58 KHz\n",
+ "circuit produces 6.3-dB peak in response at 5.65 KHz, rolls off to 0 dB at cutoff at 4.02 KHz and 3 dB down at 3.59 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-11, Page 825"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.11.py\n",
+ "#In figure 21-42, gate voltage varies from 15 to 80 Ohm. Find bandwidth and minimum & maximum frequencies.\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R1=18 #non-inverting input resistance R1(KOhm)\n",
+ "R2=30 #feedback path resistance R2(KOhm)\n",
+ "C=8.2*10**-9 #non-inverting input capacitance (F)\n",
+ "R31=0.080 #inverting max input resistance R3(KOhm)\n",
+ "R32=0.015 #inverting min input resistance R3(KOhm)\n",
+ "\n",
+ "#Calculation\n",
+ "BW=((2*math.pi*R1*C)**-1)/10**6 #bandwidth(KHz)\n",
+ "f0=((2*math.pi*C*((2*R1*((R1**-1+R31**-1)**-1))**0.5))**-1)/10**6 #minimum center frequency(KHz)\n",
+ "f01=((2*math.pi*C*((2*R1*((R1**-1+R32**-1)**-1))**0.5))**-1)/10**6 #minimum center frequency(KHz)\n",
+ "\n",
+ "#Result\n",
+ "print 'bandwidth BW = ',round(BW,2),'KHz'\n",
+ "print 'minimum center frequency f0 = ',round(f0,2),'KHz'\n",
+ "print 'maximum center frequency f0 = ',round(f01,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "bandwidth BW = 1.08 KHz\n",
+ "minimum center frequency f0 = 11.46 KHz\n",
+ "maximum center frequency f0 = 26.42 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-12, Page 827"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.12.py\n",
+ "#In figure 21-43, what are the voltage gain, center frequency and Q for bandstop filter, \n",
+ "#if R=22KOhm, C=120nF, R1=13KOhm, R2=10KOhm.\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R=22.0 #non-inverting input resistance(KOhm)\n",
+ "C=120*10**-9 #non-inverting input capacitance (F)\n",
+ "R1=13.0 #inverting input resistance(KOhm)\n",
+ "R2=10.0 #feedback path resistance(KOhm)\n",
+ "\n",
+ "#Calculation\n",
+ "Av=(R2/R1)+1 #voltage gain \n",
+ "Q=0.5/(2-Av) #Q\n",
+ "f0=((2*math.pi*R*C)**-1)/10**3 #center frequency(KHz)\n",
+ "\n",
+ "#Result\n",
+ "print 'voltage gain Av = ',round(Av,2)\n",
+ "print 'Q = ',round(Q,2)\n",
+ "print 'center frequency f0 = ',round(f0,2),'KHz'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "voltage gain Av = 1.77\n",
+ "Q = 2.17\n",
+ "center frequency f0 = 60.29 KHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 21-13, Page 833"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#Example 21.13.py\n",
+ "#In figure 21-45b, R=1KOhm, C=100nF. what is phase shift of output voltage when f=1KHz?\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Variable declaration\n",
+ "R=1.0 #non-inverting input resistance(KOhm)\n",
+ "C=100*10**-9 #non-inverting input capacitance (F)\n",
+ "f=1.0 #frequency given(KHz)\n",
+ "\n",
+ "#Calculation\n",
+ "f0=((2*math.pi*R*C)**-1)/10**6 #center frequency(KHz)\n",
+ "phi=(2*math.atan(f0/f))*180/math.pi #phase shift(deg)\n",
+ "\n",
+ "#Result\n",
+ "print 'center frequency f0 = ',round(f0,2),'KHz'\n",
+ "print 'phase shift = ',math.ceil(phi),'degrees'"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "center frequency f0 = 1.59 KHz\n",
+ "phase shift = 116.0 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file