The Fast Fourier Transform

The Fast Fourier Transform

Scientific Computing: The Fast Fourier Transform Aleksandar Donev Courant Institute, NYU1 [email protected] 1Course MATH-GA.2043 or CSCI-GA.2112, Fall 2019 October 31st, 2019 A. Donev (Courant Institute) Lecture IX 10/31/2019 1 / 44 Outline 1 Fourier Series 2 Discrete Fourier Transform 3 Fast Fourier Transform 4 Applications of FFT 5 Wavelets 6 Conclusions A. Donev (Courant Institute) Lecture IX 10/31/2019 2 / 44 Fourier Series Fourier Composition A. Donev (Courant Institute) Lecture IX 10/31/2019 3 / 44 Fourier Series Fourier Decomposition A. Donev (Courant Institute) Lecture IX 10/31/2019 4 / 44 Fourier Series Periodic Functions Consider now interpolating / approximating periodic functions defined on the interval I = [0; 2π]: 8x f (x + 2π) = f (x); as appear in practice when analyzing signals (e.g., sound/image processing). Also consider only the space of complex-valued square-integrable 2 functions L2π, Z 2π 2 2 2 8f 2 Lw :(f ; f ) = kf k = jf (x)j dx < 1: 0 Polynomial functions are not periodic and thus basis sets based on orthogonal polynomials are not appropriate. Instead, consider sines and cosines as a basis function, combined together into complex exponential functions ikx φk (x) = e = cos(kx) + i sin(kx); k = 0; ±1; ±2;::: A. Donev (Courant Institute) Lecture IX 10/31/2019 5 / 44 Fourier Series Fourier Basis Functions ikx φk (x) = e ; k = 0; ±1; ±2;::: It is easy to see that these are orhogonal with respect to the continuous dot product Z 2π Z 2π ? (φj ; φk ) = φj (x)φk (x)dx = exp [i(j − k)x] dx = 2πδij x=0 0 The complex exponentials can be shown to form a complete 2 trigonometric polynomial basis for the space L2π, i.e., 1 2 X ^ ikx 8f 2 L2π : f (x) = fk e ; k=−∞ where the Fourier coefficients can be computed for any frequency or wavenumber k using: Z 2π (f ; φk ) 1 −ikx f^k = = : f (x)e dx: 2π 2π 0 A. DonevNote (Courant that Institute) there are differentLecture conventions IX in how various10/31/2019 factors of 6 / 44 2π are placed! Be consistent! Fourier Series Fourier Decomposition A. Donev (Courant Institute) Lecture IX 10/31/2019 7 / 44 Discrete Fourier Transform Truncated Fourier Basis For a general interval [0; X ] the discrete frequencies are 2π k = κ κ = 0; ±1; ±2;::: X For non-periodic functions one can take the limit X ! 1 in which case we get continuous frequencies. Now consider a discrete Fourier basis that only includes the first N basis functions, i.e., ( k = −(N − 1)=2;:::; 0;:::; (N − 1)=2 if N is odd k = −N=2;:::; 0;:::; N=2 − 1 if N is even; and for simplicity we focus on N odd. The least-squares spectral approximation for this basis is: (N−1)=2 X ikx f (x) ≈ φ(x) = f^k e : k=−(N−1)=2 A. Donev (Courant Institute) Lecture IX 10/31/2019 8 / 44 Discrete Fourier Transform Discrete Fourier Basis Let us discretize a given function on a set of N equi-spaced nodes as a vector 2π f = f (x ) where x = jh and h = : j j j N Observe that j = N is the same node as j = 0 due to periodicity so we only consider N instead of N + 1 nodes. Now consider a discrete Fourier basis that only includes the first N basis functions, i.e., ( k = −(N − 1)=2;:::; 0;:::; (N − 1)=2 if N is odd k = −N=2;:::; 0;:::; N=2 − 1 if N is even: Focus on N odd and denote K = (N − 1)=2: Discrete dot product between discretized \functions": N−1 X ? f · g = h fi gi j=0 A. Donev (Courant Institute) Lecture IX 10/31/2019 9 / 44 Discrete Fourier Transform Fourier Interpolant 1 2 X ^ ikx 8f 2 L2π : f (x) = fk e k=−∞ We will try to approximate periodic functions with a truncated Fourier series: K K X X ikx f (x) ≈ φ(x) = φk (x) = f^k e : k=−K k=−K The discrete Fourier basis is φ−K ;:::; φK , (φk )j = exp (ikxj ) ; and it is a discretely orthonormal basis in which we can represent periodic functions, φk · φk0 = 2πδk;k0 A. Donev (Courant Institute) Lecture IX 10/31/2019 10 / 44 Discrete Fourier Transform Proof of Discrete Orthogonality The case k = k0 is trivial, so focus on 0 φk · φk0 = 0 for k 6= k N−1 X 0 X X j exp (ikxj ) exp −ik xj = exp [i (∆k) xj ] = [exp (ih (∆k))] j j j=0 where ∆k = k − k0. This is a geometric series sum: N 1 − z 0 φ · φ 0 = = 0 if k 6= k k k 1 − z since z = exp (ih (∆k)) 6= 1 and zN = exp (ihN (∆k)) = exp (2πi (∆k)) = 1. A. Donev (Courant Institute) Lecture IX 10/31/2019 11 / 44 Discrete Fourier Transform Fourier Matrix Let us collect the discrete Fourier basis functions as columns in a unitary N × N matrix (fft(eye(N)) in MATLAB) (N) 1 ΦN = φ j ::: φ ::: jφ ) Φ = p exp (2πijk=N) −K 0 K jk N The truncated Fourier series is f = ΦN^f: −1 ? Since the matrix ΦN is unitary, we know that ΦN = ΦN and therefore ^ ? f = ΦN f; which is nothing more than a change of basis! A. Donev (Courant Institute) Lecture IX 10/31/2019 12 / 44 Discrete Fourier Transform Discrete Fourier Transform The Fourier interpolating polynomial is thus easy to construct (N−1)=2 X ^(N) ikx φN (x) = fk e k=−(N−1)=2 where the discrete Fourier coefficients are given by N−1 (N) f · φ 1 X f^ = k = f (x ) exp (−ikx ) ≈ f^ k 2π N j j k j=0 We can make the expressions more symmetric if we shift the frequencies to k = 0;:::; N, but one should still think of half of the frequencies as \negative" and half as \positive". See MATLAB's functions fftshift and ifftshift. A. Donev (Courant Institute) Lecture IX 10/31/2019 13 / 44 Discrete Fourier Transform Discrete Fourier Transform The Discrete Fourier Transform (DFT) is a change of basis taking us from real/time to Fourier/frequency domain: N−1 1 X 2πijk Forward f ! ^f : f^ = p f exp − ; k = 0;:::; N −1 k j N N j=0 N−1 1 X 2πijk Inverse ^f ! f : f = p f^ exp ; j = 0;:::; N − 1 j k N N k=0 There is different conventions for the DFT depending on the interval on which the function is defined and placement of factors of N and 2π. Read the documentation to be consistent! A direct matrix-vector multiplication algorithm therefore takes O(N2) multiplications and additions. Can we do it faster? A. Donev (Courant Institute) Lecture IX 10/31/2019 14 / 44 Discrete Fourier Transform Discrete spectrum The set of discrete Fourier coefficients ^f is called the discrete spectrum, and in particular, 2 ^ ^ ^? Sk = fk = fk fk ; is the power spectrum which measures the frequency content of a signal. If f is real, then f^ satisfies the conjugacy property ^ ^? f−k = fk ; so that half of the spectrum is redundant and f^0 is real. For an even number of points N the largest frequency k = −N=2 does not have a conjugate partner. A. Donev (Courant Institute) Lecture IX 10/31/2019 15 / 44 Discrete Fourier Transform Approximation error: Analytic If f (t = x + iy) is analytic in a half-strip around the real axis of half-width α and bounded by jf (t)j < M, then ^ −αjkj fk ≤ Me : Then the Fourier interpolant is spectrally-accurate 1 X 2Me−αn kf − φk ≤4 Me−αk = (geometric series sum) 1 eα − 1 k=n+1 The Fourier interpolating trigonometric polynomial is spectrally accurate and a really great approximation for (very) smooth functions. A. Donev (Courant Institute) Lecture IX 10/31/2019 16 / 44 Discrete Fourier Transform Spectral Accuracy (or not) The Fourier interpolating polynomial φ(x) has spectral accuracy, i.e., exponential in the number of nodes N kf (x) − φ(x)k ∼ e−N for sufficiently smooth functions. Specifically, what is needed is sufficiently rapid decay of the Fourier ^ −|kj coefficients with k, e.g., exponential decay fk ∼ e . Discontinuities cause slowly-decaying Fourier coefficients, e.g., power ^ −1 law decay fk ∼ k for jump discontinuities. Jump discontinuities lead to slow convergence of the Fourier series for non-singular points (and no convergence at all near the singularity), so-called Gibbs phenomenon (ringing): ( N−1 at points away from jumps kf (x) − φ(x)k ∼ const. at the jumps themselves A. Donev (Courant Institute) Lecture IX 10/31/2019 17 / 44 Discrete Fourier Transform Gibbs Phenomenon A. Donev (Courant Institute) Lecture IX 10/31/2019 18 / 44 Discrete Fourier Transform Gibbs Phenomenon A. Donev (Courant Institute) Lecture IX 10/31/2019 19 / 44 Discrete Fourier Transform Aliasing If we sample a signal at too few points the Fourier interpolant may be wildly wrong: aliasing of frequencies k and 2k; 3k;::: Standard anti-aliasing rule is the Nyquist{Shannon criterion (theorem): Need at least 2 samples per period. A. Donev (Courant Institute) Lecture IX 10/31/2019 20 / 44 Fast Fourier Transform DFT Recall the transformation from real space to frequency space and back: N−1 1 X 2πijk (N − 1) (N − 1) f ! ^f : f^ = f exp − ; k = − ;:::; k N j N 2 2 j=0 (N−1)=2 X 2πijk ^f ! f : f = f^ exp ; j = 0;:::; N − 1 j k N k=−(N−1)=2 We can make the forward-reverse Discrete Fourier Transform (DFT) more symmetric if we shift the frequencies to k = 0;:::; N: N−1 1 X 2πijk Forward f ! ^f : f^ = p f exp − ; k = 0;:::; N −1 k j N N j=0 N−1 1 X 2πijk Inverse ^f ! f : f = p f^ exp ; j = 0;:::; N − 1 j k N N k=0 A.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    44 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us