Beruflich Dokumente
Kultur Dokumente
Goertzel’s Algorithm
Goertzel’s Algorithm
• Since a complex multiplication can be
• Structural interpretation of the algorithm - implemented with 4 real multiplications and
x e [n] yk [n]
2 real additions, computation of each new
x e [N] = 0 _ y k [ _1] = 0 value of yk [n] requires 4 real
z1
_k
multiplications and 4 real additions
WN
• Thus computation of X [k ] = yk [ N ] involves
• Thus a recursive DFT computation scheme 4N real multiplications and 4N real
is additions
yk [n] = xe [n] + WN− k yk [n − 1], 0 ≤ n ≤ N Computation of all N DFT samples
requires 4N 2 real multiplications and 4N 2
with yk [ −1] = 0 and xe [ N ] = 0 real additions
5 Copyright © 2010, S. K. Mitra 6 Copyright © 2010, S. K. Mitra
1
Goertzel’s Algorithm Goertzel’s Algorithm
• Recall, direct computation of all N samples of • Algorithm can be made computationally
2
{X[k]} requires N complex multiplications more efficient by observing that H k (z ) can
and N ( N − 1) complex additions be rewritten as
• Equivalently, direct computation of all N 1 1 − WNk z −1
H k ( z) = =
samples of {X[k]} requires 4N 2 real 1 − WN− k z −1 (1 − WN− k z −1 )(1 − WNk z −1 )
multiplications and N (4 N − 2) real additions
1 − WNk z −1
• Thus, Goertzel’s algorithm requires 2N more =
1 − 2 cos(2π k / N ) z −1 + z − 2
real additions than the direct DFT
computation resulting in a second-order realization
real additions
z
_1
_ Wk
N • Complex multiplication by WNk needs to
_1
be performed only once at n = N
• DFT computation equations are now • Thus, computation of one sample of X[k]
requires (2 N + 4) real multiplications and
vk [n] = xe [n] + 2 cos( 2π k / N ) vk [n − 1] (4 N + 4) real additions
− vk [ n − 2], 0 ≤ n ≤ N • Computation of all N DFT samples requires
X [k ] = yk [ N ] = vk [ N ] − WNk vk [ N − 1] 2 N ( N + 2) real multiplications and
4 N ( N + 1) real additions
9 Copyright © 2010, S. K. Mitra 10 Copyright © 2010, S. K. Mitra
2
Decimation-in-Time FFT Decimation-in-Time FFT
Algorithm Algorithm
• Consider a sequence x[n] of length N = 2μ
• Evaluating on the unit circle at N equally
• Using a 2-band polyphase decomposition spaced points z = WN− k , 0 ≤ k ≤ N − 1, we
we can express its z-transform as arrive at the N-point DFT of x[n]:
X ( z ) = X 0 ( z 2 ) + z −1 X1( z 2 ) X [k ] = X 0 [〈 k 〉 N / 2 ] + WNk X1[〈 k 〉 N / 2 ],
where 0 ≤ k ≤ N −1
( N / 2) −1 ( N / 2) −1
X 0 ( z) = ∑ x0[n] z − n = ∑ x[2n]z −n where X 0 [ k ] and X1[k ] are the (N/2)-point
n =0 n =0
( N / 2) −1 ( N / 2) −1 DFTs of the (N/2)-length sequences x0[n]
−n
X1 ( z ) = ∑ x1[n] z = ∑ x[2n + 1] z − n and x1[n]
13 n =0 n =0 14
Copyright © 2010, S. K. Mitra Copyright © 2010, S. K. Mitra
( N / 2) −1
= ∑ x[2r + 1]WNrk/ 2 , 0 ≤ k ≤ N2 − 1
x[n+1]
x[n] z 2 x 1[n] = x[2n+1]
r =0
15 Copyright © 2010, S. K. Mitra 16 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
• Flow-graph representation
• Block-diagram interpretation of the DFT X 0[0]
x[0]
computation is shown below x[2]
X [1]
N - point 0
WN
0
X[0]
X[1]
2 1
DFT X 0[2]
WN
x0 [ n ] N − point X 0 [〈 k 〉 N / 2 ] x[4] X[2]
+
2
X 0[3] WN
x[n ] 2 2 X [k ] x[6] X[3]
WNk
DFT X1[0] WN
3
z WNk x[1] 4
WN
X[4]
x[3] N - point X1[1]
X[5]
x1[ n ] N − point X 1[ 〈 k 〉 N / 2 ] 2 5
X1[2] WN
x[5] DFT
2 2
X1[3]
6
WN
X[6]
DFT x[7] X[7]
7
WN
3
Decimation-in-Time FFT Decimation-in-Time FFT
Algorithm Algorithm
• Direct computation of the N-point DFT • For N ≥ 3, ( N 2 / 2) + N < N 2
requires N 2 complex multiplications and • Continuing the process we can express X 0[k ]
N 2 − N ≈ N 2 complex additions and X1[k ] as a weighted combination of
• Computation of the N-point DFT using the two (N/4)-point DFTs
modified scheme requires the computation of • For example, we can write
two (N/2)-point DFTs that are then combined X 0 [k ] = X 00[〈 k 〉 N / 4 ] + WNk / 2 X 01[〈 k 〉 N / 4 ],
with N complex multiplications and N 0 ≤ k ≤ ( N / 2) − 1
complex additions resulting in a total of where X 00 [k ] and X 01[k ] are the (N/4)-
( N 2 / 2) + N complex multiplications and point DFTs of the (N/4)-length sequences
approximately ( N 2 / 2) + N complex additions x00[n] = x0[ 2n] and x01[n] = x0 [2n + 1]
19 Copyright © 2010, S. K. Mitra 20 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
• Block-diagram representation of the two-
• Likewise, we can express stage algorithm X [〈 k 〉 ]
X1[ k ] = X 10 [〈 k 〉 N / 4 ] + WNk / 2 X 11[〈 k 〉 N / 4 ], x0 [ n ] x00 [ n ] N − point X 00 [ 〈 k 〉 N / 4 ]
0 N /2
x[n ] 2 2 4 + + X [k ]
0 ≤ k ≤ ( N / 2) − 1 z
W Nk
DFT
W Nk/ 2
where X10[k ] and X11[k ] are the (N/4)- x01 [ n ] N − point X 01 [ 〈 k 〉 N / 4 ] W Nk
2 4
DFT
point DFTs of the (N/4)-length sequences z X 1[〈 k 〉 N / 2 ]
x10[n] = x1[ 2n] and x11[n] = x1[ 2n + 1] 2
x1 [ n ] x10 [ n ] N − point
4
X 10 [ 〈 k 〉 N / 4 ]
+
2 W Nk
DFT
z W Nk / 2
x11 [ n ] N
− point X 11 [ 〈 k 〉 N / 4 ]
2 4
DFT
21 Copyright © 2010, S. K. Mitra 22 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
• In the flow-graph shown N =8
• Flow-graph representation
• Hence, the (N/4)-point DFT here is a 2-
X 00[0]
x[0] N _ point
4 X 00[1]
0
WN WN
0
X[0] point DFT and no further decomposition is
x[4] DFT
X[1]
x[2]
X 01[0]
2
WN 1
WN possible
N _ point 4 X[2]
WN 2
x[6]
4
DFT X 01[1]
6
WN
WN
WN
3
X[3] • The four 2-point DFTs, X ij [k ], i, j = 0,1
X10[0]
x[1] N _ point
4
DFT
X10[1]
0
WN WN
4 X[4]
can be easily computed
x[5] X[5]
2 5
x[3] N _ point
X11[0]
4
WN
WN WN
WN
6
X[6] • For example
4
X 00[k ] = x[0] + W2k x[4], k = 0,1
X11[1]
x[7] DFT X[7]
6 7
WN WN
4
Decimation-in-Time FFT Decimation-in-Time FFT
Algorithm Algorithm
• Complete flow-graph of the 8-point DFT is
• Corresponding flow-graph of the 2-point shown below
DFT is shown below obtained using the x[0] X[0]
identity W2k = WN( N / 2) k x[4]
0
WN WN
0
WN
0
X[1]
4 2 1
WN WN WN
x[2] 4 X[2]
0 WN 2
x[0] WN WN
X00[0] x[6]
4 6 3
X[3]
0 0 WN
W 2 = WN = 1 WN WN
x[1] X[4]
0 0 4
x[4] WN WN WN
X 00[1]
1 N/2
x[5] X[5]
5
W2 = WN = _1 4
WN
2
WN WN
x[3] 4 X[6]
0 6
WN WN WN
x[7] X[7]
4 6 7
WN WN WN
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
• Total number of complex multiplications
• The flow-graph consists of 3 stages and additions to compute all 8 DFT samples
• First stage computes the four 2-point DFTs is equal to 8 + 8 + 8 = 24 = 8× 3
• Second stage computes the two 4-point DFTs • In the general case when N = 2 μ , number of
• Last stage computes the desired 8-point DFT stages for the computation of the ( 2 μ )-point
• The number of complex multiplications and DFT in the fast algorithm will be μ = log 2 N
additions at each stage is equal to 8, the size • Total number of complex multiplications
of the DFT and additions to compute all N DFT
samples is N (log 2 N )
27 Copyright © 2010, S. K. Mitra 28 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm • Examination of the flow-graph
x[0] X[0]
• In developing the count, multiplications x[4]
0
WN WN
0
WN
0
X[1]
with WN0 = 1 and WNN / 2 = −1 have been
4 2 1
WN WN WN
x[2] 4 X[2]
0 WN 2
WN WN
assumed to be complex x[6]
x[1]
4
WN
6
WN WN
3
X[3]
0 4 X[4]
0 WN
WN
• Also the symmetry property of x[5]
4
WN
WN
WN
2 5
WN
X[5]
5
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
• In the basic module two output variables are
generated by a weighted combination of • Input-output relations of the basic module
two input variables as indicated below are:
Ψr +1[α ] = Ψr [α ] + WNl Ψr [ β ]
where r = 1,2,K, μ and α, β = 0,1,K, N − 1
Ψr +1[ β ] = Ψr [α ] + WNl + ( N / 2) Ψr [ β ]
ψr [α] ψr+1[α]
WN
• Substituting WNl +( N / 2) = −WNl in the second
ψr [β] ψr+1[β]
WN +(N/2)
equation given above we get
• Basic computational module is called a Ψr +1[ β ] = Ψr [α ] − WNl Ψr [ β ]
31
butterfly computation 32
Copyright © 2010, S. K. Mitra Copyright © 2010, S. K. Mitra
x[4] _1 X[1]
Ψr [α] Ψr+1[α] 0
WN
x[2] _1 X[2]
0
WN
x[6] _1 _1 X[3]
Ψr [β] _1 Ψr+1[β] 0
WN
2
WN
WN x[1]
0 _ 1 X[4]
WN
x[5] _1 _ 1 X[5]
0 1
WN
• Use of the above modified butterfly x[3]
WN
0 _1 2 _ 1 X[6]
WN WN
computation module reduces the total x[7]
0
WN
_1 2
WN
_1 3
WN _ 1 X[7]
number of complex multiplications by 50%
33 Copyright © 2010, S. K. Mitra 34 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
• Computational complexity can be reduced
Algorithm
further by avoiding multiplications by WN0 = 1, • At the end of computation at any stage,
WNN / 2 = −1 , WNN / 4 = j , and WN3 N / 4 = − j output variables Ψr +1[m] can be stored in the
• The DFT computation algorithm described same registers previously occupied by the
here also is efficient with regard to memory corresponding input variables Ψr [m]
requirements • This type of memory location sharing is
• Note: Each stage employs the same butterfly called in-place computation resulting in
computation to compute Ψr +1[α ] and Ψr +1[ β ] significant savings in overall memory
from Ψr [α ] and Ψr [ β ] requirements
35 Copyright © 2010, S. K. Mitra 36 Copyright © 2010, S. K. Mitra
6
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
• In the DFT computation scheme outlined, Algorithm
the DFT samples X[k] appear at the output • Thus, a sequentially ordered input x[n] must
in a sequential order while the input be reordered appropriately before the fast
samples x[n] appear in a different order algorithm described by this structure can be
x[0] X[0]
x[4] _1 X[1]
implemented
0
WN
x[2]
0
WN
_1 X[2] • To understand the input reordering scheme
x[6]
0
WN
_1 2
WN
_1 X[3]
represent the arguments of input samples
x[1] _ 1 X[4]
x[5]
0
WN x[n] and their sequentially ordered new
_1 _ 1 X[5]
representations Ψ1[ m] in binary forms
0 1
WN WN
x[3] _1 _ 1 X[6]
0 2
WN WN
x[7]
37 0
WN
_1 2
WN
_1 3
WN _ 1 X[7] 38
Copyright © 2010, S. K. Mitra Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
• Even after zero-padding, the DFT Algorithm
computation based on the fast algorithm • For example, the relation between x[n] and
may be computationally more efficient than its even and odd parts, x0 [n] and x1[n] ,
a direct DFT computation of the original generated by the first stage of the DIT
shorter sequence
algorithm is given by
• The fast DFT computation schemes
described are called decimation-in-time x[n] : x[0] x[1] x[ 2] x[3] x[ 4] x[5] x[6] x[7]
(DIT) fast Fourier transform (FFT) x0 [n] : x[0] x[ 2] x[ 4] x[6]
x1[ n] : x[1] x[3] x[5] x[7]
algorithms as input x[n] is first decimated to
form a set of subsequences before the DFT
is computed
41 Copyright © 2010, S. K. Mitra 42 Copyright © 2010, S. K. Mitra
7
Decimation-in-Time FFT
Algorithm Decimation-in-Time FFT
• Likewise, the relation between x[n] and the Algorithm
sequences x00 [n] , x01[n] , x10 [n], and x11[n],
generated by the two-stage decomposition • The subsequences x00 [ n], x01[n] , x10 [n], and
of the DIT algorithm is given by x11[n] can be generated directly by a factor-
of-4 decimation process leading to a single-
x[n] : x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] stage decomposition as shown on the next
x00 [ n] : x[0] x[4] slide
x01[ n] : x[ 2] x[6]
x10 [n] : x[1] x[5]
x11[n] : x[3] x[7]
43 Copyright © 2010, S. K. Mitra 44 Copyright © 2010, S. K. Mitra
Decimation-in-Time FFT
Decimation-in-Time FFT
Algorithm
Algorithm
X 0 [〈 k 〉 N / 2 ]
• Radix-R FFT algorithm - A each stage the
x00 [ n ] N − point X 00 [ 〈 k 〉 N / 4 ] decimation is by a factor of R
x[ n ] 4 4
W Nk
+ + X [k ]
DFT
W Nk/ 2
• Depending on N, various combinations of
z decompositions of X[k] can be used to
x01 [ n ] N − point X 01 [ 〈 k 〉 N / 4 ] W Nk
4 4
develop different types of DIT FFT
DFT
z X 1[〈 k 〉 N / 2 ] algorithms
x10 [ n ] N − point X 10 [ 〈 k 〉 N / 4 ]
4 4
W Nk
+ • If the scheme uses a mixture of decimations
DFT
W Nk/ 2
z by different factors, it is called a mixed
x11 [ n ] N
− point X 11 [ 〈 k 〉 N / 4 ]
4 4
DFT
radix FFT algorithm
8
Decimation-in-Frequency Decimation-in-Frequency
FFT Algorithm FFT Algorithm
• Evaluating X(z) on the unit circle at • For k even
( N / 2) −1
we get X [2l] = ( x[n] + x[ N + n])WN2nl
( N / 2) −1 ∑ 2
X [k ] = nk ( N / 2) −1 n =0
∑ x[n]WN
n =0 = ∑ ( x[n] + x[ N + n])WNnl/ 2 , 0 ≤ l ≤ N − 1
( N / 2) −1 n =0
2 2
+ WN( N / 2) k ∑ x[ N + n]WNnk • For k odd
2
n =0 ( N / 2) −1
which can be rewritten using the identity X [2l + 1] = ∑ ( x[ n] − x[ N + n]) WNn( 2l +1)
WN( N / 2) k = (−1) k as n =0
2
( N / 2) −1
( N / 2) −1 = ( x[n] − x[ N + n])WNn WNnl/ 2 , 0 ≤ l ≤ N − 1
X [k ] = ( x[n] + (−1) k x[ N + n])WNnk ∑
∑ 2 n =0
2 2
49 n =0 50
Copyright © 2010, S. K. Mitra Copyright © 2010, S. K. Mitra
Decimation-in-Frequency Decimation-in-Frequency
FFT Algorithm FFT Algorithm
• We can write • Thus X [2l] and X [2l + 1] are the (N/2)-
( N / 2) −1 point DFTs of the length-(N/2) sequences
X [2l] = ∑ x0[n] WNn( 2l ) x0 [ n] and x1[n]
n =0 • Flow-graph of the first-stage of the DFT
( N / 2) −1 algorithm is shown below
X [2l + 1] = ∑ x1[n] WNn ( 2l ) , 0 ≤ l ≤ N − 1 x[0]
x [0] 0
X[0]
2 x0[1]
n =0 x[1] N- point X[2]
x0[2] 2
DFT
where x[2]
x0[3]
X[4]
x0[n] = ( x[ n] + x[ N + n]),
x[3] X[6]
x1[0]
x[4] _ X[1]
2 1 W0
N x1[1] N
x[5] _ - point X[3]
Decimation-in-Frequency Decimation-in-Frequency
FFT Algorithm FFT Algorithm
• Here the input samples are in sequential • We next express the even- and odd-indexed
order, while the output DFT samples appear samples of each one of the two (N/2)-point
in a decimated form with the even-indexed DFTs as a sum of two (N/4)-point DFTs
samples appearing as the output of one • Process is continued until the smallest DFTs
(N/2)-point DFT and the odd-indexed are 2-point DFTs
samples appearing as the output of the other
(N/2)-point DFT
9
Decimation-in-Frequency Decimation-in-Frequency
FFT Algorithm FFT Algorithm
• Complete flow-graph of the decimation-in- • Computational complexity of the radix-2
frequency FFT computation scheme for N = 8 DIF FFT algorithm is same as that of the
x[0] X[0] DIT FFT algorithm
x[1] _ X[4]
1 0
WN • Various forms of DIF FFT algorithm can
x[2] _ X[2]
1 WN0
x[3] _ _ X[6] similarly be developed
1 WN2 1 0
WN
x[4] _
1 0
WN
X[1]
• The DIT and DIF FFT algorithms described
x[5] _ _ X[5]
1 WN1 1 0
WN here are often referred to as the Cooley-
x[6] _ _ X[3]
1 W2 1 0
x[7] _
N
_
WN
_ X[7] Tukey FFT algorithms
1 WN3 1 2
WN 1 0
WN
55 Copyright © 2010, S. K. Mitra 56 Copyright © 2010, S. K. Mitra
10