Sei sulla pagina 1di 32

Fast Fourier Transform

Number of calculations in N point DFT


● Let x(k) be with N point DFT of an L point discrete time sequence x(n). Where
N>=L.
● Now in point DFT is a sequence consisting of N complex numbers. Each
complex number of the sequence is calculated using the following equation.
Number of calculations in N point DFT
● From the given equation we can say that the number of calculations to
calculate x(k) for one value of k are,
● N number of complex multiplication and (N -1) number of complex
addition
● The x(k) is a sequence consisting of N complex numbers.
● Therefore the number of calculations to calculate all and complex numbers of
the x(k) are

N*N=N2 number of complex multiplications and

N*(N -1) number of complex additions

● Hence in direct computation of in point DFT the total number of complex


additions are N*(N -1) and total number of complex multiplications are N2
Fast Fourier Transform

● The Fast Fourier Transform(FFT) is a method or algorithm for computing the


discrete fourier transform(DFT) with reduced number of calculations.

● The computational efficiency is achieved if we adopt a divide and conquer


approach this approach is based on the decomposition of an N point DFT
into successively smaller DFTs
● This basic approach leads to a family of an efficient computational algorithms
known collectively as FFT algorithms.
Discrete fourier transform

Direct computation Divide and conquer approach


(Matrix method) (FFT)
(Butterfly/signal-flow approach )
Not suitable for
large N
Decimation in time Decimation in frequency
DIT DIF

Radix-2 FFT Radix-4 FFT


Radix-r FFT

● Radix-r FFT in an N point sequence, if N can be expressed as N=rm ,

● then the sequence can be decimated into r point sequences.

● For each r-point sequence r-point DFT can be computed.

● From the result of r-point DFT, the r2-point DFT is computed.

● From the results of r2-point DFT result of r3-point DFT computed and so on
until we get rm-point DFT.

● This FFT algorithm is called radix-r FFT. in computing N point DFT by this
method the number of stages of computations will be m times.
Radix-2 FFT

● For radix-2 FFT the value of N should be such that N=2m so that N point
sequence is decimated into 2-point sequences and 2-point DFT for each
decimated sequences can computed.

● From the result of 2-point DFT, the 4-point DFT is computed.

● From the results of 4-point DFT result of 8-point DFT computed and so on
until we get N-point DFT.
Radix-2 FFT

● Let us consider the computation of the N = 2m point DFT by the divide-and


conquer approach.

● We split the N-point data sequence into two N/2-point data sequences f1(n)
and f2(n), corresponding to the even-numbered and odd-numbered samples
of x(n), respectively, that is

● Thus f1(n) and f2(n) are obtained by decimating x(n) by a factor of 2, and
hence the resulting FFT algorithm is called a decimation-in-time algorithm
Radix-2 FFT

● Let X(k)=N-point DFT of x(n), then

● F1(k)=N-point DFT of f1(n)


● F2(k)=N-point DFT of f2(n)
Radix-2 FFT

● Now the N-point DFT can be expressed in terms of the DFT's of the
decimated sequences as follows:
Radix-2 FFT

● But WN2 = WN/2. With this substitution, the equation can be expressed as

● where F1(k) and F2(k) are the N/2-point DFTs of the sequences f1(m) and
f2(m), respectively.
● Since F1(k) and F2(k) are periodic, with period N/2, we have

● F1(k+N/2) = F1(k) and


● F2(k+N/2) = F2(k). In addition, the factor WNk+N/2 = -WNk. Hence the equation
may be expressed as
Inverse FFT algorithm

● Let x(n) nad X(k) be N-point DFT pair, now by the definition of inverse DFT,
Inverse FFT algorithm

● In the highlighted equation, the expression inside the bracket is similar to that
of the DFT computation of the sequence, with the following differences
1. The summation index is k instead of n
2. The input sequence is X(k) instead of x(n)
3. The Phase Factors are complex conjugate of the Face Factor used for DFT
● Hence in order to compute inverse DFT of X(k) the FFT algorithm can be
used by taking the complex conjugate of phase factor
● Also from the equation, it is observed that the output of FFT computation
should be divided by N to get x(n)
Inverse FFT algorithm

● The following procedure can be followed to compute inverse DFT using FFT
algorithm:
1. Take N-point Frequency domain sequence X(k) as input sequence
2. Compute FFT by using complex conjugate of phase factor.
3. Divide the output sequence obtained in FFT computations by N to get the
sequence x(n)
● Thus a single FFT algorithm can be used for evaluation of both DFT and
Inverse DFT
Comparison of number of computations in direct
DFT and FFT
Practice problem for IFFT

1. Given X(k)={3,j,1,-j} find x(n) using IFFT


2. Given X(k)={10,-2+2j,-2,-2-2j} find x(n) using IFFT
DSP Algorithms
Linear FIR filtering
● One of the first applications of the (FFT) was to implement convolution faster
than the usual direct method.
● Finite impulse response (FIR) digital filters and convolution are defined by

● where, for an FIR filter, x(n) is a length-N sequence of numbers considered to


be the input signal, h(n) is a length-L sequence of numbers considered to be
the filter coefficients, and y(n) is the filtered output.
● Examination of this equation shows that the output signal y(n) must be a
length-(N + L − 1) sequence of numbers
Linear FIR filtering

● If the signal and filter length are both length-N, we say the arithmetic
complexity is of order N2 , O(N2 ).
● The goal is to calculate this convolution or filtering faster than directly
implementing.
● The most common way to achieve “fast convolution” is to section or block the
signal and use the FFT on these blocks to take advantage of the efficiency of
the FFT.
Fast Linear Convolution Algorithm.
● The DFT / FFT supports only circular convolution.
● Hence to get the result of linear convolution from circular convolution the
sequences, x(n) and h(n) should be converted to the size of y(n) by
appending with zeros and circular convolution of x(n) and h(n) is performed
1. Given x(n) with N1 samples and h(n) with N2 samples
2. Compute length of output sequence y(n), L=N1+N2-1
3. The given sequences should be converted to the size of y(n) by appending
with zeros.
4. Compute X(k) and H(k) of padded signals using FFT
5. Compute X(k)*H(k) to get Y(k)
6. Compute IDFT of Y(k) to get y(n) using IFFT
Fast Circular Convolution Algorithm

● The FFT can be used to efficiently perform convolution


● The FFT provide circular convolution since it assumes periodic signals.
● Must pad to obtain the Desire circular convolution.
1. Given x(n) with N1 samples and h(n) with N2 samples
2. Compute X(k) and H(k) of padded signals
3. Compute X(k)*H(k) to get Y(k)
4. Compute IDFT of Y(k) to get y(n)
Need of Fast Overlap-add/save method

● In practical application we often come across linear filtering of long data


sequences
● DFT Involves operation on block of data
● Block size of the data should be minimum because digital processor have
limited memory
● Two methods of filtering are:
1. Overlap save method
2. Overlap add method
Overlap-add method
● Consider a long input data sequence 𝑥(𝑛) of length L. Let us divide the input
sequence into blocks of size N.
● Let the Finite Impulse Response (FIR) filter be of length M. The result of linear
convolution of the input sequence of the length L with the filter of length M is a
sequence of length L + M – 1
● To execute this linear convolution using circular convolution, we have to
convert linear convolution into circular convolution by appending both the
sequences by extra zeros until the length of both the sequences is L + M – 1.
● We can use FFT to execute the circular convolution and the length of FFT as
N ≥ L + M – 1.
Overlap-add method
● Since each data block is terminated with M – 1 zeros, the last M – 1 points
from each output block must be overlapped and added to the M – 1 points of
the succeeding block.
● This overlapping and adding gives the output sequence.
Overlap-add algorithm

● Step 1: Take the L samples of data sequence 𝑥(𝑛). Append M – 1 extra zeros
to this block of data so that its length is L + M – 1.
● Step 2: Append L – 1 extra zeros to the FIR filter so that its length is L+M–1.
● Step 3: Convolve the two sequences circularly using FFT as shown in Fig. 1
to obtain the output as L + M – 1.
● Step 4: Repeat steps 1 to 3 for all the blocks.
● Step 5: Accumulate the results by adding the overlapped samples of the
convolved output for successive blocks as shown in fig
Linear FIR Filtering by Overlap save method
The algorithm for overlap-save method can be written as follows:
● Step 1: Take L samples of the data sequence 𝑥(𝑛).
● Step 2: Append M – 1 last sample from the first block at the start of the
second block and so on so that the length of each block is L + M – 1.
● Step 3: For the first block, there is no previous block, append zeros at the
start of this block.
● Step 4: Append L – 1 extra zeros to the FIR of the filter so that its length is L +
M – 1.
● Step 5: Convolve the two sequences circularly using FFT to obtain the output.
● Step 6: Repeat steps 1 to 5 for all the blocks.
● Step 7: Accumulate the result by appending samples of the convolved output
for successive blocks. Discard first M – 1 samples from result of every block
and then append M – 1 samples of the first block at the end of the
accumulated result by circular shifting as shown in Fig.3

● Step 8: Overlap the input data samples and save the rest of the
non-overlapping result samples

Potrebbero piacerti anche