Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec081 Digital signal processing: Lecture 8 Discrete Fourier Transformation –II Chapter 4: Fast Fourier TransformationProduced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec082 Topics of last lecture • Discrete Fourier transformation (DFT) • Linearity • Periodicity • Periodicity Symmetry • Direct computation of DFT • 離散フーリエ変換 (DFT) • DFTの線形性 • DFTの周期性 • DFTの対称性 • DFTの直接的計算Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec083 Topics of this lecture • Fast Fourier transform. • Computational cost of FFT. • Convolution based on FFT. • Filtering based on FFT. • Crosscorrelation based on FFT. • 高速フーリエ変換 • FFTの計算量 • FFTに基づく畳み込み • FFTに基づくフィルタリ ング • FFTに基づく相関Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec084 The fast Fourier transform (FFT) • The basic idea is to use the symmetric and periodic properties of ej2πknN. • Suppose that N=2p. • The DFT can be divided into two parts as follows: • Since the computational cost for each part is (N2)2, and we can combine the results using N computations, the total cost can be reduced. ∑ ∑ ∑ = = − = = = + n odd kn N n even kn N N n kn X (k) x(n)WN x(n)W x(n)W 1 0Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec085 ( ) ( ) ( )( ) ( )( ) (2 )( ) (2 1)( ) (2 )( ) (2 1)( ) ( ) ( ) ( ) ( ) 0 1 2 2 1 0 1 2 1 0 2 0 2 2 1 0 2 1 0 2 2 1 0 2 2 1 0 2 1 0 X k W X k x r W W x r W x r W W x r W x r W W x r W X k x n W x n W x n W kN kr N N r kN kr N r N kr N N r kN kr N r N kr N r N kN kr N r N n odd kn N n even kn N N n kn N = + = + = + + = + + = = + ∑ ∑ ∑ ∑ ∑ ∑ ∑ ∑ ∑ − = − = − = − = − = − = = = − =Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec086 ( 2) ( ) ( ), 0,1,..., 2 1 ( ) ( ) ( ), 0,1,..., 2 1 We can find ( ) as follows: Also, since In the above derivation, we have used the property 0 1 0 1 2 2 2 2 (2 ) (2 ( 2)) + = − = − = + = − = − = = = + − − X k N X k W X k k N X k X k W X k k N X k W W W e e W kN kN k N N kN N j N j N N π πProduced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec087 Graphically, we haveProduced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec088 This process can be continuedButterfly operation • The division is continued until N=2. • For N=2, two outputs can be obtained from two inputs using the butterfly operation. Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec089 ( ) ( ) ( ) (4.21) ( ) ( ) ( ) (4.20) 1 1 X r X q W X r X q X q W X r kN s s kN s s = − = + + +Flow of FFT (Fig. 4.6 p. 56) Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0810Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0811 Computational cost of FFT • An Npoint DFT can be divided into two N2point DFTs. • Computation amount is reduced (if N>2) to N+2(N2)2 from N2. • Similarly, the N2point DFT can be divided into two N4point DFTs. • This division can be continued until there are only two points. • The total number of multiplications is (N2)log2N. • The total number of additions is Nlog2N.Find the convolution sum of two Npoint discrete signals (p. 62) ∑= = − N k y n x k x n k N y n N x n x n 0 1 2 1 2 ( ) ( ) ( ) Result : An 2 point discrete signal ( ) calculated by Given :Two point discrete signals ( ) and ( ). Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0812Find the convolution sum with FFT • If we find the convolution sum directly, the number of computations will be O(N2). • If we use FFT, the computation cost can be reduced to Nlog2N. • For this purpose, we need the following steps: – Step 1: Extend each signal to 2N1 points; – Step 2: Find the DFT of each signal; – Step 3: Multiply the results; – Step 4: Find the IDFT. • The cost will be 2xNlog2(2N)=O(Nlog2N). Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0813 (p. 62)Example 4.3 p. 6263 Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0814Find the response of an FIR filter Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0815 ∑= = − N k y n h k x n k x n h n 0 ( ) ( ) ( ) Response of the system calculated by Result : ( ) : Input of the system : ( ) : Impulse response of an LTI system Given : Merit: We can use FFT to reduce the computational cost. Problem: The length of x(n) can be much longerFiltering with an FIR system Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0816 Taken from Digital Signal Processing, written by Oppenheim, and translated by H. Date.Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0817 Overlapadd method for finding the response of an FIR filter using convolution. Taken from Digital Signal Processing, written by Oppenheim, and translated by H. Date.Find the crosscorrelation of two signals • Crosscorrelation is a measure of similarity between two signals or patterns. • Crosscorrelation can be used to find features in an unknown signal by comparing it to a known one. It has applications in pattern (e.g. image and text) detection, which is useful for information retrieval. • The crosscorrelation is similar to the convolution of two signals. Convolution involves reversing a signal, then shifting it and multiplying by another signal. • Both crosscorrelation and convolution can be found efficiently using FFT. Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0818Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0819 Definition of crosscorrelation correlation is called auto correlation. conjugate. If ( ) and ( ) are the same, the cross where the superscript asterisk indicates the complex ( ) ( ) ( ) ( ) correction is defined by Given two signals ( ) and ( ), their cross 1 2 2 1 1 2 1 2 x n x n x n x n x m x n m x n x n ∞∑m =−∞ ⊗ = +Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0820 Finding the crosscorrelation using FFT • Similar to convolution theorem, we have • Therefore, we can find the crosscorrelation efficiently using FFT as follows: – Step 1: Extend the lengths (durations) of the two signals to 2N1; – Step 2: Find the DFT of the two signals. – Step 3: Find the complex conjugate of DFTx1(n). – Step 4: Multiplication. – Step 5: Find the IDFT. DFTx1(n)⊗ x2(n) = DFTx1(n) ⋅DFTx2(n)Homework Produced by Qiangfu Zhao (Since 1995), All rights reserved © DSPLec0821 • Revise the program given in p. 63, and find x3(n)=x1(n)x2(n), using FFT, where is the convolution sum, and x1(n) and x2(n) are given below. – To understand the basic steps, see slide 13. – Plot and print x1,x2, and x3; and their FFTs. – Submit the hardcopies before the deadline. x1=1 2 3 4 5 6 7 8; x2=1 2 3 4 5 4 3 2;Quiz and selfevaluation 0 0.2 0.4 0.6 0.8 1 1.2 T1 T2 T4 T3 T5 Name: Student ID: . • For a N=16 point DFT, how many percent of computations can we reduce if we use FFT? The rate of reduction is calculated as follows: Answer: • How about the reduction rate for N=64? Answer: % Cost of DFT Cost of DFT Cost of FFT R =
Trang 1Digital signal processing: Lecture 8
Discrete Fourier
Transformation –II
Chapter 4: Fast Fourier Transformation
Trang 2Topics of last lecture
• DFTの線形性
• DFTの周期性
• DFTの対称性
• DFTの直接的計算
Trang 3Topics of this lecture
• Fast Fourier transform
• FFTに基づく相関
Trang 4The fast Fourier transform (FFT)
• The basic idea is to use the symmetric and periodic properties of e-j2πkn/N.
• Suppose that N=2p.
• The DFT can be divided into two parts as follows:
• Since the computational cost for each part is (N/2)2,
kn N even
n
kn N N
n
kn
W n x k
1
0
Trang 5) ( )
(
) )(
( )
)(
(
) )(
1 2
( )
)(
2 (
) )(
1 2
( )
)(
2 (
) ( )
( )
( )
(
1 0
2
1 2
0 1
1 2
0
2
1 2
0
1 2
1 2
0
2
1 2
W k
X
W r
x W
W r
x
W r
x W
W r
x
W r
x W
W r
x
W n
x W
n x W
n x k
X
k N
kr N
N/
r
k N kr
N/
r
N
kr N
N/
r
k N kr
N/
r
N
kr N/
r
N
k N kr
N/
r
N
odd n
kn N even
n
kn N N
n
kn N
=
+ +
Trang 61 2
/ , ,
1 , 0
, ) ( )
( )
2 / (
1 2
/ , ,
1 , 0
, ) ( )
( )
(
: follows as
) ( find
can
We
since Also,
property the
used have
we ,
derivation above
the
In
1 0
2 /
2
)) 2 / /(
2 ( )
/ 2 ( 2 2
−
=
−
= +
−
= +
k X
W k
X N
k
X
N k
k X
W k
X k
X
k X
W W
W e
e W
k
k N
N k N
k
N
N
N j
N j
N
π π
Trang 7Graphically, we have
Trang 8This process can be continued
Trang 9Butterfly operation
• The division is continued until N=2.
• For N=2, two outputs can be obtained from two
inputs using the butterfly operation.
) 21 4 ( )
( )
( )
(
) 20 4 ( )
( )
( )
(
1
1
r X W q
X r
X
r X W q
X q
X
k N s
s
k N s
Trang 10Flow of FFT (Fig 4.6 p 56)
Trang 11• The total number of multiplications is (N/2)log2N.
• The total number of additions is Nlog2N
Trang 12Find the convolution sum of
y
n y N
n x n
x N
0
2 1
2 1
)(
)()
(
bycalculated)
(signaldiscrete
point -
2
An :
Result
)
(and
)(signalsdiscrete
point -
Two :
Given
Trang 13Find the convolution sum with FFT
• If we find the convolution sum directly, the number of
computations will be O(N 2)
• If we use FFT, the computation cost can be reduced to
Nlog2N.
• For this purpose, we need the following steps:
– Step 1: Extend each signal to 2N-1 points;
– Step 2: Find the DFT of each signal;
– Step 3: Multiply the results;
– Step 4: Find the IDFT.
• The cost will be 2xNlog2(2N)=O(Nlog2N).
(p 62)
Trang 14Example 4.3 p 62-63
Trang 15Find the response of an FIR filter
y
n x
n h
0
)(
)()
(
bycalculatedsystem
theof
Response
:Result
:system the
ofInput :
)(
systemLTI
an of
responseImpulse
:)(
:Given
Merit: We can use FFT to reduce the computational cost
Problem: The length of x(n) can be much longer!
Trang 16Filtering with an FIR system
Trang 17Overlap-add method for finding the response of an FIR filter using convolution.
Taken from Digital Signal Processing, written
by Oppenheim, and translated by H Date.
Trang 18Find the cross-correlation of two signals
• Cross-correlation is a measure of similarity between two signals or patterns
• Cross-correlation can be used to find features in an
unknown signal by comparing it to a known one It has applications in pattern (e.g image and text) detection, which is useful for information retrieval
• The cross-correlation is similar to the convolution of two signals Convolution involves reversing a signal, then
shifting it and multiplying by another signal
Trang 19Definition of cross-correlation
n.
correlatio -
auto called
is n correlatio
cross the
-same, the
are )
( and
) ( If
conjugate.
complex the
indicates asterisk
t superscrip the
where
) (
) ( )
( )
(
by defined
is correction
cross their
-), ( and
) ( signals
two Given
2 1
2
* 1 2
1
2 1
n x
n x
m n
x m x
n x
n
x
n x
n x
Trang 20Finding the cross-correlation using FFT
• Similar to convolution theorem, we have
• Therefore, we can find the cross-correlation efficiently using FFT as follows:
– Step 1: Extend the lengths (durations) of the two
signals to 2N-1;
– Step 2: Find the DFT of the two signals
)] (
[ DFT )]
( [
DFT )]
( )
( [
DFT x1 n ⊗ x2 n = x1 n * ⋅ x2 n
Trang 21• Revise the program given in p 63, and find
x3(n)=x1(n)*x2(n), using FFT, where * is the convolution sum, and x1(n) and x2(n) are given below
– To understand the basic steps, see slide 13.
– Plot and print x1,x2, and x3; and their FFTs.
– Submit the hardcopies before the deadline.
x1=[1 2 3 4 5 6 7 8];
x2=[1 2 3 4 5 4 3 2];
Trang 22Quiz and self-evaluation
0 0.2 0.4 0.6 0.8 1 1.2 T1
T2 T5
• For a N=16 point DFT, how many
percent of computations can we reduce
if we use FFT? The rate of reduction is
calculated as follows:
Answer:
% DFT
of Cost
FFT of Cost - DFT of
Cost
=
R