ELEG 305: Digital Signal Processing Lecture 18: Applications of FFT Algorithms & Linear Filtering DFT Computation; Implementation of Discrete Time Systems Kenneth E. Barner Department of Electrical and Computer Engineering University of Delaware Fall 2008 K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 1 / 20 Outline 1 Review of Previous Lecture 2 Lecture Objectives 3 Applications of FFT Algorithms Efficient Computation of the DFT of Two Real Sequences Efficient Computation of the DFT of 2N Point Real Sequences A Linear Filtering Approach to Computation of the DFT 4 Implementation of Discrete-Time Systems Structures for the Realization of Discrete Time Systems Structures for FIR systems Direct Form Structures for FIR systems Cascade Form Structures for FIR systems Lattice Structures for FIR systems K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 2 / 20
Review of Previous Lecture Review of Previous Lecture FFT and IFFT calculation complexity O(N log 2 N); radix 2, radix 4, and split radix methods Radix 2 Decimation in Freq. (FFT) algorithm Decompose signal log 2 N times; Basic computation is the butterfly Radix 4 Decimation in Time (FFT) algorithm Decompose signal log 4 N times; Basic computation is the butterfly FFT Based Filtering Compute N point FFT of h(n) and x(n), N M + L 1 (and a power of 2); multiply H(k)X(k); complete IFFT to get h(n) x(n); process long signals block wise x(n) x(n+n/2) -1 WN n g1(n) g2(n) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 3 / 20 Lecture Objectives Lecture Objectives Objective Derive methods for efficiently computing the FFT of real valued sequences; Derive a linear filtering approach to computing the DFT; Derive implementations of FIR discrete time systems Reading Chapters 8 (8.2-8.3) and 9 (9.1-9.2); Next lecture, Lattice Filters (Chapter 9.2) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 4 / 20
Applications of FFT Algorithms Efficient Computation of the DFT of Two Real Sequences Observation: The DFT operates on complex valued inputs Objective: Efficiently compute the DFT of two real valued sequences For x 1 (n) and x 2 (n) length N real sequences, set x(n) = x 1 (n) + jx 2 (n) n = 0, 1,..., N 1 X(k) = X 1 (k) + jx 2 (k) j = 0, 1,..., N 1 Exploiting the x (n) DFT N X (N k) property yields x 1 (n) = REAL{x(n)} = 1 2 [x(n) + x (n)] X 1 (k) = 1 2 [X(k) + X (N k)] x 2 (n) = IMAG{x(n)} = 1 2j [x(n) x (n)] X 2 (k) = 1 2j [X(k) X (N k)] Result: When computing X 1 (k), we can get X 2 (k) for free K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 5 / 20 Applications of FFT Algorithms Efficient Computation of the DFT of 2N Point Real Sequences Objective: Efficiently compute the DFT of a 2N point real sequence Suppose g(n) is real and has length 2N. Define x 1 (n) = g(2n) x 2 (n) = g(2n + 1) Observation: These are two N point real valued sequences. Thus set x(n) = x 1 (n) + jx 2 (n) n = 0, 1,..., N 1 Previous result shows that X 1 (k) = 1 2 [X(k) + X (N k)] X 2 (k) = 1 2j [X(k) X (N k)] Challenge: Express the 2N point DFT of g(n) (i.e., G(k)) in terms of the N point DFTs X 1 (k) and X 2 (k) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 6 / 20
By definition, G(k) = Applications of FFT Algorithms = = or more compactly 2N 1 n=0 N 1 g(n)w kn 2N n=0 N 1 g(2n)w2n 2nk n=0 Efficient Computation of the DFT of 2N Point Real Sequences N 1 + n=0 N 1 x 1 (n)wn nk + W 2N k n=0 g(2n + 1)W (2n+1)k 2N x 2 (n)w nk N G(k) = X 1 (k) + W k 2N X 2(k), k = 0, 1,..., N 1 G(k + N) = X 1 (k) W k 2N X 2(k), k = 0, 1,..., N 1 where the second result follows from periodicity, i.e., X i (k + N) = X i (k) and W k+n 2N = W2N k Result: The DFT computational cost for a 2N length real sequence is approximately equal to that for a N length complex sequence K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 7 / 20 Applications of FFT Algorithms A Linear Filtering Approach to Computation of the DFT Objective: Utilized linear filtering to computer the DFT Note: This is efficient when only a few terms are required (< log 2 N) X(k) = Define y k (n) = N 1 x(m)wn km m=0 N 1 = W kn N x(m)wn km m=0 [multiply by W kn N = 1] N 1 = x(m)w k(n m) N m=0 } {{ } convolution N 1 x(m)w k(n m) N = x(n) h k (n) ( ) m=0 where h k (n) = W kn N u(n) Note: Comparing ( ) and ( ) shows equivalence at n = N, i.e., X(k) = y k (n) n=n Interpretation: X(k) is the output of filter h k (n) at time n = N K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 8 / 20 ( )
Applications of FFT Algorithms A Linear Filtering Approach to Computation of the DFT Evaluate h k (n) = W kn N u(n) by taking the z transform H k (z) = h k (n)z n = W kn N z n n= n=0 1 = 1 W k N z 1 Observations: Approach known as the Goertzel Algorithm (1958) This filter has a pole on the unit circle at frequency ω k = 2πk/N This is the sampled frequency of X(k), i.e. X(k) = X(ω k ) where ω k = 2πk/N From H k (z) we get a difference equation realization y k (n) = W k N y k(n 1) + x(n) Select DFT terms obtained by a bank of H k (z) filters Filter outputs give DFT coefficients for the prior N input samples Filters require complex multiplications & additions K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 9 / 20 Implementation of Discrete-Time Systems Structures for the Realization of Discrete Time Systems Discrete Time Systems Realization Structures Objective: Design system realizations that consider: Computational complexity Memory requirements Finite-word-length effects Different realizations have different advantages/disadvantages General systems considered: N M y(n) = a k y(n k) + b k x(n k) or equivalently M b k z k H(z) = N 1 + a k z k K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 10 / 20
Implementation of Discrete-Time Systems Structures for FIR systems Structures for FIR systems Objective: Consider structures for the FIR case y(n) = H(z) = M 1 b k x(n k) M 1 b k z k Note: FIR filter coefficients {b k } equal the impulse response, i.e., { bn 0 n M 1 h(n) = 0 otherwise where y(n) = x(n) h(n) = M 1 h(k)x(n k) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 11 / 20 Implementation of Discrete-Time Systems Direct Form Structures for FIR systems M 1 Direct realization of y(n) = h(k)x(n k) yields FIR filter direct form realization; tapped delay line or transversal system Observations: M multiplications; M 1 additions & memory locations A FIR filter is linear phase iff (more info. in Ch. 10) h(n) = ±h(m 1 n) In this case, we can reduce the number of multiplies to M/2 K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 12 / 20
Implementation of Discrete-Time Systems Direct Form Structures for FIR systems For instance, suppose h(n) = h(m 1 n). Then y(n) = = M 1 h(k)x(n k) M/2 1 h(k)[x(n k) + x(n (M 1 k))] which yields a linear phase FIR filter direct realization (N odd shown) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 13 / 20 Implementation of Discrete-Time Systems Cascade Form Structures for FIR systems Objective: Factor H(z) to yield a cascade implementation To form a cascade of second order FIR filters, let K H(z) = H k (z) where H k (z) = b k0 + b k1 z 1 + b k2 z 2, k = 1, 2,..., K Note: To ensure coefficients are real, group complex conjugate roots, i.e., Realization of Each Stage H k (z) = (1 z k z 1 )(1 zk z 1 ) = b k0 + b k1 z 1 + b k2 z 2 K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 14 / 20
Implementation of Discrete-Time Systems Cascade Form Structures for FIR systems Note: If H(z) is linear phase, additional symmetries hold h(n) = ±h(m 1 n) symmetry H(z) zeroes in reciprocal pairs, i.e, z k, z k zeros = 1/z k, 1/z k zeros Simplification is achieved by utilizing fourth order stages H k (z) = c k0 (1 z k z 1 )(1 zk z 1 )(1 z 1 /z k )(1 z 1 /zk ) = c k0 + c k1 z 1 + c k2 z 2 + c k1 z 3 + c k0 z 4 Observation: Exploiting the linear phase induced symmetries halves the computational costs Approach: Cascade fourth (or second) order stages K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 15 / 20 Implementation of Discrete-Time Systems Lattice Structures for FIR systems Objective: Developed a lattice structure realization of FIR filters Approach: Suppose we have a sequence of FIR filters H m (z) = A m (z) m = 0, 1,..., M 1 where by definition m A m (z) = 1 + α m (k)z k m 1 Example A 0 (z) = 1 A 1 (z) = 1 + α 1 (1)z 1 A 2 (z) = 1 + α 2 (1)z 1 + α 2 (2)z 2 A 3 (z) = 1 + α 3 (1)z 1 + α 3 (2)z 2 + α 3 (3)z 3... K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 16 / 20
Implementation of Discrete-Time Systems Lattice Structures for FIR systems The m th filter, H m (z) = A m (z) = 1 + m α m(z), output is m m y(n) = x(n) + α m (k)x(n k) = x(n) [ α m (k)x(n k)] = x(n) ˆx(n) where ˆx(n) = m [ α m(k)x(n k)] Observations: ˆx(n) can be thought of as a prediction of x(n) x(n) ˆx(n) it is the prediction error Direct Form Tap Delay Realization Prediction Error Formulation (Direct Form) Realization K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 17 / 20 Implementation of Discrete-Time Systems Lattice Structures for FIR systems Suppose m = 1, then y(n) = x(n) + α 1 (1)x(n 1) ( ) To build a cascade of 1 st order stages, generalize the notation. Let f 0 (n) = x(n) g 0 (n) = x(n) f 1 (n) = f 0 (n) + K 1 g 0 (n 1) g 1 (n) = K 1 f 0 (n) + g 0 (n 1) Question: For what value of K 1 is ( ) realized? Single Stage Lattice Filter K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 18 / 20
Implementation of Discrete-Time Systems Lattice Structures for FIR systems Let K 1 = α 1 (1). Then Similarly, Single Stage Lattice Filter f 1 (n) = f 0 (n) + K 1 g 0 (n 1) = x(n) + α 1 (1)x(n 1) = y(n) [order m = 1 filter output] g 1 (n) = α 1 (1)x(n) + x(n 1) Note: K 1 is referred to as a reflection coefficient Objective: Form cascades of multiple stages to realize more complex filtering operations K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 19 / 20 Lecture Summary Lecture Summary Efficient FFT computation for real sequences For x 1 (n) and x 2 (n) real, set x(n) = x 1 (n) + jx 2 (n) then X 1 (k) = 1 2 [X(k) + X (N k)]; X 2 (k) = 1 2j [X(k) X (N k)] Similar tricks hold for length 2N real sequences Linear filtering computation of the DFT the Goertzel algorithm y k (n) = W k N y k(n 1) + x(n) gives X(k) = y k (n) n=n Implementations of FIR discrete time systems Direct, Cascade, and Lattice filter structures Next lecture Lattice Filters (Chapter 9.2) K. E. Barner (Univ. of Delaware) ELEG 305: Digital Signal Processing Fall 2008 20 / 20