ENT 315 Medical Signal Processing CHAPTER 3 FAST FOURIER TRANSFORM Dr. Lim Chee Chin Outline • Definition and Introduction FFT – Properties of FFT – Algorithm of FFT § Decimate in Time (DIT) FFT § Steps for radix 2 for 4point and 8point § Decimate in Frequency (DIF) FFT § Steps for radix 2 for 4point and 8point • Definition and Introduction IFFT – IDFT using FFT algorithm FFT • DFT can be used to perform linear filtering, correlation analysis and spectral analysis. • Direct computation of DFT involves large number of computations. • In, 1965, Cooley and Turkey proposed fast Fourier transform, which is a highly efficient procedure for computing the DFT of a finite series with less number of computations. • FFT is used in digital spectral analysis, filter simulation, auto-correlation and pattern recognition. FFT • Definition FFT: • Direction computation of DFT involves (N-1) complex additions and N complex multiplications • For all N value of X(k), the number of complex multiplications required is and total number of complex additions required is N(N-1) Properties of FFT • FFT exploit the two basic properties of the twiddle factor as shown above and reduces the number of complex multiplications required to perform DFT from to FFT Algorithms FFT Algorithm Decimation in Time Decimation in Frequency Decimation In Time Fast Frequency Transform - DIT FFT Definition Steps of radix 2-DIT FFT Algorithm 4 point DIT FFT (Flow Graph) 4 point DIT FFT (Reduced Flow Graph) 8 point DIT FFT (Flow Graph) 8 point DIT FFT (Reduced Flow Graph) Decimation-In-Time (DIT) Algorithm Even, Odd, 4-point DIT FFT X(n) = { x(0), x(1), x(2), x(3)} Recall x(0) Even Odd x(2) -1 -1 x(1) x(3) -1 -1 Recall 4-point DIT FFT - Final Graph -1 -1 -1 In order decimation -1 In order Example: 4-point DIT FFT Question: Given algorithm. Solution: N=4 , find X(k) using DIT FFT 8-point DIT FFT First Stage Second Stage 8-point DIT FFT Second Stage computation Second Stage of DIT-FFT • DFT computation into two 4-point DFT computations. • Branches entering a node are added to produce the node variable. • If no coefficient is indicated, it means that the branch transmittance is equal to one. • Transmittance is an integer power of WN. Three Stages of Computation Combined butterfly diagram 8-point DFT • In DIT algorithm, we can find that for the output sequence to be in a natural order the input sequence has to be stored in a shuffled order. • Computation of 8-point DFT using radix - 2 FFT, involves 3 stages of computation. • The given 8-point sequence is decimated to 2-point sequences. • For each 2-point sequence, the 2-point DFT is computed. • From the result of 2-point of DFT, the 4-point DFT can be computed. • From the result of 4-point DFT, the 8-point DFT can be computed. Example Given using DIT FFT algorithm. Solution: N=8 x(n)={-1,0,2,0,-4,0,2,0} n= 012 3 45 67 , find X(k) Decimation In Frequency Fast Frequency Transform - DIF FFT Definition Steps of radix 2-DIT FFT Algorithm 4 point DIF FFT (Flow Graph) 4 point DIF FFT (Reduced Flow Graph) 8 point DIF FFT (Flow Graph) 8 point DIF FFT (Reduced Flow Graph) • Odd indexed samples of X(k) can be obtained from the 4-point DFT of the sequence g(n) Reduced Flow Graph DIF FFT for N = 8 DIT vs. DIF Differences • For DIT, the input is bitreversed, while the output is in natural order. • Whereas, for DIF, the input is in natural order while the output is in bit reversed. • The DIF butterfly is slightly different from the DIT wherein DIF the complex multiplication takes place after the addsubtract operation. Similarities • Both algorithms requires Nlog2N operations to compute the DFT. • Both algorithms can be done in-place and both need to perform bit reversal at some place during computation. First stage of 8-point DIF FFT Second stage of 8-point DIF FFT Reduced Flow Graph DIF FFT for N = 8 DIF FFT Question • Given x(n)={1,2,-1,2,4,2,-1,2} find X(k) using DIF FFT. Inverse Fast Fourier Transform (IFFT) Inverse Fast Fourier Transform (IFFT) • An FFT algorithm for calculating the DFT samples can also be used to evaluate efficiently the inverse DFT (IDFT). • The inverse DFT is given by • Taking this complex conjugate of above equation. • RHS is DFT of sequence X*(k). Therefore, • Taking the complex conjugate of both side, the desired output sequence x(n) which is given by • Use to compute IDFT – if the output is divided by N – The “twiddle factors” are negative power of • IFFT flow graph obtained from an FFT flow graph by – – – – replacing all the x(n) by X(k), dividing the input data by N, or dividing each stage by 2 when N is power of 2 Changing the exponents of to negative values. • DIT IFFT and DIF IFFT are same. 4-point IFFT Flow Graph X(n) = { x(0), x(1), x(2), x(3)} x(0) Even x(1) x(2) x(3) -1 -1 Odd -1 -1 Example: 4-point IFFT Question: Given using DIT IFFT algorithm. Solution: N=4 Answer: , find x(n) 8 point IFFT Example Given X(k)={-1,3,-9,3,-1,3,-9,3}, find x(n) using DIT IFFT algorithm. Solution: N=8 Answer: Example (from DIF) Given X(k)={11,-3,7,-3,-5,-3,7,-3}, find x(n) using DIF IFFT algorithm. Solution: N=8 Answer: