10-1 Introduction: Chapter 10 The Discrete Fourier Transform and Fast Fourier Transform Algorithms
10-1 Introduction: Chapter 10 The Discrete Fourier Transform and Fast Fourier Transform Algorithms
Instructor: Zhang
Chapter 10 The Discrete Fourier Transform and Fast Fourier Transform Algorithms 10-1 Introduction
1. x(t) --- Continuous-time signal X(f) --- Fourier Transform, frequency characteristics Can we find
ft X ( f ) =x (t )e j 2 dt
if we dont have a mathematical equation for x(t) ? No! 2. What can we do? (1) Sample x(t) => x0, x1, , xN-1 over T (for example 1000 seconds) t Sampling period (interval) N (samples) over T => t = T / N Can we have infinite T and N? Impossible! (2) Discrete Fourier Transform (DFT):
j 2kn / N => X k = x n e n =0 N 1
k = 1, 2,..., N
k T
for the line spectrum at frequency k = (2 ) 3. Limited N and T => limited frequency resolution 2
1 T
N 1
0 < 2N / T
5. X k
( k = 2
k T
Xk =
N 1 n =0
xn e j 2kn / N
Page 10-1
Instructor: Zhang
y s (t ) =
m =
(t mTs ) :
y s (t ) f s ( f nf s ) n =
Fourier Transform Pair
( fs =
1 ) Ts
when t0 = 0
t ( ) T sin c (Tf ) T
(3) x1 (t ) * x2 (t ) X 1 ( f ) X 2 ( f ) (4) x1 (t ) x2 (t ) X 1 ( f ) * X 2 ( f )
2. Illustration of Error Sources Example 10-1: Continuous time signal: two-sided exponential signal
x (t ) = e
|t |
Page 10-2
Instructor: Zhang
in
DFT
|t |
|t |
) = Ys ( f ) * X ( f )
n =
X ( f nf s ) = 2f s
1 + (2 ( f
1 nf s )) 2
sampling => (1) possible overlapping if f s 2 f h is not held. (2) periodic function, introduce frequencies beyond fs . (2) Limited T (over which x(t) is sampled to collect data for DFT)
t ) T t x sw (t ) = x s (t )( ) T
window
X sw ( f ) = ( 2f s
n =
{1 + 2 ( f
nf s ) 2 }1 ) * (T sin c(Tf ))
Fourier transform given by sampled data in limited window (T) X sw ( f ) is a worse estimate of X(f) than Xs(f) due to the introduction of ( Tsinc( Tf ) ) for convolution! Effect of limited T X ( f ) (3) Dose DFT give s for every f ? No! only discrete frequencies. DFT as an estimate for X(f): even worse than X s ( f ) due to the limited frequency resolution.
Page 10-3
Instructor: Zhang
3. Effect of sampling frequency (or number of points) on accuracy when T is given: Example for e 4. Effect of T (window size) use Compare
t ( ) 4 t ( ) 4
|t |
and
t ( ) 8
for e
|t |
Page 10-4
Instructor: Zhang
Page 10-5
Instructor: Zhang
X ( f
nf s )
superposition of the analog signal spectrum X(f) and its translates (X(f-nfs) n0)
Caused by sampling Overlapping of X(f) and its translates: aliasing (sampling effect) (2) Leakage Effect limited window size T
( )) ( T t ( f ) = F (( )) T t t X s ( f ) = X s ( f ) * F (( )) T
(3) Picket Fence Effect: As an estimation of X(f), does X s ( f ) have picket fence effect? No! DFT: discrete frequencies (not blocked by the fence). 6. Minimization of DFT Error Effects.
Instructor: Zhang
1. DFT Algorithm
X ( k ) = x ( n )e
n =0 N 1 j 2kn / N
= x ( n ) e j 2 / N
n =0
N 1
nk
Denote WN = e
X (k ) =
N 1 n =0
j 2 / N
, then
x(n)WN nk
WN N = e j 2 = 1
(3) WN N / 2 = e j 2 /( N / 2) / N = e j = 1
WN N / 4 = e j 2 /( N / 4) / N = e j / 2 = j
WN
3N / 4
= e j 2 /(3 N / 4) / N = e j 3 / 2 = j
k = 0,1
n =0
1
X (1) = x (n)W2
n =0 0
n1
= x (n)W2
n =0 1 (1 / 2 ) 2
Example 10-4: Generalization of derivation in example 10-3 to a four-point DFT x(0), x(1), x(2), x(3)
X (k ) =
n =0
x(n)W4 nk
k = 0,1 ,2,3,
Page 10-7
Instructor: Zhang
3
n =0
3
X ( 2) = x(n)W4
n =0
2n
= x(0) + x(1)W4 + x( 2)(1)W4 + x (3)W4 = x(0) + jx(1) + ( 1) x( 2) + ( j ) x (3) = x(0) + jx(1) x ( 2) jx (3)
X (0) =[ x (0) + x ( 2)] +[ x (1) + x (3)]
X (1) =[ x (0) x ( 2)] +( j )[ x (1) x (3)] X ( 2) =[ x (0) + x ( 2)] [ x (1) + x (3)] X (3) =[ x (0) x ( 2)] + j[ x (1) x (3)]
Two point DFT If we denote z(0) = x(0), z(1) = x(2) => Z(0) = z(0) + z(1) = x(0) + x(2) Z(1) = z(0) - z(1) = x(0) - x(2) v(0) = x(1), v(1) = x(3) => V(0) = v(0) + v(1) = x(1) + x(3) V(1) = v(0) - v(1) = x(1) - x(3) Four point DFT Two-point DFT
Instructor: Zhang
enen
Page 10-9
Instructor: Zhang
= =
2 kr
N / 2 1 r =0
g (r )WN g (r )WN
r =0
k (2r )
N / 2 1 r =0 k
h(r )W
N / 2 1 r =0
k ( 2 r +1) N
(k = 0,1,..., N 1)
N / 2 1
2 kr
+ WN
h(r )W
2 kr N
WN
= (e j 2 . / N ) 2 kr = (e j 2 /(. N / 2 ) ) kr = W N
2 N / 2 1 r =0
kr
X (k ) =
g (r )W
kr N /2 k
+WN
N / 2 1 r =0
h(r )W
kr N /2
= G ( k ) + W N H (k )
( G(k): N/2 point DFT output (even indexed), H(k) : N/2 point DFT output (odd indexed))
X ( k ) = G ( k ) + WN k H ( k ) G (k ) = H (k ) =
N / 2 1 r =0
k = 0,1,..., N 1
N / 2 1 r =0
g ( r )WN / 2
kr
x ( 2r )WN / 2
kr
N / 2 1 r =0
h ( r )WN / 2 kr =
N / 2 1 r =0
x ( 2r + 1)WN / 2 kr
Question: X(k) needs G(k), H(k), k= N-1 How do we obtain G(k), H(k), for k > N/2-1 ? G(k) = G(N/2+k) k <= N/2-1 H(k) = H(N/2+k) k <= N/2-1
Page 10-10
Instructor: Zhang
G(k) H(k)
G (k ) = =
N / 4 1 m =0 N / 2 1 r =0
g (r )W
N / 4 1 m =0
kr
( N / 2)
ge(m)W
k
km
( N / 4)
+W( N / 2 )
go(m)W
k
km ( N / 4)
= GE ( k ) +W( N / 2 ) Go( k )
Page 10-11
Instructor: Zhang
h ( 0) x (1) he( 0)
h (1) x ( 3) ho(0)
h ( 2) x (5) he(1)
h ( 3) x ( 7) ho(1)
Page 10-12
Instructor: Zhang
N = 2m
N / 2 1 n =0
x(n)W N
nk
n =N / 2
x(n)W
N 1
nk N
Page 10-13
Instructor: Zhang
N / 2 1 n =0
x ( n )WN nk +
N / 2 1 m =0
N / 2 1 m =0
x ( N / 2 + m )WN ( N / 2 + m ) k
N
x ( n )WN nk +
N
x ( N / 2 + m )WN mkWN 2 k
WN 2 = 1 WN 2 k = ( 1) k X (k ) = =
N / 2 1 n =0 N / 2 1 n =0
x ( n )WN nk +
N / 2 1 m =0
( 1) k x ( N / 2 + m )WN mk
[ x ( n ) + ( 1) k x ( N / 2 + n )]WN nk
N / 2 1 n =0
k : even (k = 2r ) X (k ) = X (2r ) = WN
N/2 point DFT
2 rn
[ x(n) + x( N / 2 + n)]W
2 rn N rn
= (e
j 2 / N
) 2 rn = (e j 2 /( N / 2 ) ) rn = W N / 2
N /2
X ( k ) = X ( 2r ) =
Y (r) =
N / 2 1 n =0
x(n) + x( N / 2 + n)]W [
y (n)
rn
N / 2 1 n =0
y ( n )WN / 2 rn
Z (r )
k : odd k = 2r + 1 X (k ) = X ( 2r + 1) = = = =
N / 2 1 n =0
[ x(n) x( N / 2 + n)]W
n =0 z (n) 2 rn N
n ( 2 r +1) N
N / 2 1
x( n) x( N / 2 + n)]W W [
n N
2 rn N
N / 2 1 n =0
z (n)W z (n)W
N / 2 1
rn N /2
Z (r ) =
n =0 N / 2 1
z (n)W
n =0
rn N /2
N po int 2
DFT
of
z (0), ,
z(
N 1) 2
Page 10-14
Instructor: Zhang
One N/2 point DFT => two N/4 point DFT two point DFTs Consider N/2 point DFT y(0), y(1), , y(N/2-1)
Y (k ) = =
N / 4 1 n =0 N / 2 1 n =0
y ( n )WN / 2 rn
[ y ( n ) + ( 1) k y ( N / 4 + n )]WN / 2 nk
k : even k = 2 r Y (k ) = Y (2r ) = Y 1( r ) =
N / 4 1 n =0 N / 4 1 n =0
[ y( (N n )]WN / 2 nk n )+ y /4 +
y1( n )
y1( n )WN / 4 nk N / 4
po int
DFt
Page 10-15
Instructor: Zhang
[ y ( n ) x ( N / 4 + n )]WN / 2 n WN / 2 2 rn
y 2( n )
y 2( n )WN / 4 rn N / 4
po int
DFT
10-4 C Computation
N point DFT : 4N(N-1) real multiplications 4N(N-1) real additions N point FFT : 2Nlog2N real multiplications (N = 2m) 3Nlog2N real additions Computation ration
Page 10-16
Instructor: Zhang
N =212 =4096
N1 if N even 2 N if N odd 2
Page 10-17
Instructor: Zhang
N1 if N even 2 N if N odd 2
N = 10, xe(n)
N = 9, xe(n)
x(4) = x(5) x(3) = x(6) N 1 = 4.5 x(2) = x(7) 2 x(1) = x(8) x(0) = x(9) x(4) = x(5) x(3) = x(6) N = 4.5 x(2) = x(7) 2 x(1) = x(8) x(0) = x(9)
(4) Any real sequence can be expressed in terms of its even and odd parts according to
x ( n ) = xe ( n ) + xo ( n ) 1 1 = [ x ( n ) + x ( N n )] + [ x ( n ) x ( N n )] 2 2
even odd Question 1: x(n) = 1/2[ ] +1/2 [ ] ? Question 2: x(n) + x(N-n) even ? x(n) - x(N-n) odd ?
Yes!
Page 10-18
Instructor: Zhang
is
4.5 + (4.5-2) = 9-2 = 7 4.5 - (7-4.5) = 9-7 = 2 x(2) + x(7) = x(7) + x(2) ? Yes! => x(n) + x(N-n) even Is x(2) - x(7) = - [x(7) + x(2)] ? Yes! => x(n) - x(N-n) odd (5) subscript r : xr(n) a real sequence subscript i : xi(n) Imaginary part of a complex sequence x ( n ) X ( k ) (6) left right side: side: DFT sequence (7) sequences are assumed periodically repeated if necessary Properties 1. Linearity : 2. Time Shift:
Ax ( n ) + By ( n ) AX ( k ) + BX ( k )
x ( n m) X ( k )e j 2km / N = X ( k )WN k m
x ( n )e j 2km / N X ( k m )
N 1 m =0 N 1 n =0
N 1 x ( n) X ( k )
X (k ) =
x (m)e j 2mk / N
DFT ( X ( n )) =
X (n )e j 2nk / N
DFT of x(m)
Page 10-19
Instructor: Zhang
X (k )e j 2k ( N n ) / N
= e j 2kN / N e j 2kn / N 1 N
N 1 k =0
j 2k ( N n ) / N
x ( n ) =
X (k )e j 2kn / N
1 N
N 1 n =0
DFT ( N 1 X ( n )) =
X (n )e j 2nk / N
= x ( k )
5. Circular convolution
N 1 m =0
circular convolution
6. Multiplication
new sequence z ( n) = x( n) y ( n)
x ( n) y ( n) N
X (m)Y (k m) = N 1 X (k )Y (k )
7. Parsevals Theorem
| x(n) |2 = N 1 | X (k ) | 2
n =0 k =0
N 1
N 1
(the DFT of an even real sequence is even and real ) 9. Transform of odd real functions:
x or ( n) jX oi (k )
(the DFT of an odd real sequence is odd and imaginary ) 10. z(n) = x(n) + jy(n) z(n) Z(k) = X(k) + jY(k) Example 10-7
= cos( n / 2) + j sin( n / 2)
Page 10-20
Instructor: Zhang
X(0) = [x(0) + x(2)] + [x(1) + x(3)] X(1) = [x(0) - x(2)] + (-j)[x(1) - x(3)] X(2) = [x(0) + x(2)] - [x(1) + x(3)] X(3) = [x(0) - x(2)] + j[x(1) - x(3)] For x(n) = cos(n / 2) =>
x(0) = 1 x (1) = 0 x (2) = 1 x (3) = 0
X (0) = 1
X (1) = 2
X (2) = 0
X (3) = 2
Y (0) = 1 Y (1) = j 2
Z ( 0) = 0 Z (1) = 2 j 2 Z ( 2) = 0 Z (3) = 2 + j 2
Y ( 2) = 0
Y (3) = j 2
= 1 k = 0,1,..., N 1
Time-shift property
DFT [ x(n n0 )] = (n n0 )W N
n=0 n k N 1 nk
N 1
Page 10-21
Instructor: Zhang
X 1 (k ) = X 2 (k ) = =
N1 n= 0
N1 n= 0
x1(n)WN = x2 (n)WN nk
nk n= 0
N1
WN
nk
N = 0
k= 0 k 0 k= 0 k 0
N2 X 3 (k ) = X 1 (k ) X 2 (k ) = 0
x3c ( n) = = 1 N
N 1 k =0 N 1 k =0
1 N
N 1 k =0
x3 (k )e j 2nk / N
N 2 (k )e j 2nk / N
2kt 2k = T N
(1 =
2 T
t =
T ) N
x(n) = X (k )e j 2nk / N
k =0 N0
N 1
x(n) = X (k )e j 2nk / N
k =0
Page 10-22
Instructor: Zhang
n 4
+ cos
2 =(
1 =
2 2 ( ) 8 N
2 4 )2= = N 8 2
n 2
0n7
2. Spectrum Analyzers Analog oscilloscopes => time-domain display Spectrum Analyzers: Data Storage, FFT 3. Energy Spectral Density x(0), , x(N-1): its energy definition
E=
N 1 n =0
| x(n) |2
Parsevals Theorem
E=
N 1
| x ( k ) |2 N k =0
Page 10-23