{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 9 : Analyzers" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_1,pg 501" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# variable frequency oscillator\n", "\n", "import math\n", "#Variable declaration\n", "fc=1.3*10**6 #centre frequency\n", "fsignal=1*10**6 #frequency of the signal\n", "fvfo=0.3*10**6 #frequency of variable frequency oscillator\n", "\n", "#Calculations\n", "per=(fvfo/fc)*100\n", "\n", "#Result\n", "print(\"percent variation:\")\n", "print(\"per = %.2f%%\"%(math.floor(per*100)/100))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "percent variation:\n", "per = 23.07%\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_2,pg 502" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# DFT coefficients\n", "\n", "import math\n", "#Variable declaration\n", "N=22.0 #no. of acquistioned data\n", "delt=2*10**-3 #time period\n", "n=4.0 #4th DFT coeff.\n", "q=3.0 #no. of discrete points\n", "\n", "#Calculations\n", "#An=(2/N)*V(n)*cos((2*%pi*n*q)/N)\n", "#Bn=(2/N)*V(n)*sin((2*%pi*n*q)/N)\n", "\n", "#Result\n", "print(\"A4=(1/11)V(4)cos(12pi/11)\\n\")\n", "print(\"B4=(1/11)V(4)sin(12pi/11)\\n\")\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "A4=(1/11)V(4)cos(12pi/11)\n", "\n", "B4=(1/11)V(4)sin(12pi/11)\n", "\n" ] } ], "prompt_number": 1 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_3,pg 502" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# find improvement ratio\n", "\n", "import math\n", "#Variable declaration\n", "N=64.0 #data units\n", "#implimentation steps for DFT=64^2\n", "\n", "#Calculations\n", "#for FFT\n", "r= math.log(N,2)/N #implimentation ratio\n", "\n", "#Result\n", "print(\"implimentation ratio:\")\n", "print(\"r = %.5f or (3/32)\"%r)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "implimentation ratio:\n", "r = 0.09375 or (3/32)\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_4,pg 502" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# find distortion factor\n", "\n", "import math\n", "#Variable declaration\n", "D3=1.3*10**-2 #3rd harmonic(unit value)\n", "D5=0.31*10**-2 #5th harmonic(unit value)\n", "D7=0.04*10**-2 #7th harmonic(unit value)\n", "\n", "#Calculations\n", "Dt=math.sqrt((D3**2)+(D5**2)+(D7**2))\n", "\n", "#Result\n", "print(\"distortion ratio:\")\n", "print(\"Dt = %.5f \"%Dt)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "distortion ratio:\n", "Dt = 0.01337 \n" ] } ], "prompt_number": 8 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_5,pg 502" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# find percentage change in feedback\n", "import math\n", "#Variable declaration\n", "Q=10.0 #Q-factor\n", "m=5.0 #improvement factor\n", "a=(1.0/((3*Q)-1)) #filter factor\n", "\n", "\n", "#Calculations\n", "Qr=Q*m #rejection Q-factor\n", "ar=(1.0/((3*Qr)-1)) #rejection filter factor\n", "perf=((a-ar)/a)*100 #percent change in feedback\n", "\n", "#Result\n", "print(\"percent change in feedback:\")\n", "print(\"perf = %.2f \"%perf)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "percent change in feedback:\n", "perf = 80.54 \n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example9_6,pg 503" ] }, { "cell_type": "code", "collapsed": false, "input": [ "# time uncertainity and measurable time\n", "\n", "import math\n", "#Variable declaration\n", "fc=100.0*10**6 #clock frequency\n", "Nm=4.0*10**6 #memory size\n", "\n", "#Calculations\n", "Te=(1.0/fc) #timing uncertainity\n", "Tm=(Nm/fc) #measurable time\n", "\n", "#Result\n", "print(\"timing uncertainity:\")\n", "print(\"Te = %.f ns\\n\"%(Te*10**9))\n", "print(\"measurable time:\")\n", "print(\"Tm = %.f m\"%(Tm*10**3))" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "timing uncertainity:\n", "Te = 10 ns\n", "\n", "measurable time:\n", "Tm = 40 m\n" ] } ], "prompt_number": 7 } ], "metadata": {} } ] }