{ "metadata": { "name": "notes_fourier_kernel" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "The Discretization Kernel" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We've shown that the discrete Fourier transform\n", "$$\n", " \\widehat{h}_k = \\sum\\_{i=0}^{N-1} h(t_0+j\\delta t)\\\\,e^{-i2\\pi jk/N}\n", "$$\n", "and the continuous Fourier transform\n", "$$\n", " \\widetilde{h}(f) = \\int_{-\\infty}^{\\infty} h(t)\\\\,e^{i2\\pi f(t-t_0)}\\\\,df\n", "$$\n", "are related by\n", "$$\n", " \\widehat{h}\\_k = \\int\\_{-\\infty}^{\\infty}\n", " \\Delta\\_N([f_k-f]\\delta t)\n", " \\\\,\\widetilde{h}(f)\\\\,df\n", "$$\n", "where\n", "$$\n", " \\Delta_N(x) = \\sum_{j=0}^{N-1} e^{-i2\\pi jx}\n", " =\\begin{cases}\n", " N\\\\ , & x\\in\\mathbb{Z} \\\\\\\\\n", " e^{-i\\pi (N-1)x} \\left(\\frac{\\sin \\pi Nx}{\\sin \\pi x}\\right)\n", " \\\\ , & x\\notin\\mathbb{Z}\n", " \\end{cases}\n", "$$\n", "and in particular that the periodogram for wide-sense stationary data is related to the PSD by\n", "$$\n", "\\langle|\\widehat{h}\\_k|^2\\rangle\n", "= \\int\\_{-\\infty}^{\\infty} |\\Delta_N([f\\_k-f]\\delta t)|^2\\\\,S\\_h(f)\\\\,df\n", "$$\n", "So let's get a handle on $|\\Delta_N(x)|^2=\\left(\\frac{\\sin \\pi Nx}{\\sin \\pi x}\\right)^2$ by plotting it in matplotlib.\n", "\n", "First, let's plot it for $N=16$:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "%pylab inline\n", "from __future__ import division\n", "rcParams['figure.figsize'] = (10.0, 8.0)\n", "rcParams['font.size'] = 14\n", "x=linspace(-1.5,1.5,5e3)\n", "D16 = (sin(16*pi*x)/sin(pi*x))**2\n", "plot(x,D16,'k-',label=r'$N=16$')\n", "legend()\n", "xlabel(r'$x$')\n", "ylabel(r'$|\\Delta_N(x)|^2$')\n", "yticks(arange(5)*64)\n", "ylim([0,300])\n", "grid(True)" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We see that $|\\Delta\\_N(x)|^2$ is indeed periodic, with period 1, and has the value $N^2=16^2=256$ for integer $x$.\n", "It's also pretty sharply peaked at integer values, and if we zoom in and compare $N=16$ to $N=64$, we see that it becomes more sharply peaked as $N$ gets larger:" ] }, { "cell_type": "code", "collapsed": false, "input": [ "D64 = (sin(64*pi*x)/sin(pi*x))**2\n", "plot(x,D16,'k-',label=r'$N=16$')\n", "plot(x,D64,'b-',label=r'$N=64$')\n", "legend()\n", "xlabel(r'$x$')\n", "ylabel(r'$|\\Delta_N(x)|^2$')\n", "yticks(arange(5)*1024)\n", "ylim([0,4200])\n", "xlim([-1./8,1./8.])\n", "grid(True)\n", "tickvals=arange(-3,4)/32.\n", "ticklabs = [(r'$%d/32$' % x) for x in range(-3,4)]\n", "xticks(tickvals,ticklabs);" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So in the limit of large $N$, $|\\Delta\\_N(x)|$ is, up to a constant, an approximation for an infinite sum of Dirac delta functions (what Gregory calls a \"bed of nails\")." ] } ], "metadata": {} } ] }