Dft

1,480 views

Published on

EXPERT SYSTEMS AND SOLUTIONS
Project Center For Research in Power Electronics and Power Systems
IEEE 2010 , IEEE 2011 BASED PROJECTS FOR FINAL YEAR STUDENTS OF B.E
Email: expertsyssol@gmail.com,
Cell: +919952749533, +918608603634
www.researchprojects.info
OMR, CHENNAI
IEEE based Projects For
Final year students of B.E in
EEE, ECE, EIE,CSE
M.E (Power Systems)
M.E (Applied Electronics)
M.E (Power Electronics)
Ph.D Electrical and Electronics.
Training
Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
EXPERT GUIDANCE IN POWER SYSTEMS POWER ELECTRONICS
We provide guidance and codes for the for the following power systems areas.
1. Deregulated Systems,
2. Wind power Generation and Grid connection
3. Unit commitment
4. Economic Dispatch using AI methods
5. Voltage stability
6. FLC Control
7. Transformer Fault Identifications
8. SCADA - Power system Automation

we provide guidance and codes for the for the following power Electronics areas.
1. Three phase inverter and converters
2. Buck Boost Converter
3. Matrix Converter
4. Inverter and converter topologies
5. Fuzzy based control of Electric Drives.
6. Optimal design of Electrical Machines
7. BLDC and SR motor Drives

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,480
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
109
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Dft

  1. 1. EXPERT SYSTEMS AND SOLUTIONS Email: expertsyssol@gmail.com expertsyssol@yahoo.com Cell: 9952749533 www.researchprojects.info PAIYANOOR, OMR, CHENNAI Call For Research Projects Final year students of B.E in EEE, ECE, EI, M.E (Power Systems), M.E (Applied Electronics), M.E (Power Electronics) Ph.D Electrical and Electronics.Students can assemble their hardware in our Research labs. Experts will be guiding the projects.
  2. 2. Discrete Fourier Transform & Fast Fourier Transform
  3. 3. Review The DTFT provides the frequency-domain (w) representation for absolutely summable sequences. The z-transform provides a generalized frequency- domain (z) representation for arbitrary sequences. Two features in common:  Defined for infinite-length sequences  Functions of continuous variable (w or z)  From the numerical computation viewpoint, these two features are troublesome because one has to evaluate infinite sums at uncountably infinite frequencies.
  4. 4. Review To use Matlab, we have to truncate sequences and then evaluate the expression at finitely many points. The evaluation were obviously approximations to the exact calculations. In other words, the DTFT and the z-transform are not numerically computable transform.
  5. 5. Introduction Therefore we turn our attention to a numerically computable transform. It is obtained by sampling the DTFT transform in the frequency domain (or the z-transform on the unit circle). We develop this transform by analyzing periodic sequences. From FT analysis we know that a periodic function can always be represented by a linear combination of harmonically related complex exponentials (which is form of sampling). This give us the Discrete Fourier Series representation. We extend the DFS to finite-duration sequences, which leads to a new transform, called the Discrete Fourier Transform.
  6. 6. Introduction The DFT avoids the two problems mentioned above and is a numerically computable transform that is suitable for computer implementation. The numerical computation of the DFT for long sequences is prohibitively time consuming. Therefore several algorithms have been developed to efficiently compute the DFT. These are collectively called fast Fourier transform (or FFT) algorithms.
  7. 7. The Discrete Fourier Series Definition: Periodic sequence ~ (n) = ~ (n + kN ), ∀n, k x x N: the fundamental period of the sequences From FT analysis we know that the periodic functions can be synthesized as a linear combination of complex exponentials whose frequencies are multiples (or harmonics) of the fundamental frequency (2pi/N). From the frequency-domain periodicity of the DTFT, we conclude that there are a finite number of harmonics; the frequencies are {2pi/N*k,k=0,1,…,N-1}.
  8. 8. The Discrete Fourier Series A periodic sequence can be expressed as N −1 ~ ( n) = 1 ~ ∑ X (k )e , n = 0,±1, π j 2N kn x N k =0 ~ { X ( K ), k = 0,±1, } called the discrete Fourier series arecoefficients, which are given by N −1 ~ ~ (n)e − j 2Nπ kn , k = 0,±1,  X (k ) = ∑ x n =0The discrete Fourier series representation of periodic sequences
  9. 9. The Discrete Fourier Series X(k) is itself a (complex-valued) periodic sequence with fundamental period equal to N. π − j 2N Let WN = e N −1 ~ ~ (n)] = ~ (n)W nk X (k ) = DFS[ x ∑x N n =0 N −1 ~ (n) = IDFS[ X (k )] = 1 ~ ~ x N ∑ − X (k )WN nk k =0 Example 5.1
  10. 10. DFT : DEFINATION To perform frequency analysis on a discrete-time signal, x(n), need to convert the time-domain to an equivalent frequency-domain representation. In order to this, need to use a powerful computational tool to perform frequency analysis called Discrete Fourier Transform or DFT. The continuous Fourier Transform is defined as below: However, this integral equation of Fourier Transform is not suitable to perform frequency analysis due to this 2 reasons: Continuous nature can be handled by Computer The limits of integration cannot be from minus infinity to infinity. There should be a finite length sequences that can be handled by computer.
  11. 11. DFT : DEFINATION Let x(n) be a finite length sequences. Thus, the N-point DFT of x(n) defined as X(k) is : N −1 X(k) = ∑ x(n) e-j2πnk/N, k = 0,1, …, N-1 n =0 k represent the harmonic number of the transform component. n is the finite length sequence interval defined as 0 ≤ n ≤ N-1, N is the sequence length Thus X(k) being complex and has real & imaginary component, so that the kth harmonic of X(k) is: X(k) = R(k) + jI(k)
  12. 12. DFT : PROPERTIES The are 4 properties of DFT: 1. Periodicity If X(k) is the N-point DFT of x(k), x(n+N) = x(n), for all n X(k+N) = X(k), for all k It shows that DFT is periodic with period N, also known as Cyclic property of the DFT 2. Linearity If X1(k) and X2(k) are the N-point DFT of x1(n) and x2(n), ax1(n) + bx2(n) DFT aX1(k) + bX2(k)
  13. 13. 3. Circular Shifting Let x(n) be a sequence of length N and X(k) is N , -point DFT, thus the sequence, x (n) obtained from x(n) by shifting x(n) cyclically by m units. Then, , x (n) DFT X(k)e-j2πkm/N4. Parseval’s Theorem if x(n) DFT X(k) and y(n) N −1 DFT Y(k) N −1 thus, ∑ x(*n) y (n) = 1/N ∑X( Y0*(k)k ) k= n=0
  14. 14. DFT : RELATIONSHIP WITH z-TRANSFORM The z-transform of the sequence, x(n) is given by: ∞ X(z) = ∑ x ( n) z n = −∞ -n , ROC include unit circle by defining zk = ej2πk/N, k = 0, 1, 2, …, N-1 X(k) = X(z)| zk = ej2πk/N , k = 0,1,2, …, N-1 ∞ = ∑ x ( n )e n = −∞ -j2πnk/N where ωk = 2πk/N, k = 0,1,2,…,N-1
  15. 15. DFT : EXAMPLES EXAMPLE 1:Find the DFT for the following finite length sequence, x(n) = { ¼, ¼, ¼ } Solution : 1. Determine the sequence length, N N = 3, k = 0,1,2 2. Use DFT formula to determine X(k) N −1X(k) = ∑ x ( n) e n =0 -j2πnk/N , k = 0, 1, 2 X(0) = ¼ + ¼ + ¼ = ¾ X(1) = ¼ + ¼e-j2π/3 + ¼e-j4π/3 = ¼ + ¼ [cos (2π/3) – jsin(2π/3) + ¼ [cos (4π/3) –jsin(4π/3) = ¼ + ¼ [-0.5 – j0.866] + ¼ [ -0.5 + j0.866] = ¼ + ¼ [-1] = 0
  16. 16.  Continued from Examples 1: X(2) = ¼ + ¼ e-j4π/3 + ¼ e-j8π/3 = ¼ + ¼ [cos (4π/3) – jsin(4π/3)] + ¼ [cos (8π/3) – jsin(8π/3)] = ¼ + ¼ [-0.5 +j0.866] + ¼[-0.5 – j0.866] =0 Thus, X(k) = { ¾, 0, 0}
  17. 17.  Examples 2: Given the following the finite length sequences, x(n) = {1,1,2,2,3,3} Perform DFT for this sequences. Solution : 1. Determine the sequence length, N = 6. 2. Use DFT formula to determine X(k). N −1 X(k) = ∑ x ( n) e n =0 -j2πnk/N , k = 0,1,2,3,4,5 X(0) = 12, X(1) = -1.5 + j2.598 X(2) = -1.5 + j0.866, X(3) = 0 X(4) = -1.5 – j0.866, X(5) = -1.5 – j2.598 Thus, X(k) = {12, -1.5 + j2.598, -1.5 + j0.866, 0, -1.5 – j0.866, -1.5 – j2.598}
  18. 18.  Examples 3: Find the DFT for the convolution of 2 sequences : x1(n) = {2, 1, 2, 1} & x2(n) = {1, 2, 3, 4} Solution : 1. Determine the sequence length for each sequence, N = 4. Thus, k = 0,1,2,3 2. Perform DFT for each sequences, (i) X1(0) = 6, X1(1) = 0, X1(2) = 2, X2(3) = 0 X1(k) = {6,0,2,0} (ii) X2(0) = 10, X2(1) = -2+j2, X2(2) = -2, X2(3) = -2-j2 X2(k) = {10,-2+j2,-2,-2-j2} 3. Perform Convolution by : X3(k) = X1(k) X2(k) = {60, 0, -4, 0}
  19. 19. IDFT : DEFINATION IDFT is the inverse Discrete Fourier Transform. The finite length sequence can be obtained from the Discrete Fourier Transform by performing IDFT. The IDFT is defined as : N −1 x(n) = 1/N∑ X (k ) e-j2πnk/N, k =0 where n = 0,1, …, N-1
  20. 20.  EXAMPLES 4: Determine the IDFT for the following DFT sequence, X(k) = {1, 2, 3, 4} SOLUTION : 1. Determine the length of the sequence, N = 4 2. Calculate the IDFT by the IDFT formula: 3 x(n) = 1/4∑ X (k ) e k =0 , -j2πnk/4 x(0) = ¼(1 + 2 + 3 + 4) = 5/2 x(1) = -0.5 – j0.5, x(2) = -0.5 x(3) = -0.5 + j0.5 3. Thus the finite length sequence, x(n) is: x(n) = {2.5, -0.5-j0.5, -0.5, -0.5+j0.5}
  21. 21. IDFT : EXAMPLES EXAMPLES 5: Obtain the finite length sequence, x(n) from the DFT sequence in Example 3. Solution : 1. The sequence in Example 3 is : X3(k) = {60, 0, -4, 0} 2. Use IDFT formula to obtain x(n): 3 x3(n) = 1/4 ∑ X (k )e k =0 , -j2πnk/4 x3(0) = 14, x3(1) = 16, x3(2) = 14, x3(3) = 16 Thus the finite length sequences are : x3(k) = {14, 16, 14, 16}
  22. 22. DFT & IDFT : COMPLEXITY OF DFT A Large number of multiplications and additions are required to compute DFT. To compute the 8-point of DFT of the sequence, x(n), The X(k) will be the summation of x(0)e-j2π(0)k/8 until x(7)e-j2π(7)k/8 For the eight terms, there will be 64 multiplication (82) and 56 addition (8 x (8-1)) Hence, for N-point DFT, there will be N 2 multiplication and N(N-1) addition.
  23. 23.  Thus, need one algorithm to reduce the number of calculation and speeds up the computation of DFT. The algorithm is called Fast Fourier Transform (FFT). It utilizes special properties of the DFT to construct a computational procedure that requires Nlog 2N complex multiplication and Nlog2N complex addition to carry out N-point DFT. The MATLAB command use to perform DFT & IDFT is: 1. fft2 () - for DFT 2. ifft2 () - for IDFT
  24. 24. FFT : DEFINATION FFT is the algorithm that efficiently computes the DFT. In applying FFT, the DFT expression can be written as : N −1 X(k) =∑ x(n)W n =0 N nk , k = 0, 1,…,N-1 where, WN = e-j2π/N
  25. 25. IFFT : DEFINATION The FFT for IDFT can be defined as: N −1 x(n) = 1/N∑ X (k )WNnk k =0 WN2 = (e-j2π/N)2 = e-j2π2/N = WN/2
  26. 26. DFT & IDFT : SUMMARY The DFT & IDFT can be summarized below: 1. It is a powerful method to perform frequency analysis which are used widely in digital image processing including blurring and enhancing. 2. Since the DFT & IDFT will become tedious when the length of the sequence become big, one algorithm is develop to overcome this problem. 3. The algorithm can be found in MATLAB. The function are : 1. FFT2 = to perform DFT 2. IFFT2 = to perform IDFT
  27. 27. Ex5.2 DFS of square wave seq.  L, k = 0,± N ,±2 N , ~  X (k ) =  − jπ ( L −1) / N sin(πkL / N ) e  sin(πk / N ) Note1. Envelope like the sinc function;2. Zeros occur at N/L (reciprocal of duty cycle);3. Relation of N to density of freq. Samples;
  28. 28. Relation to the z-transform  Nonzero, 0 ≤ n ≤ N − 1 N −1 x ( n) =  X ( z ) = ∑ x ( n) z − n  0, elsewhere n =0  ~ (n), 0 ≤ n ≤ N − 1 ~ x ( n) =  x N −1 X ( k ) = ∑ x ( n) e [ ]π j 2N k −n  0, elsewhere n =0 ~ X (k ) = X ( z ) | j 2π k z =e NThe DFS X(k) represents N evenly spaced samples of thez-transform X(z) around the unit circle.
  29. 29. Relation to the DTFT N −1 N −1 X (e ) = ∑ x ( n ) e jw − jwn ~ (n)e − jwn = ∑x n =0 n =0 ~ X ( k ) = X (e ) | w = 2 π k jw N 2π 2π Let w1 = , and wk = k = kw1 N N X (k ) = X (e jwk ) = X (e jkw1 )The DFS is obtained by evenly sampling the DTFT at w1 intervals.The interval w1 is the sampling interval in the frequency domain. It is calledfrequency resolution because it tells us how close are the frequency samples.
  30. 30. Sampling and construction in the z-domain ~ X (k ) = X ( z ) | j 2π k , k = 0,±1,±2, DFS & z- z =e N +∞ +∞transform ∑ x ( m)e ∑ π − j 2N km = = km x(m)WN m = −∞ m = −∞ ~ ( n) = 1 ~ N −1 1 N −1  +∞ km IDFS x ∑ X (k )WN = ∑  ∑ x(m)WN WN kn − kn N k =0 m = −∞ − Nk =0  +∞ 1 N −1 − k ( n − m ) +∞ +∞ = ∑ x ( m ) ∑ WN = ∑ x(m) ∑ δ (n − m − rN ) m = −∞ N k =0 m = −∞ r = −∞ +∞ +∞ +∞ = ∑ ∑ x(m)δ (n − m − rN ) = ∑ x(n − rN ) m = −∞ r = −∞ r = −∞
  31. 31. Comments When we sample X(z) on the unit circle, we obtain a periodic sequence in the time domain. This sequence is a linear combination of the original x(n) and its infinite replicas, each shifted by multiples of N or –N. If x(n)=0 for n<0 and n>=N, then there will be no overlap or aliasing in the time domain.
  32. 32. Comments x(n) = ~ (n) for 0 ≤ n ≤ N − 1 x ~ (n) R (n) = ~ (n)1 0 ≤ n ≤ N − 1 x (n) = x x  N 0 elseRN(n) is called a rectangular window of length N.THEOREM1: Frequency SamplingIf x(n) is time-limited (finite duration) to [0,N-1], then Nsamples of X(z) on the unit circle determine X(z) for all z.
  33. 33. Reconstruction FormulaLet x(n) be time-limited to [0,N-1]. Then from Theorem 1 we should be ableto recover the z-transform X(z) using its samples X~(k). ~ ( n) z − n =  1 −  N −1 N −1 N −1 N −1 ~ X ( z ) = ∑ x ( n) z = ∑ x −n ∑N ∑ X (k )WN kn  z − n n =0 n =0 n =0  k =0  1 N −1 ~  N −1 − kn − n  1 N −1 ~  N −1 − k −1 n  = ∑ X ( k )  ∑ W N z  = ∑ X ( k )  ∑ WN z  N k =0 ( )  n =0  N k =0  n=0  1 N −1 ~ 1 − WN kN z − N  − = ∑ X (k ) − k −1  WN-kN=1 N k =0  1 − WN z  − N N −1 ~ 1− z X (k ) X ( z) = N ∑ 1 − W −k z −1 k =0 N
  34. 34. The DTFT Interpolation Formula ~ 1 − e − jwN N −1 X (k ) N −1 ~ 1 − e − jwNX (e ) = jw N ∑ 1 − e j 2πk / N e − jw = ∑ X (k ) N (1 − e j 2πk / N e − jw ) k =0 k =0 sin ( wN ) − jw ( N2−1 ) An interpolation polynomialΦ ( w) = 2 e N sin ( 2 ) w N −1 ~ This is the DTFT interpolation X (e ) = ∑ X (k )Φ ( w − 2Nk ) jw π formula to reconstruct X(ejw) from k =0 its samples X~(k)Since Φ (0) = 1, we have that X(ej2pik/N)=X~(k), which meansthat the interpolation is exact at sampling points.
  35. 35. The Discrete Fourier Transform The discrete Fourier series provided us a mechanism for numerically computing the discrete-time Fourier transform. It also alert us to a potential problem of aliasing in the time domain. Mathematics dictates that the sampling of the discrete- time Fourier transform result in a periodic sequences x~(n). But most of the signals in practice are not periodic. They are likely to be of finite duration.
  36. 36. The Discrete Fourier Transform Theoretically, we can take care of this problem by defining a periodic signal whose primary shape is that of the finite duration signal and then using the DFS on this periodic signal. Practically, we define a new transform called the Discrete Fourier Transform (DFT), which is the primary period of the DFS. This DFT is the ultimate numerically computable Fourier transform for arbitrary finite duration sequences.
  37. 37. The Discrete Fourier Transform  First we define a finite-duration sequence x(n) that has N samples over 0<=n<=N as an N-point sequence +∞ ∆ ~ ( n) = x ∑ x(n − rN ) ~(n) = x(n mod N ) = x((n)) N x r = −∞ The compact relationships between x(n) and x~(n) are ~ (n) = x((n)) x ( Periodic extension) N x(n) = ~ (n) R (n) (Window operation) x NThe function rem(n,N) can be used to implement ourmodulo-N operation.
  38. 38. The Discrete Fourier Transform The Discrete Fourier Transform of an N-point sequence is given by ~  X (k ) 0 ≤ k ≤ N − 1 ~ X (k ) = DFT [ x(n)] =  = X ( k ) RN ( n)  0 else N −1 X (k ) = ∑ x(n)WN , 0 ≤ k ≤ N − 1 nk n =0Note that the DFT X(k) is also an N-point sequence, that is, it is notdefined outside of 0<=n<=N-1.DFT X(k) is the primary interval of X~(k). N −1 ~ ( n) R ( n) = 1 x(n) = IDFT [ X (k )] = x N N ∑ X (k )WN−kn ,0 ≤ n ≤ N − 1 k =0
  39. 39. Matlab Implementation X = WN x 1 * x = WN X N 1 1  1  1 W 1  WN N −1)  ( [W N = WN kn ] 0 ≤ k, n ≤ N −1 =    N      ( N −1) 2  1 WN N −1) (  WN 
  40. 40.  Zero-padding is an operation in which more zeros are appended to the original sequence. The resulting longer DFT provides closely spaced samples of the discrete-times Fourier transform of the original sequence. The zero-padding gives us a high-density spectrum and provides a better displayed version for plotting. But it does not give us a high-resolution spectrum because no new information is added to the signal; only additional zeros are added in the data. To get high-resolution spectrum, one has to obtain more data from the experiment or observations.
  41. 41. Properties of the DFT1. Linearity: DFT[ax1(n)+bx2(n)]=aDFT[x1(n)]+bDFT[x2(n)] N3=max(N1,N2): N3-point DFT2. Circular folding:  x(0) k =0 x((− n)) N =   x( N − k ) 1 ≤ k ≤ N − 1  X ( 0) k =0 DFT [ x((−n)) N ] = X ((− k )) N =   X (N − k ) 1 ≤ k ≤ N −1 Matlab: x=x(mod(-n,N)+1)
  42. 42. Properties of the DFT3. Conjugation: DFT [ x* (n)] = X * ((− k )) N4. Symmetry properties for real sequences:Let x(n) be a real-valued N-point sequence X (k ) = X * ((−k )) N Re[ X (k )] = Re[ X ((−k )) N ] : circular − even sequence Im[ X (k )] = − Im[ X (( N − k )) N ] : circular − odd sequence | X (k ) |=| X ((− k )) N | ∠X (k ) = −∠X ((− k )) N
  43. 43. Comments: Circular symmetry Periodic conjugate symmetry About 50% savings in computation as well as in storage. X(0) is a real number: the DC frequency X(N/2)(N is even) is also real-valued: Nyquist component Circular-even and circular-odd components: 1 xec (n) = [ x(n) + x((−n)) N ] DFT [ xec (n)] = Re[ X (k )] = Re[ X ((−k )) N ] 2 1 xoc (n) = [ x(n) − x((−n)) N ] DFT [ xoc (n)] = Im[ X (k )] = Im[ X ((−k )) N ] 2 The real-valued signals Function, p143
  44. 44. Properties5. Circular shift of a sequence DFT [ x((n − m)) N RN (n)] = WN X (k ) km6. Circular shift in the frequency domain − DFT [WN ln x(n)] = X ((k − l )) N RN (k )7. Circular convolution** N −1 x1 (n) ⊗ x2 (n) = ∑ x1 (m) x2 ((n − m)) N , 0 ≤ n ≤N − 1 m=0 DFT [ x1 (n) ⊗ x2 (n)] = X 1 (k ) X 2 (k )
  45. 45. Properties 18. Multiplication: DFT [ x1 ( n) ⋅ x2 (n)] = X 1 (k ) ⊗ X 2 (k ) N9. Parseval’s relation: N −1 N −1 1 E x = ∑ | x (n) | = 2 ∑ | X ( k ) |2 n =0 N k =0 Energy spectrum | X ( k ) |2 N Power spectrum X (k ) 2 N
  46. 46. Linear convolution using the DFTIn general, the circular convolution is an aliased version of thelinear convolution.If we make both x1(n) and x2(n) N=N1+N2-1 point sequences bypadding an appropriate number of zeros, then the circularconvolution is identical to the linear convolution.  N −1  x4 (n) = x1 (n) ⊗ x2 (n) =  ∑ x1 (k ) x2 ((n − k )) N  RN (n) m =0   N −1 +∞  =  ∑ x1 (k ) ∑ x2 (n − k − rN ) RN (n) m =0 r = −∞   +∞ N1 −1   +∞  =  ∑ ∑ x1 (k ) x2 (n − k − rN ) RN (n) =  ∑ x3 (n − rN ) RN (n)  r = −∞ m =0   r = −∞ 
  47. 47. Error Analysis When N=max(N1,N2) is chosen for circular convolution, then the first (M-1) samples are in error, where M=min(N1,N2).  +∞  e(n) = x4 − x3 =  ∑ x3 (n − rN ) RN (n) − x3 (n)  r = −∞    = ∑ x3 (n − rN ) RN (n) N ≥ max( N1 , N 2 ) r ≠0  e(n) = [ x3 (n − N ) + x3 (n + N )]RN (n) = x3 (n + N ) 0 ≤ n ≤ N − 1 n=0,1,…(N1+N2-1)-N X3(n) is also causal
  48. 48. Block Convolution Segment the infinite-length input sequence into smaller sections (or blocks), process each section using the DFT, and finally assemble the output sequence from the outputs of each section. This procedure is called a block convolution operation. Let us assume that the sequence x(n) is sectioned into N-point sequence and that the impulse response of the filter is an M-point sequence, where M<N. We partition x(n) into sections, each overlapping with the previous one by exactly (M-1) samples, save at last (N-M+1) output samples, and finally concatenate these outputs into sequence. To correct for the first (M-1) samples in the first output block, we set the first (M-1) samples in the first input blocks to zero.
  49. 49. The Fast Fourier Transform Although the DFT is computable transform, the straightforward implementation is very inefficient, especially when the sequence length N is large. In 1965, Cooley and Tukey showed the a procedure to substantially reduce the amount of computations involved in the DFT. This led to the explosion of applications of the DFT. All these efficient algorithms are collectively known as fast Fourier transform (FFT) algorithms.
  50. 50. The FFT Using the Matrix-vector multiplication to implement DFT: X=WNx (WN: N*N, x: 1*N, X: 1*N) takes N×N multiplications and (N-1)×N additions of complex number. Number of complex mult. CN=O(N2) A complex multiplication requires 4 real multiplications and 2 real additions.
  51. 51. Goal of an Efficient computation The total number of computations should be linear rather than quadratic with respect to N. Most of the computations can be eliminated using the symmetry and periodicity properties k ( n+ N ) (k + N )n W kn N =W N =W N WN + N / 2 = −WN kn kn CN=N×log2N If N=2^10, CN=will reduce to 1/100 times.Decimation-in-time: DIT-FFT, decimation-in-frequency: DIF-FFT
  52. 52. 4-point DFT→FFT example 3X (k ) = ∑ x(n)W4nk , 0 ≤ k ≤ 3; W4 = e − j 2π / 4 = − j n =0Efficient W40 = W44 = 1; W41 = W49 = − jApproach W42 = W46 = −1; W43 = j X=Wx X(0) = x(0)+x(2) + x(1)+x(3) = g1 + g2 X(1) = x(0)-x(2) – j(x(1)-x(3)) = h1 - jh2 X(2) = x(0)+x(2) - x(1)+x(3) = g1 - g2 X(3) = x(0)-x(2) + j(x(1)-x(3)) = h1 + jh2 It requires only 2 complex multiplications. Signal flowgraph
  53. 53. A 4-point DFT→FFT example X (0) X (1)   g1 g 2  1 1  g1 g 2  X (2) X (3) =  h − jh  *W2 = 1 − j  . *  h h  *W2   1 2    1 2 1 1  x(0) x(1)  =  . *W2 *  x(2) x(3) *W2 1 − j    W2 0*0 W2 0*1  1 1 where W2 =  = 1*0 W2 W2  1*1 1 − 1   so W2 * A or A *W2 no multiplic ation needed
  54. 54. Divide-and-combine approach To reduce the DFT computation’s quadratic dependence on N, one must choose a composite number N=LM since L2+M2<<N2 for large N. Now divide the sequence into M smaller sequences of length L, take M smaller L-point DFTs, and combine these into a large DFT using L smaller M-point DFTs. This is the essence of the divide-and-combine approach. n = Ml + m, 0 ≤ l ≤ L − 1, 0 ≤ m ≤ M − 1 k = p + Lq, 0 ≤ p ≤ L − 1, 0 ≤ q ≤ M − 1
  55. 55. Divide-and-combine approach M −1L −1 X ( p, q ) = ∑∑ x(l , m)WN Ml + m )( p + Lq ) ( m=0 l =0 M −1  mp  L −1 Mlp   = ∑ WN ∑ x(l , m)WN  WNLmq m=0   l =0    M −1  mq  mp  L −1 lp  Twiddle factor = ∑ WN ∑ x(l , m)WL  WM m=0   l =    0     L −int DFT       po  M − po int DFT Three-step procedure: P155
  56. 56. Divide-and-combine approach The total number of complex multiplications for this approach can now be given by CN=ML2+N+LM2<o(N2) This procedure can be further repeat if M or L are composite numbers. When N=Rv, then such algorithms are called radix-R FFT algorithms.
  57. 57. A 8-point DFT→FFT example 1. two 4-point DFT for m=1,2 1  pm  3   mq ∑ ∑ plX ( p, q) = W8  W4 x(l , m) W2  l=0  m= 0     W4 0× 0 W4 0×1 W4 0× 2 W4 0× 3  x(0,0) x(0,1)      3  W41× 0 W41×1 W41× 2 W41× 3   x(1,0) x(1,1)  ∑F ( p, m) =   =   *   l = 0  W4 2× 0 W4 2×1 W4 2× 2 W4 2× 3   x(2,0) x(2,1)    3× 0 3×1 3× 2 3× 3   x(3,0) x(3,1)  W4 W4 W4 W4     
  58. 58. pm2. G ( p, m) = W8 F ( p, m)is a 4 × 2 matrix dot mult. of 8 cplx multns3. 2 − poi nt DFTX with ∑ [W8 ] 1 pm mq( p, q ) = F ( p, m) W2 m =0 G (0,0) G (0,1)  G (1,0) G (1,1)  W 0×0 W 0×1  =  * 2 2  G (2,0) G (2,1) W 1×0 W 1×1     2 2  G (3,0) G (3,1) 
  59. 59. Number of multiplications A 4-point DFT is divided into two 2-point DFTs, with one intermedium matrix mult.  number of multiplications= 4×4cplx→ 2 ×1+ 1 ×4 cplx 16 →6 A 8-point DFT is divided into two 4-point DFTs, with one intermedium matrix mult.  8×8→2 ×6 + 2×4 64 →20 For 16-point DFT:  16×16→2 ×20 + 2×8 256 →56
  60. 60. Radix-2 FFT Algorithms Let N=2v; then we choose M=2 and L=N/2 and divide x(n) into two N/2-point sequence. This procedure can be repeated again and again. At each stage the sequences are decimated and the smaller DFTs combined. This decimation ands after v stages when we have N one-point sequences, which are also one-point DFTs. The resulting procedure is called the decimation-in-time FFT (DIF-FFT) algorithm, for which the total number of complex multiplications is: CN=Nv= N*log2N; using additional symmetries: CN=Nv= N/2*log2N Signal flowgraph in Figure 5.19
  61. 61. Decimation-in-frequency FFT In an alternate approach we choose L=2, M=N/2 and follow the steps in (5.49). We can get the decimation-frequency FFT (DIF-FFT) algorithm. Its signal flowgraph is a transposed structure of the DIT-FFT structure. Its computational complexity is also equal to CN=Nv= N/2*log2N
  62. 62. Matlab Implementation Function: X = fft(x,N)  If length(x)<N, x is padded with zeros.  If the argument N is omitted, N=length(x)  If x is matrix, fft computes the N-point DFT of each column of x  It is written in machine languag and not use the Matlab command. Therefore, it executes very fast.  It is written as a mixed-radix algorithm.  N=2v; N=prime number, it is reduced to the raw DFT.
  63. 63. Fast Convolutions Use the circular convolution to implement the linear convolution and the FFT to implement the circular convolution. The resulting algorithm is called a fast convolution algorithm. If we choose N=2v and implement the radix-2 FFT, then the algorithm is called a high-speed convolution. If x1(n) is N1-point, x2(n) is N2-point, then  log 2 ( N1 + N 2 −1)  N =2 Compare the linear convolution and the high-speed conv.
  64. 64. High-speed Block Convolution Overlap-and-save method We can now replace the DFT by the radix-2 FFT algorithm to obtain a high-speed overlap- and-save algorithm.
  65. 65. Discrete Fourier transform x0 , x1 ,..., x N −1 Maps a set of input points to another set of output points. DFT The operation is N −1 2π reversible. − j ik X k = ∑ xi e N i =0 X 0 , X 1 ,..., X N −1
  66. 66. Roots of the unity• What are the Nth roots of unity? (0, j) imaginary If N = 8 then we have 2π 2π j 0 j 1 e 8 ,e 8 2π 2π j 2 j 3 real e 8 ,e 8 2π 2π (-1, 0) (1, 0) j 4 j 5 e 8 ,e 8 2π 2π j 6 j 7 e 8 ,e 8 2π (0, -j) −j Define WN = e N
  67. 67. Calculating the DFT N −1 2π N −1 −j ik X k = ∑ xi e N = ∑ xiW N ik i =0 i =0  X0   1 1 1 1 ... 1  x0   X   1 W1 WN 2 WN 3 ... N −1  WN  x1    1   N  X 2   1 WN 2 WN 4 WN 6 ... WNN − 2  x2   = N −3    X 3   1 WN 3 WN 6 WN 9 ... WN  x3   ...   ...  .  X      N −1   1 WNN −1 WNN − 2 WNN −3  ... W  x N −1   How many arithmetic (+ and *) operations do we need tocalculate the DFT?
  68. 68. Computing the DFT using the FFT How can we do better? Fast Fourier Transform (FFT) N −1 2π −j ik X k = ∑ xi e N i =0 N / 2 −1 2π ( 2 i ) k N / 2 −1 2π ( 2 i +1) k −j −jXk = ∑ i =0 x2 i e N + ∑i =0 x2i +1e N N / 2 −1 2πik N / 2 −1 2πik 2πk −j −j −jXk = ∑ i =0 x2 i e N /2 + ∑ i =0 x2i +1e N /2 e N N / 2 −1 2πik N / 2 −1 2πik −j −jXk = ∑i =0 x2 i e N /2 +WN k ∑ i =0 x2i +1e N /2X k = X ke + WN X ko k The sum of N point DFT DFT of odd indices has been broken into DFT of even indices two N/2 point DFTs
  69. 69. Example when N=8Objective: Compute X0, X1, … X7 given x0, x1, …, x7 e x0 X0 X0 W80 x2 magic X 1e X1 W81 x4 box X 2 e X2 W82 x6 X 3e X3 W83 x1 o W84 X 0 X4 5 o W x3 magic X 8 1 X5 W86 x5 box X o 2 X6 7 x7 o W X 3 8 X7 Note WN + N / 2 = −WN k k that
  70. 70. Now let’s apply the idea recursively e ee X0x0 X0 X0 W40 X 1e W80x4 X 1ee X1 W41 X2 e W81x2 eo X 0 W42 X2 X e W82x6 X 1eo 3 3 3 X3 W 4 W 8 o X0 W84x1 X0 oe X4 W40 X 1o W 5x5 X 1oe 8 W41 o X2 X5 W86x3 X0 oo X6 W42 ox7 X W 7 X 1oo 3 8 X7 W43
  71. 71. One more time ee x0 X0 X0 e X0 x4 X ee 1 W40 X 1e W80 eo W41 X2 e W81 X1 x2 X 0 W42 X2 x6 X e W82 3 eo X3 X 1 W 4 3 W 8 3 oe o x1 X 0 X0 W84 X4 x5 X oe 1 W40 X 1o W8 5 X oo W41 o X2 X5 x3 0 W86 W42 X6 x7 X o W 7 3 oo 3 8 X7 X 1 W 4• How many operations do we need now?• What is the execution time on a general purpose CPU?• What is the execution time on a FPGA? How many resources u need?
  72. 72. Another way to visualize FFT computationsHow can we determine the order of the first inputs? x0 Butte X0 Butte Butte X4 x4 r r r x2 fly fly Butte fly Butte X2 Butte x6 r r X6 r fly fly fly x1 Butte Butte Butte X1 x5 r r r X5 x3 fly fly fly Butte Butte Butte X3 x7 r r r X7 fly fly fly
  73. 73. Savings so far … We have split the DFT computation into two halves: N −1 X[k] = ∑ x[n]WN nk k =0 ( N/ 2)−1 ( N/ 2)−1 = ∑ rk k x[2r]WN / 2 + WN ∑ rk x[2r + 1]WN / 2 n=0 n=0 Have we gained anything? Consider the nominal number of multiplications for N = 8  Original form produces 8 2 = 64 multiplications 2  New form produces 2(4 ) + 8 = 40 multiplications  So we’re already ahead ….. Let’s keep going!!
  74. 74. Signal flowgraph notation In generalizing this formulation, it is most convenient to adopt a graphic approach … Signal flowgraph notation describes the three basic DSP operations:  Addition x[n] x[n]+y[n] y[n]  Multiplication by a constant a x[n] ax[n] Delay z-1  x[n] x[n-1]
  75. 75. Signal flowgraph representationof 8-point DFT k X[k] = G[k] + WN H[k] Recall that the DFT is now of the form The DFT in (partial) flowgraph notation:
  76. 76. Continuing with thedecomposition … So why not break up into additional DFTs? Let’s take the upper 4-point DFT and break it up into two 2-point DFTs:
  77. 77. The complete decomposition into2-point DFTs
  78. 78. Now let’s take a closer look atthe 2-point DFT The expression for the 2-point DFT is: 1 1 X[k] = ∑ x[n]W2nk = ∑ x[n]e − j 2πnk / 2 n=0 n=0 Evaluating for k = 0,1 we obtainwhich in signal flowgraph notation looks like ... X[0] = x[0] + x[1] X[1] = x[0] + e − j 2π1 / 2 x[1] = x[0] − x[1] This topology is referred to as the basic butterfly
  79. 79. The complete 8-pointdecimation-in-time FFT
  80. 80. Number of multiplys for N-pointFFTs N = 2ν where ν = log 2 (N) Let (log2(N) columns)(N/2 butterflys/column)(2 mults/butterfly) or ~ N log 2 (N) multiplys
  81. 81. Comparing processing with and without FFTs “Slow” DFT requires N mults; FFT requires N log2(N) mults Filtering using FFTs requires 3(N log2(N))+2N mults α1 = N log2 (N) / N 2 ; α 2 = [3(N log2 (N)) + N] / N 2 Let N α1 α2 Note: 1024-point FFTs 16 .25 .8124 accomplish speedups of 100 32 .156 .50 for filtering, 30 for DFTs! 64 .0935 .297 128 .055 .171 256 .031 .097 1024 .0097 .0302
  82. 82. Additional timesavers: reducingmultiplications in the basic butterfly As we derived it, the basic butterfly is of the form r WN WN N / 2 r+ N /2 Since WN = −1 we can reducing computation by 2 by premultiplying by r WN 1 r WN −1
  83. 83. Bit reversal of the input first stages of the 8-point FFT: Consider the binary representation of the indices of the input: 0 000 If these binary indices are 4 100 time reversed, we get the 2 010 binary sequence representing 6 110 0,1,2,3,4,5,6,7 1 001 Hence the indices of the FFT 5 101 inputs are said to be in 3 011 bit-reversed order 7 111
  84. 84. Some comments on bit reversal In the implementation of the FFT that we discussed, the input is bit reversed and the output is developed in natural order Some other implementations of the FFT have the input in natural order and the output bit reversed (to be described Thursday) In some situations it is convenient to implement filtering applications by  Use FFTs with input in natural order, output in bit-reversed order  Multiply frequency coefficients together (in bit-reversed order)  Use inverse FFTs with input in bit-reversed order, output in natural order Computing in this fashion means we never have to compute bit reversal explicitly

×