B. Fast Algorithms for Discrete Fourier Transform of Signal Processing/B. Fast Algorithms...
Transcript of B. Fast Algorithms for Discrete Fourier Transform of Signal Processing/B. Fast Algorithms...
B. Fast Algorithms for Discrete Fourier
Transform
B.1. Introduction (9.0, 9.1)
B.2. Radix-2 Decimation-in-Time FFT (9.3, 9.5)
B.3. Radix-2 Decimation-in-Frequency FFT (9.4, 9.5)
B.4. FFT for a More General N (9.5)
B.5. FFT for a Real Sequence
B.6. Inverse Fast Fourier Transform (9.1)
B.1. Introduction
The discrete Fourier transform (DFT) can be computed by a class
of fast algorithms called the fast Fourier transform (FFT). The basic
principle of the FFT is to decompose the DFT into shorter DFTs and
butterfly operations, which are computationally more efficient. The
FFT algorithms apply when the length of the sequence is a composite
integer initially or after zero padding.
B.2. Radix-2 Decimation-in-Time FFT
B.2.1. Principle
Let us assume that x(n) is a finite-length sequence over 0nN1,
where N=2m (m2) initially or after zero-padding. The DFT of x(n) is
defined as
1.Nk0 ,knN
2jexp)n(x)k(X
1N
0n
(B.1)
x(n) is separated into two sequences. One consists of even-numbered
samples, and the other consists of odd-numbered samples. Thus,
.1Nk0
,kr2/N
2jexp)1r2(xk
N
2jexp
kr2/N
2jexp)r2(x)k(X
12/N
0r
12/N
0r
(B.2)
X(k) is halved. The first half is
.12/Nk0
,kr2/N
2jexp)1r2(xk
N
2jexp
kr2/N
2jexp)r2(x)k(X
12/N
0r
12/N
0r
(B.3)
1.N/2k0
,kr2/N
2jexp)1r2(xk
N
2jexp
kr2/N
2jexp)r2(x)2/Nk(X
12/N
0r
12/N
0r
(B.5)
The second half is
,1NkN/2
,kr2/N
2jexp)1r2(xk
N
2jexp
kr2/N
2jexp)r2(x)k(X
12/N
0r
12/N
0r
(B.4)
which is also written as
The radix-2 decimation-in-time FFT is based on (B.3) and (B.5).
According to (B.3) and (B.5), the DFT can be computed using the
following algorithm (figure B.1): (1) Compute the DFT of x(2r) and
the DFT of x(2r+1), where 0rN/21. (2) Multiply the second DFT
by exp(j2k/N), where 0kN/21. (3) Find the DFT of x(n).
The above decomposition is continued until each DFT has only 1
point. The 1-point DFTs contain no operation and do not have to be
carried out.
The number of complex multiplications required in this algorithm
is N(log2N)/2. This number is less than N2, the number of complex
multiplications required in the direct DFT. The following table gives
a few typical cases.
N 512 1024 2048
N2 262144 1048576 4194304
N(log2N)/2 2304 5120 11264
DFT
(N/2)
Figure B.1. Radix-2 Decimation-in-Time FFT.
…
x(0)
x(2)
x(N2)
…
DFT
(N/2)…
exp[j2(N/21)/N]
exp[j20/N]
exp[j21/N]
x(1)
x(3)
x(N1)
…
X(0)
X(1)
X(N/21)
X(N/2)
X(N/2+1)
X(N1)
…
…
B.2.2. Several Details
This algorithm consists of two steps: the sequence reordering and
the butterfly operations.
The time-domain sequence is reordered in a bit-reversed way. The
sample at position bm1bm2…b0 (binary index) is transferred to
position b0b1…bm1 (binary index). The above table gives the case of
N=8.
x(n) x(0) x(1) x(2) x(3) x(4) x(5) x(6) x(7)
Old
Position
000
0
001
1
010
2
011
3
100
4
101
5
110
6
111
7
New
Position
000
0
100
4
010
2
110
6
001
1
101
5
011
3
111
7
The butterfly operations are implemented using three nested loops
or recursively. They are done in place. That is, in each stage of the
computation, the output sequence and the input sequence can use the
same memory space.
A few variations of this algorithm can be obtained by changing the
scheme of reordering.
B.3. Radix-2 Decimation-in-Frequency FFT
B.3.1. Principle
Let us assume that x(n) is a finite-length sequence over 0nN1,
where N=2m (m2) initially or after zero-padding. The DFT of x(n) is
defined as
1.Nk0 ,knN
2jexp)n(x)k(X
1N
0n
(B.6)
X(k) is separated into two sequences. One consists of even-numbered
1,N/2r0 ,rn2/N
2jexp)n(x)r2(X
1N
0n
(B.7)
1./2Nr0
,rn2/N
2jexpn
N
2jexp)n(x)1r2(X
1N
0n
(B.8)
x(n) is halved. (B.7) becomes
1,N/2r0 ,rn2/N
2jexp)n(x
rn2/N
2jexp)n(x)r2(X
1N
2/Nn
12/N
0n
(B.9)
and
samples, and the other consists of odd-numbered samples. Thus,
which is also written as
1N/2r0 ,rn2/N
2jexp)2/Nn(x
rn2/N
2jexp)n(x)r2(X
12/N
0n
12/N
0n
(B.10)
and further
1.N/2r0
,rn2/N
2jexp)2/Nn(x)n(x)r2(X
12/N
0n
(B.11)
(B.8) becomes
1,N/2r0 ,rn2/N
2jexpn
N
2jexp)n(x
rn2/N
2jexpn
N
2jexp)n(x)1r2(X
1N
2/Nn
12/N
0n
(B.12)
which is also written as
1N/2r0
,rn2/N
2jexpn
N
2jexp)2/Nn(x
rn2/N
2jexpn
N
2jexp)n(x)1r2(X
12/N
0n
12/N
0n
(B.13)
and further
(B.14)
The radix-2 decimation-in-frequency FFT is developed according to
(B.11) and (B.14).
1.N/2r0 ,rn2/N
2jexp
nN
2jexp)2/Nn(x)n(x)1r2(X
12/N
0n
According to (B.11) and (B.14), the DFT can be computed using
the following algorithm (figure B.2): (1) Find sequences
x(n)+x(n+N/2) and [x(n)x(n+N/2)]exp(j2n/N), where 0nN/21.
(2) Find the DFTs of the two sequences.
The above decomposition is continued until each DFT has only 1
point. The 1-point DFTs contain no operation and do not have to be
carried out.
The number of complex multiplications required in this algorithm
is N(log2N)/2. This number is less than N2, the number of complex
multiplications required in the direct DFT. The following table gives
a few typical cases.
N 512 1024 2048
N2 262144 1048576 4194304
N(log2N)/2 2304 5120 11264
Figure B.2. Radix-2 Decimation-in-Frequency FFT.
x(0)
x(1)
x(N/21)
x(N/2)
x(N/2+1)
x(N1)
…
…
…
…
exp[j2(N/21)/N]
exp[j20/N]
exp[j21/N]
DFT
(N/2)
DFT
(N/2)
…
X(0)
X(2)
X(N2)
…
X(1)
X(3)
X(N1)
B.3.2. Several Details
This algorithm consists of two steps: the butterfly operations and
the sequence reordering.
The butterfly operations are implemented using three nested loops
or recursively. They are done in place. That is, in each stage of the
computation, the output sequence and the input sequence can use the
same memory space.
X(k) X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7)
Old
Position
000
0
100
4
010
2
110
6
001
1
101
5
011
3
111
7
New
Position
000
0
001
1
010
2
011
3
100
4
101
5
110
6
111
7
The frequency-domain sequence is reordered in the following bit-
reversed way. The sample at position bm1bm2…b0 (binary index) is
transferred to position b0b1…bm1 (binary index). The case of N=8 is
shown in the above table.
A few variations of this algorithm can be obtained by changing the
scheme of reordering.
B.4. FFT for a More General N
When the length of the sequence is a composite integer initially or
after zero padding, the FFT applies.
Assume that x(n) is a finite-length sequence over 0nN1. Here,
N=N1N2 (N1 and N2 are two positive integers not equal to 1) initially
or after zero-padding. The DFT of x(n) is defined as
1.Nk0 ,knN
2jexp)n(x)k(X
1N
0n
(B.15)
Letting n=n1N2+n2 (0n1N11, 0n2N21), we obtain
.1Nk0 ,)nNn(kN
2jexp
)nNn(x)k(X
221
1N
0n
1N
0n
221
1
1
2
2
(B.16)
Letting k=k2N1+k1 (0k1N11, 0k2N21), we obtain
.1Nk0 ,1Nk0
,)nNn)(kNk(N
2jexp
)nNn(x)kNk(X
2211
221112
1N
0n
1N
0n
221112
1
1
2
2
(B.17)
(B.17) is further written as
.1Nk0 ,1Nk0
,nkN
2jexpnk
N
2jexpnk
N
2jexp
)nNn(x)kNk(X
2211
2111
1
22
2
1N
0n
1N
0n
221112
1
1
2
2
(B.18)
Changing the order of the summations, we obtain
.1Nk0 ,1Nk0
,nkN
2jexpnk
N
2jexp
nkN
2jexp)nNn(x)kNk(X
2211
22
2
21
1N
0n
1N
0n
11
1
221112
2
2
1
1
(B.19)
According to (B.19), the DFT is computed as follows (figure B.3):
Figure B.3. FFT for a More General N.
x(0) x(1) … x(N21)
x(N2) x(N2+1) … x(N2+N21)
…
x[(N11)N2] x[(N11)N2+1] … x[(N11)N2+N21]
n2
n1
(1) Convert x(n) into x(n1N2+n2).
(2) For each n2, compute the DFT of x(n1N2+n2) with respect to n1
to obtain p(k1,n2).
(3) Multiply p(k1,n2) by exp(j2k1n2/N) to obtain q(k1,n2).
(4) For each k1, compute the DFT of q(k1,n2) with respect to n2 to
obtain X(k2N1+k1).
(5) Convert X(k2N1+k1) into X(k).
The number of complex multiplications required in this algorithm
is N(N1+N2+1). This number is less than N2, the number of complex
multiplications required in the direct DFT.
The above decomposition can be continued, and the computation
can be further reduced until each DFT has a prime number of points.
B.5. FFT for a Real Sequence
Let x(n) be a real finite-length sequence over 0nN1, where N
is an even number larger than 2 initially or after zero-padding.
Let
y(r)=xe(r)+jxo(r), 0rN/21, (B.20)
where
xe(r)=x(2r), 0rN/21, (B.21)
and
xo(r)=x(2r+1), 0rN/21. (B.22)
Then
y*(r)=xe(r)jxo(r), 0rN/21. (B.23)
From (B.20) and (B.23), we obtain
xe(r)=[y(r)+y*(r)]/2, 0rN/21 (B.24)
and
xo(r)=[y(r)y*(r)]/(2j), 0rN/21. (B.25)
Taking the DFT of (B.24) and (B.25), we obtain
Xe(k)=[Y(k)+Y(k)*]/2, 0kN/21 (B.26)
and
Xo(k)=[Y(k)Y(k)*]/(2j), 0kN/21, (B.27)
where Y(k) is Y(k) extended with period N/2. X(k) can be written in
terms of Xe(k) and Xo(k) according to (B.3) and (B.5), i.e.,
,12/Nk0 ),k(XkN
2jexp)k(X)k(X oe
(B.28)
and
.12/Nk0 ),k(XkN
2jexp)k(X)2/Nk(X oe
(B.29)
Based on the above analysis, the DFT of x(n) can be computed by
the following algorithm: (1) Find y(r) from (B.20). (2) Find Y(k), the
the DFT of y(r). (3) Find Xe(k) and Xo(k) from (B.26) and (B.27). (4)
Find the DFT of x(n) from (B.28) and (B.29). In this algorithm, only
an N/2-point DFT and some auxiliary operations are required.
B.6. Inverse Fast Fourier Transform
The inverse discrete Fourier transform (IDFT) can be computed by
a class of fast algorithms called the inverse fast Fourier transform
(IFFT).
The DFT and the IDFT are given as follows:
(B.31)1.Nn0 ,knN
2jexp)k(X
N
1)n(x
1,Nk0 ,knN
2jexp)n(x)k(X
1N
0k
1N
0n
(B.30)
According to (B.30) and (B.31), the algorithms for the DFT can be
used to compute the IDFT if the relevant signs are changed and the
factor 1/N is incorporated.
x(n) can be written as
1.Nn0 ,knN
2jexp)k(X
N
1)n(x
*1N
0k
*
(B.32)
According to (B.32), the IDFT can be computed using the following
algorithm: (1) Determine X*(k)/N. (2) Compute the DFT of X*(k)/N.
(3) Conjugate the DFT of X*(k)/N.
x(n) can be written as
1.Nn0 ,knN
2jexp)k(X
N
1)n(x
1N
0k
(B.33)
Here, X(k) is X(k) extended with period N. According to (B.33), the
IDFT can be computed using the following algorithm: (1) Determine
X(k)/N, 0kN1. (2) Compute the DFT of X(k)/N, 0kN1.