 # DFT & FFT Computation.

## Presentation on theme: "DFT & FFT Computation."— Presentation transcript:

DFT & FFT Computation

Why DFT ? The two reasons :
It allows us to determine the frequency content of a signal (Spectral Analysis) Perform frequency analysis on a digital computer.

Fourier Transform Vs Discrete Fourier Transform :
Fourier Transform – Continuous function of ω and so cannot be processed by digital system. DFT – Converts the continuous function of ω to a discrete function of ω DFT – obtained by sampling one period of the Fourier Transform X(ω) at a finite number of frequency points. Sampling – performed at N equally spaced points in the period 0 < ω < 2 π (or) at ωk = 2 π k / N; 0 < k < N – 1.

Discrete Fourier Transform :
The Discrete Fourier Transform (DFT) converts time domain data to frequency domain data. where the Twiddle Factor is The Inverse DFT (IDFT) coverts frequency domain data to the time domain The DFT/IDFT requires N2 complex multiplies and N(N-1) complex additions

Problem : Compute 4 – point DFT of casual three sample sequence given by x[n] = 1/3 ; 0 < n < 2 = 0; else. Solution : |X(k)| = {1, 1/3, 1/3, 1/3} Angle of X(k) = {0, -П/2, 0, П/2}

Properties of DFT : Linearity :
If DFT{x1[n]} = X1(k) and DFT{x2[n]} = X2(k) Then DFT{ax1[n] + bx2[n]} = a X1(k) + b X2(k) Periodicity : If x[n] and x(k) are an N point DFT pair, then x[n + N] = x[n]; for all N X(k + N) = X(k); for all N

Properties of DFT : Time Reversal : If DFT{x[n]} = X(k)
Then DFT{x[N - n]} = X(N - k) Shifting : Then DFT{x[n – n0]} = X(k) e-j2Пkn0/N.

Properties of DFT : Circular convolution :
If DFT{x1[n]} = X1(k) and DFT{x2[n]} = X2(k) Then DFT{x1[n] x1[n]} = X1(k) X2(k) Multiplication of two sequence : If DFT{x1[n] x x2[n]} = 1/N {X1(k) X2(k)} (Dual of Circular convolution) * *

Relation between DFT with Z and Fourier Transform:
Z transform of x[n] is Relation : X(k) = X(z) | z = ej2Пk/N Fourier Transform of x[n] is Relation : X(k) = X(ω) | ω = 2Пk/N

Divide and Conquer

Divide and Conquer

Fast Fourier Transform (FFT):
It is a method (or algorithm) for computing the DFT with reduced number of calculations. The computational efficiency is achieved – divide and conquer approach. In an N point sequence, N = rm, where r – radix. For radix – 2 FFT, N = 2m, for radix – 4 FFT, N = 4m and so on…

Fast Fourier Transform (FFT):
In radix – 2 FFT, the N point sequence is decimated into 2 point sequence – 2 point DFT is computed. From the result of 2 point DFTs – 4 point DFTs can be computed. From the result of 4 point DFTs – 8 point DFTs can be computed and so on until we get N point DFT. For N point sequence (DFT : FFT) : Total number of addition – N(N-1) : N log2N. Total number of multiplication – N2 : (N/2) log2N.

Comparison of number of computation in direct DFT and FFT:
Number of points N Direct computation Radix – 2 FFT Complex additions N(N – 1) Complex Multiplication N2 Complex additions Nlog2N Complex Multiplication (N/2)log2N 4 8 16 32 64 128 12 56 240 992 4032 16,256 256 1,024 4,096 16,384 24 160 384 896 80 192 448

The decimation-in-frequency (DIF) FFT algorithm
Introduction: Decimation in frequency is an alternate way of developing the FFT algorithm It is different from decimation in time in its development, although it leads to a very similar structure

The decimation in frequency FFT (continued)
Consider the original DFT equation …. Separate the first half and the second half of time samples:

Continuing with decimation in frequency ...
For k even, let For k odd, let These expressions are the N/2-point DFTs of

These equations describe the following structure:

Continuing by decomposing the odd and even output points we obtain …

… and replacing the N/4-point DFTs by butterflys we obtain

The DIF FFT is the transpose of the DIT FFT
To obtain flowgraph transposes: Reverse direction of flowgraph arrows Interchange input(s) and output(s) DIT butterfly: DIF butterfly: Comment: We will revisit transposed forms again in our discussion of filter implementation

The DIF FFT is the transpose of the DIT FFT
Comparing DIT and DIF structures: DIT FFT structure: DIF FFT structure: Alternate forms for DIF FFTs are similar to those of DIT FFTs

Comparison of DIT and DIF:
Difference between DIT and DIF: In DIT, the input is bit–reversed while the output is in natural order. For DIF, the reverse is time, i.e., input is normal order, while output is bit–reversed. However, both DIT and DIF can go from the normal to shuffled data or vice–versa. Considering the butterfly diagram, in DIF, the complex multiplication takes place after the add–subtract operation. Similarities: Both algorithm requires same number of operations to compute DFT. Both algorithms require bit–reversed at same place during computation.

Computation of IDFT through FFT:
Take conjugate of X(k) [say X*(k)]. Compute the N–point DFT of X*(k) using radix–2 FFT. Take conjugate of the output sequence of FFT. Divide the sequence obtained in step–3 by N. the resultant sequence is x[n]. Note : Thus a single FFT algorithm serves the evaluation of both direct and inverse DFTs.

Problem: In an LTI system the input x[n] = { 1, 1, 1 } and the impulse response h[n] = { -1, -1 }. Determine the response of LTI system by radix–2 DIT and DIF FFT. Solution : y[n] = { -1, -2, -2, -1 }.

Convolution: The output or response of an LTI system is given by
X[n] – N1 samples. h[n] – N2 samples. Y[n] – N1 + N2 – 1 samples.

Sectioned convolution :
If one of the sequence (either the input sequence or impulse response sequence) is very much larger than the other, then it is very difficult to compute the linear convolution using DFT for the following reasons : The entire sequence should be available before convolution can be carried out. This makes long delay in getting the output. Large amounts of money is required to store the sequence. The larger sequence is sectioned into size of the smaller sequence. Linear convolution of each section of longer sequence and the smaller sequence is performed. The output sequence obtained from the convolutions of all the section are combined to get the overall output sequence.

Overall add method: Let N1 – length of longer sequence, N2 – length of smaller sequence. The longer sequence be divided into sections of size N3 (same as N2) samples. The linear convolution of each divided section with smaller sequence will produce an output sequence of size N3+N2 -1. The last N samples of each output sequence overlaps with the first N2 – 1 samples of next section While combining the output sequences of the various sectioned convolutions, the corresponding samples of overlapped regions are added and the samples of non – overlapped regions are retained as such.

Overall save method: Let N1 – length of longer sequence, N2 – length of smaller sequence. The longer sequence be divided into sections of size N3 (same as N2) samples. The smaller and the sectioned longer sequence (N3) are converted into the size of the output sequence (N3 + N2 – 1) by appending with zeros. The convolution between N2 with the sections of N3 is carried by means circular convolution.

Overall save method:

Problem: Perform the linear convolution of the following sequence by (i) overlap add method and (ii) overlap save method. x[n] = {1, -1, 2, -2, 3, -3} and h[n] = {-1, 1}. Also sketch the output sequence. Solution : (i) y[n] = {-1, 2, -3, 4, -5, 6, -7, 8, -4} (ii) y[n] = { *, 2, -3, 4, -5, 6, -7, 8, -4} y[n] = {-1, 2, -3, 4, -5, 6, -7, 8, -4, *}