FFT Algorithms. Chapter 6. Contents 6.1



Similar documents
1.4 Fast Fourier Transform (FFT) Algorithm

Frequency Response of FIR Filters

Fast Fourier Transform: Theory and Algorithms

(Refer Slide Time: 01:11-01:27)

The Algorithms of Speech Recognition, Programming and Simulating in MATLAB

The continuous and discrete Fourier transforms

Design of FIR Filters

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

This unit will lay the groundwork for later units where the students will extend this knowledge to quadratic and exponential functions.

Probability and Statistics Prof. Dr. Somesh Kumar Department of Mathematics Indian Institute of Technology, Kharagpur

Correlation and Convolution Class Notes for CMSC 426, Fall 2005 David Jacobs

Filter Comparison. Match #1: Analog vs. Digital Filters

Analysis/resynthesis with the short time Fourier transform

SGN-1158 Introduction to Signal Processing Test. Solutions

Lies My Calculator and Computer Told Me

4/1/2017. PS. Sequences and Series FROM 9.2 AND 9.3 IN THE BOOK AS WELL AS FROM OTHER SOURCES. TODAY IS NATIONAL MANATEE APPRECIATION DAY

L9: Cepstral analysis

Image Compression through DCT and Huffman Coding Technique

Convolution. The Delta Function and Impulse Response

CM0340 SOLNS. Do not turn this page over until instructed to do so by the Senior Invigilator.

SIGNAL PROCESSING & SIMULATION NEWSLETTER

The Fourier Analysis Tool in Microsoft Excel

Chapter 17. Orthogonal Matrices and Symmetries of Space

Signal to Noise Instrumental Excel Assignment

3. Interpolation. Closing the Gaps of Discretization... Beyond Polynomials

Factoring Algorithms

PYTHAGOREAN TRIPLES KEITH CONRAD

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

Polytechnic University of Puerto Rico Department of Electrical Engineering Master s Degree in Electrical Engineering.

SOLVING EQUATIONS WITH RADICALS AND EXPONENTS 9.5. section ( )( ). The Odd-Root Property

ALGEBRA 2/TRIGONOMETRY

Math Workshop October 2010 Fractions and Repeating Decimals

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Introduction to Complex Fourier Series

2.3 Solving Equations Containing Fractions and Decimals

Wavelet analysis. Wavelet requirements. Example signals. Stationary signal 2 Hz + 10 Hz + 20Hz. Zero mean, oscillatory (wave) Fast decay (let)

ALFFT FAST FOURIER Transform Core Application Notes

1 The Brownian bridge construction

Logarithmic and Exponential Equations

Conceptual similarity to linear algebra

In mathematics, there are four attainment targets: using and applying mathematics; number and algebra; shape, space and measures, and handling data.

Section 1.1 Linear Equations: Slope and Equations of Lines

The Fast Fourier Transform

SWISS ARMY KNIFE INDICATOR John F. Ehlers

We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: b + 90c = c + 10b

SOLVING TRIGONOMETRIC EQUATIONS

The Effective Number of Bits (ENOB) of my R&S Digital Oscilloscope Technical Paper

CHAPTER 5 Round-off errors

Creating, Solving, and Graphing Systems of Linear Equations and Linear Inequalities

Operation Count; Numerical Linear Algebra

Numerical integration of a function known only through data points

A simple and fast algorithm for computing exponentials of power series

Quantum Computing Lecture 7. Quantum Factoring. Anuj Dawar

3.1. Solving linear equations. Introduction. Prerequisites. Learning Outcomes. Learning Style

ECE 842 Report Implementation of Elliptic Curve Cryptography

Auto-Tuning Using Fourier Coefficients

Performing the Fast Fourier Transform with Microchip s dspic30f Series Digital Signal Controllers

South Carolina College- and Career-Ready (SCCCR) Pre-Calculus

Convolution, Correlation, & Fourier Transforms. James R. Graham 10/25/2005

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

Polynomial and Rational Functions

D. J. Bernstein University of Illinois at Chicago. See online version of paper, particularly for bibliography: /papers.

Algebra II End of Course Exam Answer Key Segment I. Scientific Calculator Only

4.3 Lagrange Approximation

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

UNIVERSITY OF CALIFORNIA, SAN DIEGO Electrical & Computer Engineering Department ECE Fall 2009 Linear Systems Fundamentals

Binary Numbering Systems

The string of digits in the binary number system represents the quantity

0.8 Rational Expressions and Equations

Lecture 10: Distinct Degree Factoring

Discrete-Time Signals and Systems

Introduction to Digital Filters

Applications of the DFT

Copy in your notebook: Add an example of each term with the symbols used in algebra 2 if there are any.

Lecture 8 ELE 301: Signals and Systems

1 X 10 = 10 2 X 10 = 20 3 X 10 = 30 4 X 10 = 40 5 X 10 = 50 6 X 10 = 60

LIES MY CALCULATOR AND COMPUTER TOLD ME

Big Ideas in Mathematics

3. INNER PRODUCT SPACES

8 Primes and Modular Arithmetic

Automatic Detection of Emergency Vehicles for Hearing Impaired Drivers

Computational Geometry Lab: FEM BASIS FUNCTIONS FOR A TETRAHEDRON

One advantage of this algebraic approach is that we can write down

Em bedded DSP : I ntroduction to Digital Filters

discuss how to describe points, lines and planes in 3 space.

SOFTWARE FOR GENERATION OF SPECTRUM COMPATIBLE TIME HISTORY

ACTUARIAL NOTATION. i k 1 i k. , (ii) i k 1 d k

General Framework for an Iterative Solution of Ax b. Jacobi s Method

Course overview Processamento de sinais 2009/10 LEA

Lecture Notes on Polynomials

1. The RSA algorithm In this chapter, we ll learn how the RSA algorithm works.

Solving Quadratic Equations

THE SINE PRODUCT FORMULA AND THE GAMMA FUNCTION

Lecture 13 - Basic Number Theory.

CROSSING THE BRIDGE: TAKING AUDIO DSP FROM THE TEXTBOOK TO THE DSP DESIGN ENGINEER S BENCH. Robert C. Maher

Factoring. Factoring 1

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Second Order Linear Nonhomogeneous Differential Equations; Method of Undetermined Coefficients. y + p(t) y + q(t) y = g(t), g(t) 0.

NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS

Transcription:

Chapter 6 FFT Algorithms Contents Efficient computation of the DFT............................................ 6.2 Applications of FFT................................................... 6.6 Computing DFT of 2 real sequences........................................... 6.6 Efficient computation of the DFT of a 2-point real sequence............................. 6.6 Use of the FFT in linear filtering............................................ 6.6 Linear Filtering Approach to Computing the DFT.................................... 6.6 Quantization Effects in Computing the DFT...................................... 6.6 Summary........................................................ 6.6 The discrete cosine transform.............................................. 6.7 D DCT......................................................... 6.7 6.

6.2 c J. Fessler, May 27, 24, 3:8 (student version) We have seen already a few applications of the DFT, and there are many more. Because the DFT is so ubiquitous, fast methods for computing the X[k] s have been studied extensively, and continues to be an active research topic. Many software packages for the FFT are available, so many DSP users will never need to write their own FFT routines. But it is important to understand how FFTs work, just like understanding arithmetic is essential for effective use of a calculator. 6. Efficient computation of the DFT The problem: Given signal samples: x[],..., x[ ] (some of which may be zero), develop a procedure to compute for k,..., where We would like the procedure to be fast, accurate, simple. X[k] W e j 2π. Fast is the most important, so we will sacrifice simplicity for speed, hopefully with minimal loss of accuracy. 6.. Direct computation of the DFT Let us start with the simple way. Assume that W kn has been precomputed and stored in a table for the of interest. How big should the table be? W m is periodic in m with period, so we just need to tabulate the values: ( ) ( ) 2π 2π W m cos m j sin m for m,...,. (Possibly even less since sin is just cos shifted by a quarter period, so we could save just cos when is a multiple of 4.) Why tabulate? To avoid repeated function calls to cos and sin when computing the DFT. ow we can compute each X[k] directly form the formula as follows X[k] x[] W + x[] W k + x[2] W 2k + + x[ ] W ()k. For each value of k, there are complex multiplications, and complex additions. There are values of k, so the total number of complex operations is + ( ) 2 2 O( 2 ). Complex multiplies require 4 real multiplies and 2 real additions, whereas complex additions require just 2 real additions. So the 2 complex multiplies are the primary concern. 2 increases rapidly with, so how can we reduce the amount of computation? By exploiting the following properties of W : Symmetry property: W k+/2 W k ejπ W k Periodicity property: W k+ W k Recursion property: W 2 W /2 The first and third properties hold for even, i.e., when 2 is one of the prime factors of. There are related properties for other prime factors of. 6..2 Divide and conquer approach Idea: break -point DFT, where 2, into two (or more) shorter DFTs and combine the results appropriately. Skim

c J. Fessler, May 27, 24, 3:8 (student version) 6.3 6..3 Radix-2 FFT Useful when is a power of 2: r ν for integers r and ν. r is called the radix, which comes from the Latin word meaning a root, and has the same origins as the word radish. When is a power of r 2, this is called radix-2, and the natural divide and conquer approach is to split the sequence into two sequences of length /2. This is a very clever trick that goes back many years. Decimation in time Split the sequence x[n] into two sequences of length /2, s [n] x[2n], even samples s 2 [n] x[2n + ], odd samples for n,..., /2. X[k] n even so n 2m /2 m /2 m + /2 x[2m] W k2m + n odd so n 2m + m /2 s [m] W/2 km + W k x[2m + ] W k(2m+) m s 2 [m] W km /2 by def n of s l [n] and because of the recursion property W 2 W /2 S [k] +W k S 2 [k] where S [k] /2 /2 s [n] W/2 kn and S 2[k] s 2 [n] W kn /2. Key trick above was the recursion property: W 2 W /2. What are S [k] and S 2 [k]? S [k] and S 2 [k] are just the /2-point DFTs of s [n] and s 2 [n] respectively, or more precisely, the -point circular extension thereof. So we have shown X[k] S [k mod /2] +W k S 2 [k mod /2], k,...,. Recipe: Compute /2-point DFT S [k] of s [n] even samples of x[n]. Compute /2-point DFT S 2 [k] of s 2 [n] odd samples of x[n]. Combine: X[k] S [k mod /2] +W k S 2[k mod /2], k,..., How much computation? Each DFT requires (/2) 2 complex multiplies, and there are complex multiplies needed to combine. So 2(/2) 2 + 2 /2. Compared with 2 complex multiplies before. So just by rearranging the formula, we have saved a factor of 2 in complex multiplies!

6.4 c J. Fessler, May 27, 24, 3:8 (student version) We can save a little more computation by exploiting periodicity. What is the period of S [k]? Since S [k] and S 2 [k] are /2-point DFT s, they are periodic with period /2. For k,..., /2, using symmetry property of W s: So X[k + /2] S [k + /2 mod /2] +W k+/2 S 2 [k + /2 mod /2] S [k] W k S 2 [k]. X[k] S [k] +W k S 2 [k] X[k + /2] S [k] W k S 2 [k], k,..., /2. ew recipe: Compute /2-point DFT S [k] of s [n] even samples of x[n]. Compute /2-point DFT S 2 [k] of s 2 [n] odd samples of x[n]. Compute G 2 [k] W k S 2[k], k,..., /2 Combine: X[k] S [k] + G 2 [k] X[k + /2] S [k] G 2 [k], k,..., /2. 2(/2) 2 + /2 complex multiplies, saving just a little more. Perhaps more importantly, it allows for in-place computation. Butterfly: S [k] X[k] PSfrag replacements G 2 [k] S 2 [k] X[k + /2] W k Summary of key idea: splitting into two sequences (even/odd) each of half the length, take DFT of each, then combine, saves a factor of 2 in complex multiplies. Recursion Apply the same idea to the two /2-point DFTs! Can do it log 2 times, and the total number of complex multiplies is approximately which is much smaller than 2. 2 log 2 e.g., for 32, 2 24, whereas /2 log 2 6 5 8. Figure 6.5, 6.6 Caution: Fig. 6.6 on p. 46 has superfluous dots in it 2-point DFT: Picture of 2-point butterfly! X[k] x[n] e j 2π 2 kn x[] + e jπk x[] X[] x[] + x[] X[] x[] x[]

c J. Fessler, May 27, 24, 3:8 (student version) 6.5 8-point decimation-in-time FFT algorithm Stage Stage 2 Stage 3 x[] X[] x[4] X[] x[2] X[2] x[6] W 2 8 X[3] x[] X[4] x[5] W 8 X[5] lacements x[3] W 2 8 X[6] x[7] W 2 8 W 3 8 X[7] W e j 2π Each dot represents a complex addition. Each arrow represents a complex multiplication.

6.6 c J. Fessler, May 27, 24, 3:8 (student version) 6.2 Applications of FFT There are many. 6.2. Computing DFT of 2 real sequences Suppose x[n] and h[n] are real and we want: x[n] DFT X[k] h[n] DFT H[k] aive approach takes /2 log 2 complex multiplies each, for a total of log 2 complex multiplies. Trick: form new complex sequence: and take its DFT: w[n] w[n] x[n] +j h[n] DFT W [k] X[k] +j H[k]. But X[k] and H[k] are not real in general, so we must think harder to extract X[k] and H[k] from the W [k] s. Trick: by real property of DFT. Similarly x[n] real(w[n]) 2 (w[n] + w [n]) DFT X[k] 2 (W [k] + W [ k mod ]) h[n] imag(h[n]) 2j (w[n] w [n]) DFT H[k] 2j (W [k] W [ k mod ]). Recipe: Form complex sequence w[n] Compute -point DFT of w[n] X[k] 2 (W [k] + W [ k mod ]) H[k] 2j (W [k] W [ k mod ]) Requires about /2 log 2 complex multiplies, so a factor of 2 savings over naive approach. 6.2.2 Efficient computation of the DFT of a 2-point real sequence 6.2.3 Use of the FFT in linear filtering 6.3 Linear Filtering Approach to Computing the DFT 6.4 Quantization Effects in Computing the DFT 6.5 Summary The compute savings of the FFT relative to the DFT launched the age of digital signal processing. We emphasized radix-2 case, but good FFT implementations accommodate any. A popular freeware implementation is the fftw package. skip skip

c J. Fessler, May 27, 24, 3:8 (student version) 6.7 The discrete cosine transform (not covered due to lack of time) The DFT/FFT are excellent for convolution, and useful for frequency-domain analysis of sampled analog signals. So why did someone invent a new transform, the DCT? For image compression, we would like energy compaction; we would like a transform that reduces the signals of interest to a small number of nonzero coefficients. Image compression is often done in blocks. Suppose we select a small block from some natural image. The DFT of the block gives us the values of the discrete Fourier series of the periodic extension of that signal. Suppose the periodic extension has a discontinuity at the block boundaries. Then the DFT coefficients will decay slowly, just like the FT of a square wave (discontinuous) decay as /k, whereas those of a triangle wave decay as /k 2. So any discontinuities in an image, include at the boundary of a block, lead to poor energy compaction of the coefficients. As an additional drawback of the DFT, if the image is real, then its coefficients are complex. All other things being equal, when developing image compression methods one would usually prefer real valued quantities over complex values if the original image is real. To overcome these drawbacks of the DFT, discrete cosine transform (DCT) uses the trick of taking the image (block) and forming a symmetrized version of it before computing a DFT. This symmetrization has the effect of eliminating discontinuities at the block edges, and yielding real coefficients. Interestingly though, the DCT is derived via the DFT. So Fourier analysis is still the fundamental tool, even for this new transform. D DCT Consider the signal of extent 4: x[n] {2, 4, 6, 8}. Its 4-point circular extension is x[n] {..., 2, 4, 6, 8, 2, 4, 6, 8, 2,...}. ote the discontinuity. ow consider the new signal of length 2: x[n], n y[n] x[2 n], n 2, otherwise, which is y[n] {2, 4, 6, 8, 8, 6, 4, 2} in the example. This signal has no jumps at the boundaries. We now derive the DCT via the DFT. For k 2 : Y [k] where W e j 2π. 2 W k/2 2 2 2π j y[n] e 2 kn 2 x[n] W2 kn + n x[n] W2 kn + x[n] y[n] W kn 2 x[2 n] W kn 2 x[n] W k(2 n) 2 ( W k(n+/2) 2 + W k(n+/2) 2 2 [ + W k 2 ] ) ( ) W k/2 2πk(2n + ) 2 x[n] 2 cos 4 Suppose we started with a length signal x[n]. ow we have 2 complex DFT coefficients Y [],..., Y [2 ]. This hardly seems like progress towards compaction! But obviously there must be some redundancies in the Y [k] s. ote that Y [], as a consequence of the symmetry in the construction of y[n]. W k/2 2 Y [k] is real if x[n] is real, since it is a sum of x[n] s times a cosine. One can verify that W (2 k)/2 2 Y [2 k] W k/2 2 Y [k], k,..., 2, which is a form of odd symmetry. So we only really need to save half of the Y [k] s.

6.8 c J. Fessler, May 27, 24, 3:8 (student version) In light of these properties, the D DCT is defined as follows: C x [k] { W k/2 2 Y [k], k, otherwise. C x [k] ( πk(2n + ) 2 x[n] cos 2 ), k,...,. A few properties of the DCT: Maps an -point sequence to another -point sequence. If x[n] is real, then so is its DCT. C x [] 2 Y [], so the th component of the DCT is twice that of the DFT. { ( )} Is the set of signals cos πk(2n+) 2 an orthogonal set over n,...,? k Why does it matter? (Simplicity in reconstruction.) For the inverse DCT, one can recover the 2-point DFT coefficients Y [k] from the DCT coefficients C x [ ] as follows: W k/2 2 C x[k], k,..., Y [k], k W k/2 2 C x[2 k], k +,..., 2. Substituting into the idft formula and simplifying (or applying the orthogonality of the DCT basis) yields: x[n] y[n] k ( πk(2n + ) w k C x [k] cos 2 ), n,...,, where w k { /2, k, otherwise. (6-) (ote that Y [] 2 x[n].) Rarely does one implement the DCT using the two boxed formulae above, since that would require O( 2 ) operations. Instead one uses an FFT-based algorithm. Basic algorithm for D DCT extend x[n] to form y[n]. (Use MATLAB s fliplr or flipud command.) compute 2-point DFT Y [k] from y[n]. (Use MATLAB s fft command.) C x [k] W k/2 k/2 2 Y [k], k,..., (Use MATLAB s real command after scaling by the W2 s since there will be some residual complex part due to finite precision.) Similar for inverse DCT. In fact it can be done using -point DFTs too. (A problem in Lim.) Caution! MATLAB s dct command uses a slightly different definition of the DCT that is normalized so that it is an orthonormal transformation, following [4, p. 5-3]. Example: x[n] {2, 4, 6, 8} has DFT {2, 4 + j4, 4, 4 j4}. The DCT is {4, 2.6,,.897}, which has nominally better compaction since one of the entries is zero. Since the DCT input sequence y[n] has no extraneous sharp discontinuities, it will lead to better energy compaction in the frequency domain than the DFT input sequence x[n], i.e., more energy is concentrated in low frequency components. What is the catch? What signals are better compacted by the DFT?

c J. Fessler, May 27, 24, 3:8 (student version) 6.9 DCT Basis, 6 2 3 4 5 6 2 3 4 5 6 2 3 4 5 6 2 3 4 5 6 2 3 4 5 6 φ k (n) 2 3 4 5 6 n