0% found this document useful (0 votes)
3 views

chapter9computationofthedft-130219120328-phpapp01 - Copy

Chapter 9 discusses the computation of the Discrete Fourier Transform (DFT) with a focus on efficient algorithms such as the Fast Fourier Transform (FFT) and the Goertzel Algorithm. It covers the computational complexity of DFT, practical considerations for implementation, and various methods for optimizing the process. The chapter emphasizes the efficiency of FFT and Goertzel in handling convolution and DFT calculations compared to direct methods.

Uploaded by

Mona Sayed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

chapter9computationofthedft-130219120328-phpapp01 - Copy

Chapter 9 discusses the computation of the Discrete Fourier Transform (DFT) with a focus on efficient algorithms such as the Fast Fourier Transform (FFT) and the Goertzel Algorithm. It covers the computational complexity of DFT, practical considerations for implementation, and various methods for optimizing the process. The chapter emphasizes the efficiency of FFT and Goertzel in handling convolution and DFT calculations compared to direct methods.

Uploaded by

Mona Sayed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 50

Biomedical

Chapter Signal processing


9 Computation of the
Discrete
Fourier Transform
Zhongguo Liu
Biomedical Engineering
School of Control Science and Engineering, Shandong
University

Zhongguo Liu_Biomedical Engineering_Shandong


25/4/27 1
1 Univ.
Chapter 9 Computation of the
Discrete Fourier Transform
9.0 Introduction
.1 Efficient Computation of Discrete Fourier Transfor
.2 The Goertzel Algorithm
.3 decimation-in-time FFT Algorithms
.4 decimation-in-frequency FFT Algorithms
.5 practical considerations ( software realization)

2
9.0 Introduction
Implement a convolution of two
sequences by the following procedure:
1. Compute the N-point DFTX 1 k  X 2 k 
and
x1 n
of the two sequence x2 nand
2. ComputeX 3 k   X 1 k X 2 k  for0 k  N  1
3. Computex3 n  x1 n N x2 n as the
X 3 k  of
inverse DFT
Why not convolve the two sequences directly?

There are efficient algorithms called Fast


Fourier Transform (FFT) that can be orders
of magnitude more efficient than others.
3
9.1 Efficient Computation of
Discrete Fourier Transform
The DFT pair was given as
N1
 j 2 / N kn 1 N1
j 2 / N kn
X  k   x[n]e x[n]   X k e
n 0
N k 0

Baseline for computational complexity:


Each DFT coefficient requires
N complex multiplications;
N-1 complex additions
All N DFT coefficients require
N2 complex multiplications;
N(N-1) complex additions
4 4
9.1 Efficient Computation of
Discrete Fourier Transform
N1
 j 2 / N kn
X  k   x[n]e
n 0

Complexity in terms of real operations


4N2 real multiplications
2N(N-1) real additions (approximate 2N2)

5 5
9.1 Efficient Computation of
Discrete Fourier Transform
Most fast methods are based on Periodicity properties
Periodicity in n and k; Conjugate symmetry
 j 2 / N k  N  n   j 2 / N kN  j 2 / N k  n  j 2 / N kn
e e e e
 j 2 / N kn  j 2 / N k n  N  j 2 / N k  N n
e e e
Re   ]

6 6
9.2 The Goertzel Algorithm
Makes use of the periodicity j 2 / N Nk
e e j 2 k 1
Multiply DFT equation with this factor
j 2 / N kN
N1
 j 2 / N rk N1
j 2 / N k  N  r 
X  k  e  x[r ]e  x[r ]e
r 0 r 0

Define

j 2 / N k n  r 
yk  n    x[r ]e u n  r
r  
using x[n]=0 for n<0 and n>N-1
X  k   yk  n  n N
X[k] can be viewed as the output of a filter to the input x[n]
Impulse response of filter: j 2 / N kn
h[n] e u  n
X[k] is the output of the filter at time n=N
7 7
9.2 The Goertzel Algorithm
Goertzel j 2 / N kn
Filter: h[n] e u[n] W  knu[n]
N

1
H k z  
1  WN k z  1

yk [n]  yk [n  1]WN k  x[n], n 0,1,..., N , yk [ 1] 0

X  k   yk  n  n N , k 0,1,..., N
N1
X  k   x[n]WNkn
n 0
Computational complexity
4N real multiplications; 4N real additions
Slightly less efficient than the direct method
But it avoids computation and storage ofW kn
8
N 8
Second Order Goertzel Filter
Goertzel Filter
1
H k z   2
j k 1
1 e N z
Multiply both numerator and denominator
2 2
 j k  j k
1 e N
z 1 1 e N
z 1
H k z   
 j
2
k   2
 j k 1  2 k  1  2
 1  e N
z  1
 1  e N
z  1  2 cos z z
N
  
2 k
y[n]  y[n  2]  2 cos y[n  1]  x[n], n 0,1,..., N
N
yk [ N ]  y[ N ]  WNk y[ N  1]  X  k  , k 0,1, ..., N
9 9
Second Order Goertzel Filter
2 k
y[n]  y[n  2]  2 cos y[n  1]  x[n], n 0,1,..., N
N
yk [ N ]  y[ N ]  WNk y[ N  1]  X  k  , k 0,1, ..., N
Complexity for one DFT coefficient ( x(n) is complex
sequence).
Poles: 2N real multiplications and 4N real additions
Zeros: Need to be implement only once:
4 real multiplications and 4 real additions
Complexity for all DFT coefficients
Each pole is used for two DFT coefficients
Approximately N2 real multiplications and 2N2 real
additions
1 10
Second Order Goertzel Filter

2 k
y[n]  y[n  2]  2 cos y[n  1]  x[n], n 0,1,..., N
N

yk [ N ]  y[ N ]  WNk y[ N  1]  X  k  , k 0,1, ..., N

If do not need to evaluate all N DFT coefficients


Goertzel Algorithm is more efficient than FFT if
less than M DFT coefficients are needed,M < log2N

11 11
9.3 decimation-in-time FFT
Algorithms
Makes use of both periodicity and symmetry
Consider special case of N an integer power of 2
Separate x[n] into two sequence of length N/2
Even indexed samples in the first sequence
Odd indexed samples in the other sequence

N1
 j 2 / N kn
X  k   x[n]e
n 0

 j 2 / N kn  j 2 / N kn


  x[n]e   x[n]e
n even n odd
1 12
9.3 decimation-in-time FFT
Algorithms
 j 2 / N kn  j 2 / N kn
X  k    x[n]e   x[n]e
n even n odd
Substitute variables n=2r for n even and n=2r+1 for odd
N /2  1 N /2  1
X  k    x[2r ]W 2 rk
N   x[2r  1]WN 2 r 1k
r 0 r 0
N /2  1 N /2  1
  x[2r ]WNrk/2  WNk  x[2r  1]WNrk/2
r 0 r 0

G  k   W H  k 
k  j 2 2  j 2
N W 2
N e N e N /2 WN /2
G[k] and H[k] are the N/2-point DFT’s of each subsequence
1 13
9.3 decimation-in-time FFT
Algorithms
N /2  1 N /2  1
X  k    x[2r ]W rk
N /2
k
W
N  x[2r  1]W rk
N /2
r 0 r 0

G  k   W H  k 
k
 j 2 2 rk  j 2 rk
N
e N e N /2 WNrk/2
N1
k 0,1,..., k 0,1,..., N
2
 N  N
G  k   G  k  H  k   H  k 
 2  2
G[k] and H[k] are the N/2-point DFT’s of each subsequence

1 14
8-point DFT using decimation-in-time

1 Figure 9.3
computational complexity
Two N/2-point DFTs
2(N/2)2 complex multiplications
2(N/2)2 complex additions
Combining the DFT outputs
N complex multiplications
N complex additions
Total complexity
N2/2+N complex multiplications
N2/2+N complex additions
More efficient than direct DFT

1 16
9.3 decimation-in-time FFT
Algorithms

Repeat same process ,


Divide N/2-point DFTs into
Two N/4-point DFTs
Combine outputs

N=8

1 17
9.3 decimation-in-time FFT
Algorithms
After two steps of decimation in time

Repeat until we’re left with two-point DFT’s


1 18
9.3 decimation-in-time FFT
Algorithms
flow graph for 8-point decimation in time

Complexity:
Nlog2N complex multiplications and additions
1 19
Butterfly Computation
Flow graph constitutes of butterflies

We can implement each butterfly with one multiplication

Final complexity for decimation-in-time FFT


(N/2)log2N complex multiplications and additions
2 20
9.3 decimation-in-time FFT
Algorithms
Final flow graph for 8-point decimation in time

Complexity:
(Nlog2N)/2 complex multiplications and Nlog2N additions
2 21
9.3.1 In-Place Computation 同址运算
Decimation-in-time flow graphs require two sets of registers
Input and output for each stage

X 0  0  x  0 x  0 X 2  0 X  0
X 0  1  x  4 x  4 X 2  1 X 1
X 0  2  x  2 x  2 X 2  2 X  2
X 0  3  x  6 x  6 X 2  3 X  3
X 0  4  x 1 x 1 X 2  4 X  4
X 0  5  x  5 x  5 X 2  5 X  5
X 0  6  x  3 x  3 X 2  6 X  6
2X0  7 x  7 x  7 X 2  7 X  7 22
9.3.1 In-Place Computation 同址运算
Note the arrangement of the input indices
Bit reversed indexing (码位倒置)

X 0  0  x  0  X 0  000  x  000 x  0 X  0
X 0  1  x  4  X 0  001  x 100 x  4 X 1
X 0  2  x  2  X 0  010  x  010 x  2 X  2
X 0  3  x  6  X 0  011  x 110 x  6 X  3
X 0  4  x 1  X 0 100  x  001 x 1 X  4
X 0  5  x  5  X 0 101 x 101 x  5 X  5
X 0  6  x  3  X 0 110  x  011 x  3 X  6
X 0  7   x  7   X 0 111  x 111 x  7 X  7

2 23
cause of bit-reversed order

binary coding for position :


000
001

010
011

100
101

110
111

must padding 0 to Figure 9.13


N 2 M
2
9.3.2 Alternative forms
Note the arrangement of the input indices
Bit reversed indexing (码位倒置)

X 0  0  x  0  X 0  000  x  000 x  0 X  0
X 0  1  x  4  X 0  001  x 100 x  4 X 1
X 0  2  x  2  X 0  010  x  010 x  2 X  2
X 0  3  x  6  X 0  011  x 110 x  6 X  3
X 0  4  x 1  X 0 100  x  001 x 1 X  4
X 0  5  x  5  X 0 101 x 101 x  5 X  5
X 0  6  x  3  X 0 110  x  011 x  3 X  6
X 0  7   x  7   X 0 111  x 111 x  7 X  7

2 25
9.3.2 Alternative forms

strongpoint : in-place computations


shortcoming : non-sequential access of data
Figure 9.14
2
Figure 9.15

shortcoming : not in-place computation


non-sequential access of data
2
Figure 9.16

shortcoming : not in-place computation


strongpoint: sequential access of data
2
9.3 decimation-in-time FFT
Algorithms
 j 2 / N kn  j 2 / N kn
X  k    x[n]e   x[n]e
n even n odd
Substitute variables n=2r for n even and n=2r+1 for odd
N /2  1 N /2  1
X  k    x[2r ]W 2 rk
N   x[2r  1]WN 2 r 1k
r 0 r 0
Review
N /2  1 N /2  1
  x[2r ]WNrk/2  WNk  x[2r  1]WNrk/2
r 0 r 0

G  k   W H  k 
k  j 2 2  j 2
N W 2
N e N e N /2 WN /2
G[k] and H[k] are the N/2-point DFT’s of each subsequence
2 29
9.3.1 In-Place Computation 同址运算
Bit reversed indexing (码位倒置)

X 0  000 x  000 x  0 X  0
X 0  001 x 100 x  4 X 1
X 0  010 x  010 x  2 X  2
X 0  011 x 110 x  6 X  3
X 0 100 x  001 x 1 X  4
X 0 101 x 101 x  5 X  5
X 0 110 x  011 x  3 X  6
X 0 111 x 111 x  7  X  7

3 30
9.3.2 Alternative forms

strongpoint : in-place computations


shortcoming : non-sequential access of data
Figure 9.14
3
9.4 Decimation-In-Frequency FFT
Algorithm
N1
The DFT equation X  k   x[n]W nk
N
n 0
Split the DFT equation into even and odd frequency indexes

N1 N / 2 1 N1
X  2r   x[n]WNn 2 r   x[n]WNn 2 r   x[n]WNn 2 r
n 0 n 0 n N / 2
N /2  1 N /2  1
Substitute   x[n]W n  N /2 2 r
variables n 0
n2r
N  
n 0
x[n  N / 2]WN
N /2  1
   x[n]  x[n  N / 2]W nr
N /2
n 0
N /2  1
  g (n)WNrn/2
n 0
3 32
9.4 Decimation-In-Frequency FFT
Algorithm N1
The DFT equation X  k   x[n]WNnk
n 0
N1 N /2  1 N1
X  2r  1  x[n]W n (2 r 1)
N   x[n]W n (2 r 1)
N   x[n]W n (2 r 1)
N
n 0 n 0 n N /2
N /2  1 N /2  1
n  N /2 (2 r 1)
  x[n]W n (2 r 1)
N   x[n  N / 2]WN
n 0 n 0
N /2  1
   x[n]  x[n  N / 2]W n (2 r 1)
N
n 0
N / 2 1 N /2  1
   x[n]  x[n  N / 2]W W n
N
rn
N /2
  h(n)WNnWNrn/2
n 0 n 0
N
n 2 r 1 2 rn n rn n (2 r 1)
W N W W W W
N N N /2 N W N
2
WNNrWNN /2  1
3 33
decimation-in-frequency decomposition of an N-point
DFT to N/2-point DFT

N /2  1 N /2  1
X  2r     x[n]  x[n  N / 2]WNnr/2  g (n)WNrn/2
n 0N /2  1 n 0 N /2  1
X  2r  1    x[n]  x[n  N / 2]WNnW
rn
N /2
  h(n)WNnWNrn/2
3 n 0 n 0 34
decimation-in-frequency decomposition of an 8-point
DFT to four 2-point DFT

N / 4 1 N /4  1
X  2* 2 s    [ g (n)  g (n  N / 4)]WNsn/4   p (n)WNsn/4
n 0 n 0
N / 4 1 N /4  1
X  2*(2 s  1)    [ g (n)  g (n  N / 4)]W W
2n
N
sn
N /4   q (n)WN2 nWNsn/4
3 n 0 n 0 35
2-point DFT

X v ( p)  X v 1 ( p)  X v 1 (q)

X v (q )  X v  1 ( p )  X v  1 (q )  W80 when N 8

3 36
N /2  1 N /2  1
X  2r     x[n]  x[n  N / 2] WNnr/2   g (n)WNrn/2
n 0 n 0

N /4  1 N /2  1
X  2* 2 s    g (n)WN2/2sn   g (n)WN2/2sn
n 0 n N /4
N /4  1 N /4  1
  g (n)WN2/2sn   g (n  N / 4)WN2/2s ( n  N /4)
n 0 n 0
N /4  1 N /4  1
  g (n)W sn
N /4   g (n  N / 4)W sn
N /4
n 0 n 0
N /4  1 N /4  1
  [ g (n)  g (n  N / 4)]W sn
N /4
  p (n)WNsn/4
n 0 n 0

3
N /2  1 N /2  1
X  2r     x[n]  x[n  N / 2] nr
WN /2   g (n)WNrn/2
n 0 n 0
N /2  1
X  2*(2 s  1)    g (n)WN(2/2s 1) n
n 0
N /4  1 N /2  1
  g (n)WN(2/2s 1) n   g (n)WN(2/2s 1) n
n 0 n N / 4
N /4  1 N /4  1
  g (n)WNsn/4WNn/2   g (n  N / 4)WN(2/2s 1)( n  N /4)
n 0 n 0
N /4  1 N /4  1
  g (n)WNsn/4WN2 n   g (n  N / 4)WNsn/4WN2 nWN(2/ 2s 1) N /4
n 0 n 0
N /4  1 N /4  1

  [ g (n)  g (n  N / 4)]W W 2n sn   q (n)WN2 nWNsn/4


N N /4
n 0 n 0

3
WN(2/2s 1) N /4 WNsN/2/2WNN/2/4  1
N /4  1
X  2* 2 s    p (n)WNsn/4
n 0

N /4  1
X  2* 2* 2t    p(n)W 2 tn
N /4
n 0
N /8  1 N /4  1
  p (n)W 2 tn
N /4   p (n)W 2 tn
N /4
n 0 n N / 8

N /8  1 N /8  1
  p (n)W 2 tn
N /4   p (n  N / 8)W 2 t ( n  N /8)
N /4
n 0 n 0

N /8  1
  [ p (n)  p (n  N / 8)]WNtn/8
n 0

 p (n)  p (n  1) when N 8
3
N /4  1
X  2* 2 s    p (n)WNsn/4
n 0
N /4  1
X  2* 2*(2t  1)    p( n)WN(2/4t 1) n
n 0
N /8  1 N /4  1
  p (n)WN(2/4t 1) n   p (n)WN(2/ 4t 1) n
n 0 n N / 8
N /8  1 N /8  1
  p (n)WN(2/4t 1) n   p (n  N / 8)WN(2/4t 1)( n  N /8)
n 0 n 0
N /8  1 N /8  1
  p (n)WN2/4
tn
WNn/4   p (n  N / 8)WN2/4
tn
WNn/4WN(2/4t 1) N /8
n 0 n 0
N /8  1
  [ p (n)  p (n  N / 8)]WNtn/8WN4 n
n 0 WN(2/4t 1) N /8 WNtN/4/4WNN/4/8  1
[ p (n)  p (n  1)]W80 when N 8
4
Final flow graph for 8-point DFT
decimation in frequency

4 41
9.4.1 In-Place Computation 同址运算

DIF
FFT

DIT FFT

4 42
9.4.1 In-Place Computation 同址运算

DIF
FFT

DIT FFT

4 43
9.4.2 Alternative forms
decimation-in-frequecy Butterfly Computation

decimation-in-time Butterfly Computation

4 44
The DIF FFT is the transpose of the DIT FFT

DIF
FFT

DIT FFT

4 45
9.4.2 Alternative forms

DIF
FFT

DIT FFT

4
9.4.2 Alternative forms

DIF
FFT

DIT FFT

4
Figure 9.24 erratum
x  0
x  4
x  2
x  6
x 1
x  5
x  3
x  7
4
9.4.2 Alternative forms

DIF
FFT

DIT FFT

4
Chapter 9 HW
9.1, 9.2, 9.3,

Zhongguo Liu_Biomedical Engineering_Shandon


50
5 返 回25/4/27 上一页 下一页 g Univ.

You might also like