Вы находитесь на странице: 1из 37

DFT and FFT

• FFT is an algorithm to convert a time domain


signal to DFT efficiently.
• FFT is not unique. Many algorithms are
available.
• Each algorithm has merits and demerits.
• In each algorithm, depending on the sequence
needed at the output, the input is regrouped.
• The groups are decided by the number of
samples.
FFTs
• The number of points can be nine too.
• It can be 15 as well.
• Any number in multiples of two integers.
• It can not be any prime number.
• It can be in the multiples of two prime
numbers.
FFTs
• The purpose of this series of lectures is to
learn the basics of FFT algorithms.
• Algorithms having number of samples 2N,
where N is an integer is most preferred.
• 8 point radix-2 FFT by decimation is used
from learning point of view.
• Radix-x: here ‘x’ represents number of
samples in each group made at the first
stage. They are generally equal.
• We shall study radix-2 and radix-3.
Radix-2: DIT or, DIF
• Radix-2 is the first FFT algorithm. It was
proposed by Cooley and Tukey in 1965.
• Though it is not the efficient algorithm, it lays
foundation for time-efficient DFT calculations.
• The next slide shows the saving in time
required for calculations with radix-2.
• The algorithms appear either in
(a) Decimation In Time (DIT), or,
(b) Decimation In Frequency (DIF).
• DIT and DIF, both yield same complexity and
results. They are complementary.
• We shall stress on 8 to radix 2 DIT FFT.
Other popular Algorithms
Besides many, the popular algorithms are:
• Goertzel algorithm
• Chirp Z algorithm
• Index mapping algorithm
• Split radix in prime number algorithm.

have modified approach over radix-2.


Split radix in prime number does not use even the twiddles.
We now pay attention to 8/radix-2 butterfly FIT FFT algorithm.
Relationship between exponential forms
and twiddle factors (W) for Periodicity = N
Sr. Exponential form Symbolic form
No.
01 e-j2n/N = e-j2(n+N)/N WN n = WNn+N

02 e-j2(n+N/2)/N = - e-j2n/N WNn+N/2= - WNn

03 e-j2k = e-j2Nk/N = 1 WNN+K = 1

04 e-j2(2/N) = e-j2/(N/2) WN 2 = WN/2


Values of various twiddles WNn for
length N=8
n WNn = e(-j2)(n/N) Remarks
0 1 = 10 WN 0
1 (1-j)/√2 = 1 -45 WN 1
2 -j = 1 -90 WN 2
3 - (1+j)/√2 = 1-135 WN 3
4 -1 = 1 -180 WN 4 = -WN 0
5 - (1-j)/√2 = 1 -225 WN 5 = -WN 1
6 j = 1 90 WN 6 = -WN 2
7 (1+j)/√2 = 1 45 WN 7 = -WN 3
DFT calculations
• The forward DFT, frequency domain output in the
range 0kN-1 is given by:
n1

  N 
x( n) W nk
X( k)  
n 0

• While the Inverse DFT, time domain output, again, in


the range 0kN-1 is denoted by

 n1 
  N 
X( k) W 

1  nk
x( n) 
N
k  0 
Matrix Relations
• The DFT samples defined by
N 1
X [k ]   kn
x[n]WN , 0  k  N 1
n 0

can be expressed in NxN matrix as


 N 1 nk 
X(k)   W N x(n) 
where
 n 0 
X   X [0] X [1] ..... X [ N  1] T

x  x[0] x[1] ..... x[ N  1] T


Matrix Relations
N 1

W
k 0
nk
N
can be expanded as NXN DFT matrix

1 1 1  1 
1 W 1 W 2
 WN ( N 1) 
N 1  N N 
W
k 0
nk
N  1 WN2

WN4  WN2( N 1) 

      
1 WN( N 1) WN2( N 1)  WN( N 1) 2 

n 1

  N 
x( n) W nk
X( k)  
DFT: n 0

For N of length 4,range of n, k = [0 1 2 3] each.


Hence X(n) = x(0)WNn.0+x(1)WNn.1+x(2)WNn.2 + x(3)WNn.3

x(0) x(1) x(2) x(3)


X(0) = W40x0 W40x1 W40x2 W40x3
X(1) = W41x0 W41x1 W41x2 W41x3
X(2) = W42x0 W42x1 W42x2 W42x3
X(3) = W43x0 W43x1 W43x2 W43x3
x(0) x(1) x(2) x(3)
X(0) = W40x0 W40x1 W40x2 W40x3
X(1) = W41x0 W41x1 W41x2 W41x3
X(2) = W42x0 W42x1 W42x2 W42x3
X(3) = W43x0 W43x1 W43x2 W43x3
Can be rewritten as:

x(0) x(1) x(2) x(3)


X(0) = W4 0 W4 0 W4 0 W4 0
X(1) = W40 W41 W42 W43
X(2) = W4 0 W4 2 W4 4 W4 6
X(3) = W4 0 W4 3 W4 6 W4 9
x(0) x(1) x(2) x(3)
X(0) = W4 0 W4 0 W4 0 W4 0
X(1) = W4 0 W4 1 W4 2 W4 3
X(2) = W40 W42 W44 W46
X(3) = W4 0 W4 3 W4 6 W4 9

x(0) x(1) x(2) x(3)


X(0) = W4 0 W4 0 W4 0 W4 0
X(1) = W4 0 W4 1 W4 2 -W41
X(2) = W4 0 W4 2 W4 0 W4 2
X(3) = W4 0 -W41 W4 2 W4 1
x(0) x(1) x(2) x(3)
X(0) = W4 0 W4 0 W4 0 W4 0
X(1) = W4 0 W4 1 W4 2 -W41
X(2) = W4 0 W4 2 W4 0 W4 2
X(3) = W4 0 -W41 W4 2 W4 1

x(0) x(1) x(2) x(3)


X(0) = 1 1 1 1
X(1) = 1 -j -1 j

X(2) = 1 -1 1 -1
X(3) = 1 j -1 -j
Matrix Relations
• Likewise, the IDFT is
N 1
kn
x[n]   X [k ]WN , 0  n  N 1
k 0

can be expressed in NxN matrix form as


1

xn  
 N 1
nk 

 n0 WN  X(k) 

Matrix Relations
N 1

 N
W  nk can also be expanded as NXN DFT matrix

k 0 1 1 1  1 
1 W 1 W 2
 WN( N 1) 
N 1  N N

 N
W  nk

k 0
 1 WN2

WN4  WN2( N 1) 

  W    
N 1
 nk
N

1 WN( N 1) WN2( N 1) ( N 1) 2 


k 0

 WN 
*
N 1
 N 1
nk 
Observe:
 N
W  nk

k 0
 1  W
 N n0 N 
The inversion can be had by Hermitian conjugating j by –j and dividing by N.
x(0) x(1) x(2) x(3)
X(0) = 1 1 1 1
X(1) = 1 -j -1 j

X(2) = 1 -1 1 -1
X(3) = 1 j -1 -j

 X( 0)  1 1 1 1   x( 0) 
     
 X( 1)   1  j 1 j   x( 1) 
 
 X( 2)   1 1 1 1   x( 2) 
   1 j 1  j   x( 3) 
 X( 3)     

Characterisitc or system matrix


 X( 0)  1 1 1   x( 0)
1 
     
 X( 1)   1 j 1 j   x( 1) 
 
 X( 2)   1 1 1 1   x( 2) 
  1 j   
 X( 3)   1  j   x( 3) 
 x( 0)    1 1 1 1   X( 0) 
The effective determinant of above is 1/4.
 x( 1)    1  1 j 1  j    X( 1) 
Conversion in system matrices of DFT and IDFT obtained x(by2)  replacing
 4  1 1 1 1 by  –j.
 X( 2j ) by
 x( 3)    1  j 1 j   X( 3) 
Inversion of above matrix is:      

 x( 0)    1 1 1 1   X( 0) 
     
 x( 1)    1  1 j 1  j    X( 1) 
 x( 2)   4  1 1 1 1   X( 2) 
 x( 3)    1  j 1 j   X( 3) 
     
FOR 8 point DFT: N=8
• The system Matrix is:
W80x0 W80x1 W80x2 W80x3 W80x4 W80x5 W80x6 W80x7

W81x0 W81x1 W81x2 W81x3 W81x4 W81x5 W81x6 W81x7

W82x0 W82x1 W82x2 W82x3 W82x4 W82x5 W82x6 W82x7

W83x0 W83x1 W83x2 W83x3 W83x4 W83x5 W83x6 W83x7

W84x0 W84x1 W84x2 W84x3 W84x4 W84x5 W84x6 W84x7

W85x0 W85x1 W85x2 W85x3 W85x4 W85x5 W85x6 W85x7

W86x0 W86x1 W86x2 W86x3 W86x4 W86x5 W86x6 W86x7

W87x0 W87x1 W87x2 W87x0 W87x4 W87x5 W87x6 W87x7


The characteristic matrix of 8-point
DFT is:
1 1 1 1 1 1 1 1 
 
1 1  j ( 1  j) ( 1  j) 1  j 
j 1 j
 2 2 2 2 
1 j 1 j 1 j 1 j

 
1 ( 1  j)
j
1  j
1
1  j
j
( 1  j) 
 2 2 2 2 
 
1 1 1 1
1 1 1 1

 ( 1  j) 1  j 1  j ( 1  j) 
j 1
1 2 2 2
j
2 
 
1 j 1 j 1 j 1 j 
 1  j ( 1  j) ( 1  j) ( 1  j) 
1 j 1 j 
 2 2 2 2 
DFT and its Inverse
Conversion in system matrices of DFT and IDFT obtained by
replacing by j by –j..
1 1 1 1 1 1 1 1   1 1 1 1 1 1 1 1 
   
1 1  j j
( 1  j)
1
( 1  j)
j
1 j   1 1 j
j 
1 j
1 
1 j
j
1  j 
 2 2 2 2   2 2 2 2 
1 j 1 j 1 j 1 j
  1 j 1 j 1 j 1 j

   
1 ( 1  j) j
1 j
1
1 j
j
( 1  j)   1 
1 j
j
1 j
1
1 j
j 
1  j 
 2 2 2 2  1  2 2 2 2 
    
1 1 1 1 1 1 1 1
1 1 1 1
 8
 1 1 1 1

 ( 1  j) 1 j 1 j ( 1  j)   1 j 1 j 1 j 1  j 
j 1  1 j 
1 2 2 2
j
2   1 2
j
2 2 2 
   
1 j 1 j 1 j 1 j   1 j 1 j 1 j 1 j 
 1 j ( 1  j) ( 1  j) ( 1  j)   1 j 1 j 1 j 1  j 
1 j 1 j   1 j  1  j 
 2 2 2 2   2 2 2 2 

DFT Effective
IDFT
determinant
Calculation advantage in radix-2
algorithms for various values of N
No. of DIRECT COMPUTATION FFT computaton Improvement
computation complex Complex complex Complex
points multiplication additions Total multiplication additions Total A/B
N N^2 N^2-N A (N/2)ln(N) Nln(N) B
8 64 56 120 8.32 16.64 24.95 4.81
16 256 240 496 22.18 44.36 66.54 7.45
32 1024 992 2016 55.45 110.90 166.36 12.12
64 4096 4032 8128 133.08 266.17 399.25 20.36
128 16384 16256 32640 310.53 621.06 931.59 35.04
256 65536 65280 130816 709.78 1419.57 2129.35 61.43
512 262144 261632 523776 1597.01 3194.02 4791.03 109.32
1024 1048576 1047552 2096128 3548.91 7097.83 10646.74 196.88
2048 4194304 4192256 8386560 7807.61 15615.22 23422.83 358.05
4096 16777216 16773120 33550336 17034.79 34069.57 51104.36 656.51
8192 67108864 67100672 134209536 36908.70 73817.40 110726.10 1212.09
16384 268435456 268419072 536854528 79495.66 158991.33 238486.99 2251.09
The Process of Decimation
• First step of process of decimation is splitting a
sequence in smaller sequences.
• A sequence of 15 can be splitted in five
sequences of threes or three sequences of fives.
• A sequence of 16 numbers can be splitted in 2
sequences of 8. Further,
 each sequence of 8 can be be splitted in two
sequences of 4;
 Subsequently each sequence of 4 can be splitted in
two sequences of two;
 There can be various combinations and varied
complexities.
4-point DFT
 X( 0)  1 1 1   x( 0) 
1
    
 X( 1)   1 j 1 j   x( 1) 
 
 X( 2)   1 1 1 1   x( 2) 
     
 X( 3)  1 j 1  j   x( 3) 
Can be, by interchanging col. 2 and 3, seen as

 X( 0)   1 1 1 1   x( 0) 
     
 X( 1)   1 1  j j   x( 2) 
 
 X( 2)   1 1 1 1   x( 1) 
     
 X( 3)   1 1 j  j   x( 3) 
4-point DFT
 X( 0)   1 1 1 1   x( 0) 
     
 X( 1)   1 1  j j   x( 2) 
 
 X( 2)   1 1 1 1   x( 1) 
   1 1 j  j   x( 3) 
 X( 3)     
The system matrix is rewritten as

 X( 0)   1 0 1  1
0 1 0 0   x( 0) 
     
 X( 1)    0 1 0 j   1 1 0 0   x( 2) 
 
 X( 2)   1 0 1 0   0 0 1 1   x( 1) 
 X( 3)   0   
   1 0 j  0 0 1 1   x( 3) 
Matrix manipulation to get the desired
input sequence from the actual

 x( 0)   1 0 0 0
  x( 0) 

 x( 2)    0 0 1 0   x( 1) 

 x( 1)   0 1 0 0   x( 2) 
 x( 3)   0   
   0 0 1   x( 3) 
Process of decimation: example
X[n] X[3] X[4]

X[2]
X[6]
X[0]
-2 -1 1 5 7 n
2 3 4 6 X[7]
X[1]

X[5]

Separating the above sequence for +ve ‘n’ in even and odd sequence numbers .

X[n] X[4] X[n] X[3]

X[2] X[6]
X[0]
-2 -1 1 5 7 n -2 -1 1 5 7 n
2 3 4 6 2 3 4 6 X[7]
X[1]

X[5]
Process of decimation: example
X[n] X[3]
X[n] X[4]

X[2] X[6]
X[0]
- 1 5 n - - 1 5 7 n
7
2 3 4 6 2 3 4 6 X[7]
X[1]

X[5]
Shift the sequence to left by one and
Compress the even sequence by two.
compress by two
X[4] X[n] X[3]
X[n]
X[2] X[6]
X[0]
4 6 n
- n
2 1 3 2 X[7]
X[1]
The compression is also called decimation X[5]
 X( 0)   1 0 1 0 1 1   x( 0) 
0 0
     
 X( 1)    0 1 0 j   1 1 0 0   x( 2) 
  First stage of
 X( 2)   1 0 1 0   0 0 1 1   x( 1)  realization
 X( 3)   0   
   1 0 j  0 0 1 1   x( 3) 

 x( 0)  x( 2)  1 1   x( 0) 
0 0
    
Second  x( 0)  x( 2)   1 1 0 0   x( 2) 
 
 x( 1)  x( 3)  0 0 1 1   x( 1) 
stage

 x( 1)  0  
  x( 3)   0 1 1   x( 3) 

 X( 0)  1 0 1   x( 0)
0  x( 2) 
     
 X( 1)   0 1 0  j   x( 0)  x( 2) 
 
 X( 2)  1 0 1 0   x( 1)  x( 3) 
  0 1   
 X( 3)   0 j   x( 1)  x( 3) 
Decimation of 4 point DFT into 2xradix-2

x0 x0+x2 X[0]

Wo
x2 -1 xo -x2 X[1]
w1

x1+x3 X[2]
x1 W 2

x1-x3 W 3
X[3]
x3 -1

• The values of
W40= 1; W42 = -1; W41= -j; and W 43 = j
Decimation of 4 point DFT into 2xradix-2

x0 x0+x2 X[0]
N/4 point
DFT Wo
x2 xo -x2 X[1]
even
w1

x1+x3 X[2]
x1 W 2
N/4 point
DFT x1-x3 W 3
X[3]
x3
odd

• The values of
W40= 1; W42 = -1; W41= -j; and W 43 = j
N=8-point radix-4 DIT-FFT:
X0[0]
X[0]
X(0)
1
X0[1]
X(2) N/2 point X[1]
DFT X0[2] a
X(4) X[2]
[EVEN]
X0[3] -j 
X(6) X[3]
-b

X1 [0]
-1 X[4]
X(1)
X1 [1]
-a  X[5]
X(3) N/2 point
DFT X1[2]
X(5) [ODD] j X[6]

X1[3] b X[7]
X(7)

Note: -W4 =W0=1; -W5= W1 = a = (1-j)/2;


-W2 = W6=j and -W3 = W7 = b = (1+j)/2
The matrix equation of the slide is:
 X ( 0) 
 0 

 X( 0)  1 0 0 0 1 0 0 0   Xo( 1) 
 X( 1)
 0 1 0 0 0 a 0 0
  
     Xo( 2) 
 X( 2)  0 0 1 0 0 0 j 0   
 X( 3)  0 0 0 1 0 0 0 b   X0( 3) 
     
1
 X( 4)
 1 0 0 0 0 0 0
  1
X ( 0)

 X( 5)  0 1 0 0 0 a 0 0   X ( 1) 
 X( 6)  0 0 1 0 0 0 j 0   1 
     X ( 2) 
 X( 7)  0 0 0 1 0 0 0 b   1 
 X1( 3) 
 

• Note the symmetry between 1st and 3rd partition


and 2nd and 4th partition of system matrix.
N=8-point radix-2 DIT-FFT:
N/4 point DFT N/2 point DFT N-point DFT

x[0] X[0]

x[4] X[1]
-1

x[2] X[2]
-1

x[6] w2
X[3]
-1 -1

x[1] X[4]
-1

X[5]
x[5] w1 -1
-1

x[3] w2 X[6]
-1 -1

x[7] w2 w3 X[7]
-1 -1 -1
System Matrix for N/2 point DFT
Block

 0 
X ( 0)

 X ( 1)  1 0 1 0 0 0 0 0  x( 0)  x( 4) 
 o
 0 1 0 j 0 0 0 0
  x( 0)  x( 4)

 Xo( 2)     
   1 0 1 0 0 0 0 0   x( 2)  x( 6) 
 X0( 3)  0 1 0 j 0 0 0 0   x( 2)  x( 6) 
     
 x( 5)
 1 
X ( 0)
0 0 0 0 1 0 1 0
  x( 1) 
 X ( 1)  0 0 0 0 0 1 0  j   x( 1)  x( 5) 
 1  0 0 0 0 1 0 1 0   x( 3)  x( 7) 
 X ( 2)     
 1  0 0 0 0 0 1 0 j   x( 3)  x( 7) 
 X1( 3) 
 

Note that partitions 2 and 3 are null matrices while partitions 1 and 4 are identical.
Also note that subpartitions 1st and 3rd are I matrices and
2nd and 4th sub-partitions have sign difference.
Cross diagonals in either case are zero.
System Matrix for N/4 block

 x( 0)  x( 4)  1 1 0 0 0 0 0 0   x( 1) 
 x( 0)  x( 4)
 1 1 0 0 0 0 0 0
  x( 4) 
    
 x( 2)  x( 6)  0 0 1 1 0 0 0 0   x( 2) 
 x( 2)  x( 6)  0 0 1 1 0 0 0 0   x( 6) 
     
 x( 5)
 x( 1)  0 0 0 0 1 1 0 0
 x( 1)

 x( 1)  x( 5)  0 0 0 0 1 1 0 0   x( 5) 
 x( 3)  x( 7)  0 0 0 0 0 0 1 1   x( 3) 
    
 x( 3)  x( 7)  0 0 0 0 0 0 1 1   x( 7) 

Again see the simile between 1and 4 partitions. Note that 2 and 3 s are null matrices.
Further note the sub-partition matrices. They also follow the same rule.
All the elements are real.
Signal flow graph for decimation of 8 point DFT
N/4 point DFT N/2 point DFT N-point DFT

x[0] X[0]

x[4] X[1]
-1

x[2] X[2]
-1

x[6] w2
X[3]
-1 -1

x[1] X[4]
-1

X[5]
x[5] w1 -1
-1

x[3] w2 X[6]
-1 -1

x[7] w2 w3 X[7]
-1 -1 -1

Вам также может понравиться