Upload
mikeproud
View
288
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
123/4/10 1Zhongguo Liu_Biomedical Engineering_Shandong U
niv.
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
Baseline for computational 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
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
Re ]
7
X[k] can be viewed as the output of a filter to the 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:
8
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 [ 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
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
16
computational complexityTwo 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
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
20
Butterfly Computation
Flow graph constitutes of butterflies
20
We can implement each butterfly with one multiplication
Final complexity for decimation-in-time FFT(N/2)log2N complex multiplications and additions
21
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
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
2
2
2
2
2
2
2
2
0
1
2
3
4
5
6
7
X
X
X
X
X
X
X
X
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 0 000 000
1 4 001 100
2 2 010 010
3 6 011 110
4 1 100 001
5 5 101 101
6 3 110 011
7 7 111 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
cause of bit-reversed order
binary coding for position :000
001
010
011
100
101
110
111
MN 2
must padding 0 to
25
9.3.2 Alternative forms
Note the arrangement of the input indicesBit reversed indexing(码位倒置)
25
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0 000 000
1 4 001 100
2 2 010 010
3 6 011 110
4 1 100 001
5 5 101 101
6 3 110 011
7 7 111 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
26
Figure 9.14
9.3.2 Alternative forms
strongpoint : in-place computations
shortcoming : non-sequential access of data
27
Figure 9.15
shortcoming : not in-place computation
non-sequential access of data
28
Figure 9.16
shortcoming : not in-place computation
strongpoint: sequential access of data
29
9.3 decimation-in-time FFT Algorithms
29
/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
Review
30
9.3.1 In-Place Computation同址运算Bit reversed indexing(码位倒置)
30
0
0
0
0
0
0
0
0
000 000
001 100
010 010
011 110
100 001
101 101
110 011
111 111
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
31
Figure 9.14
9.3.2 Alternative forms
strongpoint : in-place computations
shortcoming : non-sequential access of data
32
9.4 Decimation-In-Frequency FFT Algorithm
The DFT equation
32
1
0
[ ]N
nkN
n
X k x n W
1 / 2 1 1
2 2 2
0 0 / 2
2 [ ] [ ] [ ]N N N
n r n r n rN N N
n n n N
X r x n W x n W x n W
/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 /2 1
/2 22
0 0
[ ] [ / 2]N N
n N rn rN N
n n
x n W x n N W
/2 1
0/2( )
Nrn
nNg n W
33
9.4 Decimation-In-Frequency FFT Algorithm
The DFT equation
33
1
0
[ ]N
nkN
n
X k x n W
1 /2 1 1
(2 1) (2 1) (2 1)
0 0 /2
2 1 [ ] [ ] [ ]N N N
n r n r n rN N N
n n n N
X r x n W x n W x n W
/2 1
(2 1)
0
[ ] [ / 2]N
n rN
n
x n x n N W
/2 1 /2 1
/2 (2 1)(2 1)
0 0
[ ] [ / 2]N N
n N rn rN N
n n
x n W x n N W
(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
2 1
0/[ ] [ / 2]
Nn rnN
nNx n x n N W W
/2
/2 1
0
( )N
n rN N
n
n
h n W W
34
decimation-in-frequency decomposition of an N-point DFT to N/2-point DFT
34
/2 1
0/22 [ ] [ / 2]
N
n
nrNX r x n x n N W
/2 1
0/22 1 [ ] [ / 2]
Nn rnN
nNX r x n x n N W W
/2
/2 1
0
( )N
n rN N
n
n
h n W W
/2 1
0/2( )
Nrn
nNg n W
35
/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
35
/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
36
2-point DFT
36
081 1( ) ( ) ( )v v vX q X p X q W 8when N
1 1( ) ( ) ( )v v vX p X p X q
37
/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
38
/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
39
/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
40
/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
41
Final flow graph for 8-point DFT decimation in frequency
41
42
9.4.1 In-Place Computation同址运算
42
DIF FFT
DIT FFT
43
9.4.1 In-Place Computation同址运算
43
DIF FFT
DIT FFT
44
9.4.2 Alternative forms
44
decimation-in-time Butterfly Computation
decimation-in-frequecy Butterfly Computation
45
The DIF FFT is the transpose of the DIT FFT
45
DIF FFT
DIT FFT
46
9.4.2 Alternative forms
DIF FFT
DIT FFT
47
9.4.2 Alternative forms
DIF FFT
DIT FFT
48
Figure 9.24 erratum
0
4
2
6
1
5
3
7
x
x
x
x
x
x
x
x
49
9.4.2 Alternative forms
DIF FFT
DIT FFT
50
23/4/1050Zhongguo Liu_Biomedical Engineering_Shandong U
niv.
Chapter 9 HW9.1, 9.2, 9.3,
上一页 下一页返 回