chapter 9 computation of the discrete fourier transform
DESCRIPTION
Chapter 9 Computation of the Discrete Fourier Transform. Biomedical Signal processing. Zhongguo Liu Biomedical Engineering School of Control Science and Engineering, Shandong University. 1. Chapter 9 Computation of the Discrete Fourier Transform. 9.0 Introduction - PowerPoint PPT PresentationTRANSCRIPT
104/19/2023 1Zhongguo Liu_Biomedical Engineering_Shandong
Univ.
Chapter 9 Computation of the Discrete
Fourier TransformZhongguo Liu
Biomedical Engineering
School of Control Science and Engineering, Shandong University
Biomedical Signal processing
2
9.0 Introduction
9.1 Efficient Computation of Discrete Fourier Transform
9.2 The Goertzel Algorithm
9.3 decimation-in-time FFT Algorithms
9.4 decimation-in-frequency FFT Algorithms
9.5 practical considerations ( software realization)
Chapter 9 Computation of the Discrete Fourier Transform
3
9.0 Introduction
1. Compute the N-point DFT and of the two sequence and
kX1 kX 2
nx1 nx2
2. Compute for kXkXkX 213 10 Nk
3. Compute as the inverse DFT of kX 3
nxNnxnx 213
Implement a convolution of two sequences by the following procedure:
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.
4
9.1 Efficient Computation of Discrete Fourier Transform
The DFT pair was given as
4
1
0
2 /1[ ]
N
k
j N knx n X k
Ne
1
0
2 /[ ]
N
n
j N knX k x n e
DFTcomputational complexity: Each DFT coefficient requires
N complex multiplications; N-1 complex additions
All N DFT coefficients requireN2 complex multiplications; N(N-1) complex additions
5
9.1 Efficient Computation of Discrete Fourier Transform
5
Complexity in terms of real operations4N2 real multiplications2N(N-1) real additions (approximate 2N2)
1
0
2 /[ ]
N
n
j N knX k x n e
2 / ( ), ( )* j N k N k kN N N
n nN
ne W W W W
6
9.1 Efficient Computation of Discrete Fourier Transform
Most fast methods are based on Periodicity propertiesPeriodicity in n and k; Conjugate symmetry
6
2 / 2 / 2 / 2 /j N k N n j N kN j N k n j N kne e e e 2 / 2 / 2 / j N kn j N k n N j N k N ne e e
( ) ( ) nk k N N kN N N
n nW W W
( )( )* ( )* n nk N k kN N N
nW W W
( )( )* ( )* n nk N k kN N N
nW W W
Re ]
7
X[k] can be viewed as output of a filter to input x[n]
Impulse response of filter:
X[k] is the output of the filter at time n=N
9.2 The Goertzel Algorithm
Makes use of the periodicityMultiply DFT equation with this factor
7
2 / 2 1j N Nk j ke e
1
0
1
0
2 / 2 / 2 /[ ] [ ]
N N
r
k
r
j N kN j N r j N k N rX k x r x re e e
k n NX k y n
2 /[ ]
j N knh n u ne
2 /[ ]k
r
j N k n ry n x r u n re
Define
using x[n]=0 for n<0 and n>N-1,
8
9.2 The Goertzel AlgorithmGoertzel
Filter:
Computational complexity4N real multiplications; 4N real additionsSlightly less efficient than the direct method
2 /[ ] [ ] [ ]nk
N
j N knh n u n W u ne
1
1
1k kN
H zW z
[ ] [ 0,1 1,...] [ , ,],kk k Ny n y n W x n n N [ 1] 0ky
0,1,., ..,k n NkX k Ny n
nkNWBut it avoids computation and storage of
1
0
[ ]N
knN
n
X k x n W
9
Second Order Goertzel Filter
Goertzel Filter
9
2 2
1 1
2 21 21 1
1 12
1 2cos1 1
j k j kN N
kj k j kN N
e z e zH z
kz ze z e z N
Multiply both numerator and denominator
1
2
1
1k
j kN
H z
ze
2[ ] [ 2] 2cos [ 1] 0,1,...,[ ],
ky n y n y n x n n N
N
[ ] [ ] [ 1]kk Ny y WN yN N 0,1,, ...,Nk kX
10
Second Order Goertzel Filter
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 additionsComplexity for all DFT coefficients
Each pole is used for two DFT coefficients Approximately N2 real multiplications and 2N2 real
additions10
2[ ] [ 2] 2cos [ 0,1,...,1] [ ],
y n y n y n
N
kn nx N
[ ] [ ] [ 1] kk Ny y W yN N N 0,1,, ...,X kk N
2 ( )[ ] [ 2] 2 0,cos [ 1] [ ], 1,...,
y n y n y n x n
Nn
N kN
, X k X N k
11
Second Order Goertzel Filter
If do not need to evaluate all N DFT coefficientsGoertzel Algorithm is more efficient than FFT if less than M DFT coefficients are needed,M < log2N
11
2[ ] [ 2] 2cos [ 1] 0,1,...,[ ],
ky n y n y n x n n N
N
[ ] [ ] [ 1]kk Ny y WN yN N 0,1,, ...,Nk kX
12
9.3 decimation-in-time FFT Algorithms
Makes use of both periodicity and symmetryConsider special case of N an integer power of 2Separate x[n] into two sequence of length N/2
Even indexed samples in the first sequenceOdd indexed samples in the other sequence
12
1
0
n even n odd
2 /
2 / 2 /
[ ]
[ ] [ ]
N
n
j N kn
j N kn j N kn
X k x n
x n x n
e
e e
13
9.3 decimation-in-time FFT Algorithms
13
/2 1 /2 1
2 12
r 0 r 0
[2 ] [2 1]N N
r krkN NX k x r W x r W
Substitute variables n=2r for n even and n=2r+1 for odd
G[k] and H[k] are the N/2-point DFT’s of each subsequence
n even n odd
2 / 2 /[ ] [ ]
j N kn j N knX k x n x ne e
, kNG k W H k
/2 1 /2 1
/2 /2r 0 r 0
[2 ] [2 1]N N
rk k rkN N Nx r W W x r W
2
/2
2/2
22
N NN
jjNW We e
14
9.3 decimation-in-time FFT Algorithms
14
G[k] and H[k] are the N/2-point DFT’s of each subsequence
kNG k W H k
/2 1 /2 1
/2 /2r 0 r 0
[2 ] [2 1]N N
rk k rkN N NX k x r W W x r W
/2
22 2/2 rk
N
rrN N
j kj kWe e
2
NG k G k
2
NH k H k
10,1,...,
2
Nk
0,1,...,k N
15
8-point DFT using decimation-in-time
Figure 9.3
/2 1 /2 1
/2 /2r 0 r 0
[2 ] [2 1]N N
rk k rkN N NX k x r W W x r W
k
NG k W H k
16
computational complexityTwo N/2-point DFTs
2(N/2)2 complex multiplications2(N/2)2 complex additions
Combining the DFT outputsN complex multiplicationsN complex additions
Total complexityN2/2+N complex multiplicationsN2/2+N complex additionsMore efficient than direct DFT
16
17
9.3 decimation-in-time FFT Algorithms
Repeat same process , Divide N/2-point DFTs into Two N/4-point DFTsCombine outputs
17
N=8
18
9.3 decimation-in-time FFT Algorithms
After two steps of decimation in time
18
Repeat until we’re left with two-point DFT’s
19
9.3 decimation-in-time FFT Algorithms
flow graph for 8-point decimation in time
19
Complexity:Nlog2N complex multiplications and additions
N=2m
m=log2N
20
Butterfly Computation
Flow graph of basic butterfly computation
20
We can implement each butterfly with one multiplication
Final complexity for decimation-in-time FFT
(N/2)log2N complex multiplications and Nlog2N additions
21
Nlog2N complex multiplications and additions
9.3 decimation-in-time FFT Algorithms
Final flow graph for 8-point decimation in time
21
Complexity:
(Nlog2N)/2 complex multiplications and Nlog2N additions
N=2m
m=log2N
22
9.3.1 In-Place Computation同址运算Decimation-in-time flow graphs require two sets of registersInput and output for each stage
22
0
0
0
0
0
0
0
0
0 0
1 4
2 2
3 6
4 1
5 5
6 3
7 7
X x
X x
X x
X x
X x
X x
X x
X x
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
0
1
2
3
4
5
6
7
X
X
X
X
X
X
X
X
1
1
1
1
1
1
1
1
0
1
2
3
4
5
6
7
X
X
X
X
X
X
X
X
one set of registers
23
9.3.1 In-Place Computation同址运算
Note the arrangement of the input indicesBit reversed indexing (码位倒置)
23
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 000
1 001
2 010
3 0
0 000
4 100
2 010
6 110
1 001
5 101
3 011
7 111
11
4 100
5 101
6 110
7 111
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
0
1
2
3
4
5
6
7
X
X
X
X
X
X
X
X
24
Figure 9.13
normal order binary coding for position :
000
001
010
011
100
101
110
111
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
2 1 0x n n n
000
001
010
011
100
101
110
111
x
x
x
x
x
x
x
x
2 1 0n n n2 1 0n n n
25
Figure 9.13
cause of bit-reversed order binary coding for position :
000
001
010
011
100
101
110
111
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
2 1 0x n n n
000
100
010
110
001
101
011
111
x
x
x
x
x
x
x
x
2 1 0n n n 0 1 2n n n
26
9.3.2 Alternative forms
Note the arrangement of the input indicesBit reversed indexing (码位倒置)
26
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
0
1
2
3
4
5
6
7
X
X
X
X
X
X
X
X
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 000
1 001
2 010
3 0
0 000
4 100
2 010
6 110
1 001
5 101
3 011
7 111
11
4 100
5 101
6 110
7 111
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
X x X x
27
Figure 9.14
9.3.2 Alternative forms
strongpoint : in-place computationsshortcoming : non-sequential access of data
input in normal order and output in bit-reversed order
28
Figure 9.15
shortcoming : not in-place computation non-sequential access of data
Input, output same normal order
29
Figure 9.16
shortcoming : not in-place computation strongpoint: sequential access of data
Same structure, Input bit-reversed order , output normal order
30
9.4 Decimation-In-Frequency FFT Algorithm
The DFT equation
30
1
0
[ ]N
nkN
n
X k x n W
1
/2
1 /2 2 2
2 1
0 0
[ ] [ ] [ ]2
r rN N
n n nN N N
N
nn n N
rX x n W x n W x n Wr
/2 1
/20
[ ] [ / 2]N
nrN
n
x n x n N W
Split the DFT equation into even and odd frequency indexes
Substitute variables
/2 1
0
/2 12
0
2 2/[ ] [ / 2]
N
rn rN N
n
NN
n
nx n xW N Wn
/2 1
0/2( )
Nrn
nNg n W
/ 2 n Nn n
31
9.4 Decimation-In-Frequency FFT Algorithm
The DFT equation
31
1
0
[ ]N
nkN
n
X k x n W
2 1 21 /2 1 1
( ) ( )1 2( )
0 0
1
/2
[ ] [ ] [2 ]1 r rN N N
n n nN N N
n n
r
n N
X x n W x n W x n Wr
/2 1
(2 1)
0
[ ] [ / 2]N
n rN
n
x n x n N W
/2 1 /2 1
(2 1)(2 1) /2
0 0
2[ /[ ] ]N N
rn rN N
n n
n Nx n W x n WN
(2 1) /22 1N
r Nr NN N NW W W
2
/22 1n r rn n rn n
N NN N NW W W W W
/2 1
0/2[ ] [ / 2] n
Nrn
Nn
Nx n x n N W W
/2
/2 1
0
( )N
rnN N
n
n
Wh n W
/ 2 n Nn n
32
decimation-in-frequency decomposition of an N-point DFT to N/2-point DFT
32
/2 1
0/22 [ ] [ / 2]
N
n
nrNr x n x n NX W
/2 1
0/22 1 [ ] [ / 2]
Nrn
nN
nNr x n x n N WX W
/2
/2 1
0
( )N
rnN N
n
n
Wh n W
/2 1
0/2( )
NrnN
n
Wg n
33
/4
/4 12
0
( )N
n sN N
n
n
q n W W
/
2
0/4
4 1
2*(2 1) [ ( ) ( / 4)] N N
Nn sn
n
X s g n g n N W W
decimation-in-frequency decomposition of an 8-point DFT to four 2-point DFT
33
/4 1
0/4( )
Nsn
nNp n W
/
0/4
4 1
2*2 [ ( ) ( / 4)]N
sn
nNX s g n g n N W
34
2-point DFT
34
081 1( ) ( ) ( )v v vX q X p X q W 8when N
1 1( ) ( ) ( )v v vX p X p X q
35
/2 1
0/22 [ ] [ / 2]
N
n
nrNX r x n x n N W
/2 1
0/2( )
Nrn
nNg n W
/4 1 /2 1
2 2
0 /4
/4 1 /4 12 2 ( /4)
0 0
/4 1 /4
/2 /2
/2 /2
/4 /4
/
1
0 0
04
/4 1
2*2 ( ) ( )
( ) ( / 4)
( ) ( / 4)
[ ( ) ( / 4)]
N Nsn sn
n n N
N Nsn s n N
n n
N Nsn sn
N N
N N
N N
N
n n
Nsn
n
X s g n W g n W
g n W g n N W
g n W g n N W
g n g n N W
/4 1
0/4( )
Nsn
nNp n W
36
/2 1
0/22 [ ] [ / 2]
N
n
nrNX r x n x n N W
/2 1
0/2( )
Nrn
nNg n W
/2 1
(2 1)
0
/4 1 /2 1(2 1)
/2
/2 /2
/4 /2
(2 1)
0 /
/2
/4 /4 /
4
/4 1 /4 1(2 1)( /4)
0 0
/4 12 2 (2 1)
02
2*(2 1) ( )
( ) ( )
( ) ( / 4)
( ) ( / 4)
Ns n
n
N Ns n s n
n n N
N
N
N N
N N N
N N N N
Nsn n s n N
n n
Nsn n s
Nn n s N
n
X s g n W
g n W g n W
g n W W g n N W
g n W W g n N W W W
/4 1
/4
0
/4 12
0/4[ ( ) ( / 4)] N N
N
n
Nn sn
n
g n g n N W W
/2 /2
(2 1) /4 /2 /4/2 1s N sN N
N N NW W W
/4
/4 12
0
( )N
n sN N
n
n
q n W W
37
/4
/4 1
0
2*2 ( )N
sn
nNX s p n W
/4
/4
/4 12
0
/8 1 /4 1
/2
/4
2
0 8
2*2*2 ( )
( ) ( )
Ntn
n
N Nt
N
n tn
n n NN N
X t p n W
p n W p n W
/8 1 /8 1
2 2 ( /8)
04
0/4 /( ) ( / 8)
N Ntn t n N
Nn n
Np n W p n N W
/8 1
0/8[ ( ) ( / 8)]
Ntn
nNp n p n N W
( ) ( 1)p n p n 8when N
38
/4
/4 1
0
2*2 ( )N
sn
nNX s p n W
/4
/4
/4 1(2 1)
0
/8 1 /4 1(2 1) (2 1)
04
//
8
2*2*(2 1) ( )
( ) ( )
Nt n
n
N Nt n t n
N
Nn n N
N
X t p n W
p n W p n W
/8 1 /8 1
(2 1) (2 1)( /8)
0 0/4 /4( ) ( / 8)
N Nt n t n N
nN
nNp n W p n N W
/8 1
0
4/8[ ( ) ( / 8)] N
Ntn n
Nn
p n p n N W W
0
8[ ( ) ( 1)]p n p n W 8when N
/8 1 /8 12 2 (2
/4 /4 /4 /4 /41) /8
0 0
( ) ( / 8)N N
tn nN N N
tn n t N
n nN Np n W W p n N W W W
/4 /4(2 1) /8 /4 /8
/4 1t N tN NN N NW W W
39
Final flow graph for 8-point DFT decimation in frequency
39
N=8
4-point DFT 2-point DFT
40
9.4.1 In-Place Computation同址运算
40
DIF FFT
DIT FFT
41
9.4.1 In-Place Computation同址运算
41
DIF FFT
DIT FFT
transpose
42
9.4.2 Alternative forms
42
decimation-in-time Butterfly Computation
decimation-in-frequecy Butterfly Computation
transpose
43
The DIF FFT is the transpose of the DIT FFT
43
DIF FFT
DIT FFT
transpose
44
9.4.2 Alternative forms
DIF FFT
DIT FFT
transpose
45
9.4.2 Alternative forms
DIF FFT
DIT FFT
transpose
46
Figure 9.24 erratum
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
47
9.4.2 Alternative forms
DIF FFT
DIT FFT
transpose
48 04/19/202348Zhongguo Liu_Biomedical
Engineering_Shandong Univ.
Chapter 8 HW9.1, 9.2, 9.3,
上一页 下一页返 回