Sunteți pe pagina 1din 28

EENG 5610: Digital Signal Processing

Class 7: The Discrete Fourier Transform


Dr. Xinrong Li
Department of Electrical Engineering
University of North Texas

Outline
The Discrete Fourier Transform (DFT)
Properties of the DFT
Linear Filtering Methods Based on the DFT
Frequency Analysis of Signals using the DFT

Dr. Xinrong Li

EENG 5610, UNT

The Discrete Fourier Transform


Motivation
The Fourier transform X(w) of the discrete-time signal x(n) is a

continuous function. Thus, its not convenient to perform frequency


analysis with a computer or digital signal processor.
FT : X ( w)

x ( n )e

jwn

1
IFT : x(n)
2

X ( w)e

jwn

dw

DFT is a powerful computational tool for performing frequency

analysis of discrete-time signals.

Dr. Xinrong Li

EENG 5610, UNT

Frequency-Domain Sampling and Reconstruction of Discrete-

Time Signals
Sample X(w) periodically in frequency at w = 2k/N:

2
j 2kn / N
,
X ( N k ) x ( n)e
n

X ( w)

x ( n )e

jwn

x p ( n)

N 1

k 0

N 1

x
n 0

lN N 1

x ( n)e

j 2kn / N

l n lN

x(n lN ) c e

1
ck
N

(n)e j 2kn / N ,

j 2kn / N

for k 0, 1, ..., N 1
2kn / N
x
(
n

lN
)

e
n 0 l

N 1

( x p (n) is a periodic signal)

for k 0, 1, ..., N 1

1
2
c

X
(
k ), for k 0, 1, ..., N 1
k N
N

N 1
x p (n) 1 X ( 2 k )e j 2kn / N , for n 0, 1, ..., N 1

N k 0
N
xp(n)
is the periodic
extension of x(n). Thus, x(n) can be recovered from xp(n) if
there is no aliasing in the time domain, that is, if x(n) is time-limited to less than
the period N of xp(n).
X(w) can then be recovered from x(n).

Dr. Xinrong Li

EENG 5610, UNT

Interpolation formula for X(w):


Assume N L (x(n) is nonzero in the interval 0 n L -1).

1
x ( n)
N
X ( w)

N 1

X(
k 0

x ( n )e

2
k )e j 2kn / N ,
N
jwn

n
N 1

X(
k 0

1
P( w)
N

N 1

2
k)
N

jwn

n 0

1

n 0 N

0 n N 1
2

k )e j 2kn / N e jwn
k 0

1 N 1 j ( w 2k / N ) n N 1 2
2
e

X
(
k
)
P
(
w

k)

N k 0
N
N
k 0
1 1 e jwN sin( wN / 2) jw ( N 1) / 2

e
N 1 e jw
N sin( w / 2)
N 1

N 1

X( N

P(w) is periodic function and

P(

1,
2
k)
N
0,

k 0
k 1, 2 , ..., N 1

Thus, from the interpolation

2
formula: X ( w)

X
(
k)
w 2k / N
N

Dr. Xinrong Li

EENG 5610, UNT

Example 7.1.1
x(n) a nu (n),

0 a 1

1
1 ae jw
n 0

2
1
X ( k)
, 0 k N 1
N
1 ae j 2k / N
X ( w) a n e jwn

x p ( n)

x(n lN )

[or from IDFT ]

a nlN a n a lN

l 0

a
, 0 n N 1
1 aN

x p (n),

0 n N 1

0,

otherwise

x (n)

N 1

N 1

n 0

n 0

X ( w) x (n)e jwn x p (n)e jwn


1 1 a N e jwn

1 a N 1 ae jw
2
2
X ( w) X ( w), but : X ( k ) X ( k )
N
N

Dr.
Xinrong
Li
6

EENG 5610, UNT

The Discrete Fourier Transform (DFT)


N 1

DFT : X (k ) x(n)e j 2kn / N , 0 k N 1;


n 0

1
IDFT : x(n)
N

N 1

X ( k )e

j 2kn / N

, 0 n N 1.

k 0

The sequence X(k) are N-point frequency samples of X(w).


X(k) corresponds to a periodic sequence xp(n), which is an aliased

version of x(n): x p (n) l x(n lN )

If the sequence x(n) has a finite duration of length L N, then x(n) =

xp(n) over a single period, 0 n N - 1.


Zero-padding of x(n) (padding N- L zeros) does not provide any

additional information about the spectrum X(w) of the sequence x(n).


Padding x(n) with N L zeros and computing N-point DFT results in a

better display of the Fourier transform X(w) (with more samples).

Dr. Xinrong Li

EENG 5610, UNT

Example 7.1.2
1,
0,

x ( n)

0 n L 1
otherwise

L 1

sin( wL / 2) jw( L 1) / 2
e
sin(
w
/
2
)
n 0

X ( w) x(n)e jwn

2
k ), 0 k N 1
N
sin(kL / N ) jk ( L 1) / N

e
sin(k / N )

X (k ) X (

If N L, then :
L,
0,

X (k )

k 0
1 k L 1

Dr. Xinrong Li

EENG 5610, UNT

Effects of zero-padding:

Dr. Xinrong Li

EENG 5610, UNT

Effects of zero-padding:

10

Dr. Xinrong Li

EENG 5610, UNT

The DFT as a Linear Transformation


Define : WN e j 2 / N (which is an Nth root of unity), then :
N 1

1
DFT : X (k ) x(n)W , IDFT : x(n)
N
n 0

x ( 0)
x (1)

xN

kn
N

XN

X ( 0)
X (1)

X (k )W
k 0

1
1

WN

x
(
N

1
)
X
(
N

1
)

DFT : X N WN x N ,

1 *
1
IDFT
:
x

W
X

WN X N ,
N
N
N

N 1

0 k, n N 1

...

WN

...

WNN 1

N 1
1 WN

( WN1

kn
N

... WN( N 1)( N 1)

1 *
WN or WN WN* NI N )
N

Example 7.1.3

0
1
x4 ,
2

3
11

Dr. Xinrong Li

1
1
1 1
1 j 1 j
,
W4
1 1 1 1

1
j

X 4 W4 x 4

6
2 2 j
2

2 2 j
EENG 5610, UNT

Relationship of the DFT to Other Transforms


Relationship to the Fourier series coefficients of a periodic sequence
Periodic sequence xp(n) with fundamental period N:
N 1

x p ( n ) ck e

j 2nk / N

, n ;

k 0

1
ck
N

N 1

j 2nk / N
x
(
n
)
e
, 0 k N 1
p
n0

If we define a sequence x(n) = xp(n), 0 n N 1:

1 N 1
x(n) X (k )e j 2kn / N ,
N k 0
X (k ) Nck

N 1

X (k ) x(n)e j 2kn / N , 0 n, k N 1
n 0

Relationship to the Fourier transform of an aperiodic sequence


For an aperiodic sequence x(n) with Fourier transform X(w):

X (k ) X ( w) w2k / N

Dr. Xinrong Li

j 2nk / N

0 k N 1

x p (n) IDFT{ X (k )}

12

x ( n )e

x(n lN ),

x p (n),

0 n N 1

0,

otherwise

x (n)

EENG 5610, UNT

Relationship to the z-transform


For x(n) with z-transform X(z) and an ROC that includes the unit circle, the

DFT sequence X(k) is N equally spaced samples of X(z) on the unit circle:

x (n) z

X ( z)

x ( n )e

X (k ) X ( z ) z e j 2k / N

j 2nk / N

0 k N 1

If x(n) has a finite duration of length L N, x(n) can be recovered from its N-

point DFT X(k). Hence, X(z) is uniquely determined by X(k):


N 1

X ( z ) x ( n) z

n 0

1 z N

1

n 0 N
N 1

N 1

X ( k )e

j 2kn / N

k 0

N 1

N 1

k 0

n 0

X ( k ) (e

j 2k / N

z 1 ) n

N 1

X (k )

j 2k / N 1
z
k 0 1 e

Relationship to the Fourier series coefficients of a continuous-time signal


For a continuous-time periodic signal xa(t) with fundamental period Tp = 1/F0,

xa (t )

c e

j 2ktF0

x(n) xa (nT )

ck e

j 2kn / N

X (k ) N ck lN
l

13

Fs 1 / T N / T p

Nc~k ,

j 2kn / N
c

k lN e
k 0 l

N 1

c~k

k lN

The sequence c~k is an aliased version of the sequence ck .

Dr. Xinrong Li

EENG 5610, UNT

Properties of DFT
DFT and IDFT

Define : WN e j 2 / N , then for 0 k , n N 1 :


N 1

X ( k ) x ( n)e
n 0

j 2kn / N

N 1

x(n)W ,
n 0

kn
N

1
x ( n)
N

N 1

X ( k )e
k 0

j 2kn / N

N 1

X (k )W
k 0

Periodicity Property
If x(n) and X(k) are DFT pair, then:
x(n + N) = x(n), for all n,
X(k + N) = X(k), for all k.

Linearity Property
For any real-valued or complex-valued constants a1 and a2:
DFT

a1 x1 (n) a2 x2 (n) a1 X 1 (k ) a2 X 2 (k )
N

14

Dr. Xinrong Li

EENG 5610, UNT

kn
N

Circular Symmetries of a Sequence

x(n lN ),

x p (n)

x p ' (n),

x ' ( n)

x p ' ( n) x p ( n k )

x(n k lN )

0 n N 1

otherwise
0,
x((n k ) modulo N ) x((n k )) N

The sequence x ' (n) is a circular shift of the original x (n).


Examples of index modulo:
x((-2))4 = x(2), x((-1))4 = x(3)

x((0))4 = x(0),

x((1))4 = x(1)

An N-point sequence is called

circular even if it is symmetry about


the point zero on the circle, i.e.,
if x(N - n) = x(n), for 1 n N-1.
An N-point sequence is called
circular odd if it is anti-symmetry about
the point zero on the circle, i.e.,
if x(N - n) = - x(n), for 1 n N-1.
Time reversal of an N-point sequence:
x((-n))N = x(N - n), for 1 n N-1.
15

EENG 5610, UNT

Multiplication of Two DFTs and Circular Convolution


Multiplication of the DFTs of two sequences is equivalent to the circular

convolution of the two sequences in the time domain.


N 1

X 1 ( k ) x1 (n)e

j 2nk / N

N 1

X 2 (k ) x2 ( n)e j 2nk / N ,

n 0

n 0

X 3 ( k ) X 1 (k ) X 2 (k ),
N 1

1
x3 (m)
N

X
k 0

( k )e

0 k N 1
j 2km / N

N 1 N 1

x (n)e

N 1

N 1

n 0

l 0

k 0

0 k N 1

n 0

X (k ) X
k 0

j 2nk / N

x1 (n) x2 (l )

N 1

N 1

x (l )e

l 0

(k )e j 2km / N

j 2lk / N

j 2km / N
e

N 1

k 0

e j 2k ( mnl ) / N

N 1

x1 (n) x2 ((m n)) N ,

0 m N 1

[circular convolution]

n 0

N 1

DFT

n 0

x3 (m) x1 (n) (N) x2 (n) x1 (n) x2 ((m n)) N X 3 (k ) X 1 (k ) X 2 (k )


a 1,

Define a e j 2 ( m n l ) / N , then
N 1

16

e
k 0

j 2k ( m n l ) / N

N 1

a
k 0

for m n l pN , where p is an integer;

N
a 1, for a 0.
N,
a 1 N , for m n l pN , where p is an integer;

or l m n pN ((m n)) N
1 aN
, a 1
EENG 5610, UNT
0
,
otherwise.
1 a

Example 7.2.1
Steps for circular convolution
Circular folding (time reversing)
Circular Shifting
Multiplying
Summing

x3 (0) 14

Circular convolution in time domain :


N 1

x3 (m) x1 (n) x2 ((m n)) N ,

0 m N 1

n 0

x3 (1) 16

Multiplication of DFTs in frequency domain :


X 3 (k ) X 1 (k ) X 2 (k )
x3 (m) IDFT{ X 1 (k ) X 2 (k )}

x3 (2) 14

x3 (3) 16

17

Dr. Xinrong Li

EENG 5610, UNT

Time reversal of a sequence


Reversing the N-point sequence x(n) in time domain is equivalent to

reversing the DFT in frequency domain:


DFT

x((n)) N x( N n) X ((k )) N X ( N k )
N

DFT

Circular time shift of sequence: x((n l )) N X (k )e j 2kl / N


N

DFT

Circular frequency shift: x(n)e j 2ln / N X ((k l )) N


N

DFT

Complex conjugate properties: x* (n) X * ((k )) X ( N k )


N
N

N 1
DFT
~
Circular correlation: ~
*
rxy (l ) x(n) y ((n l )) N Rxy (k ) X (k )Y * (k )
N

n 0

Multiplication of two sequences:


1
1
x1 (n) x2 (n)
X 1 (k ) (N) X 2 (k )
N
N
N
DFT

18

Dr. Xinrong Li

N 1

X (k ) X
k 0

((l k )) N

EENG 5610, UNT

Linear Filtering Methods Based on DFT


Frequency-domain method equivalent to linear convolution:
DFT-based frequency-domain approach is computationally more efficient

than time-domain convolution due to the existence of efficient algorithms


for computing DFT that are known as FFT.
Product of two DFTs is equivalent to the circular convolution of two time
domain sequences. But, circular convolution is of no use for linear
filtering purposes.
Given a sequence x(n) of length L, and an FIR filter h(n) of length M, the
output of the filter y(n) is of length L + M 1.
M 1

y (n) x(n) * h(n) h(k ) x(n k ),

Y ( w) X ( w) H ( w)

To avoid time-domain aliasing,


a DFT of size N L + M 1 is required to
k 0

represent y(n) in the frequency domain.


Thus, Y(k) = X(k)H(k), 0 k N 1, where X(k) and H(k) are the N-point DFTs
of x(n) and h(n) after zero-padding.
That is, N-point circular convolution of x(n) and h(n) after zero-padding is
equivalent to the linear convolution of x(n) and h(n).
19

Dr. Xinrong Li

EENG 5610, UNT

Filtering of Long Data Sequences


In practical application, input sequence x(n) is often very long.
A long input sequence must be segmented to fixed-size blocks prior to
processing based on DFT.
Two methods are available for linear FIR filtering of a long sequence on a
block-by-block basis using DFT and IDFT, which is equivalent to timedomain convolution.
Overlap-save method
Overlap-add method
Assume the FIR filter has duration M, the input sequence is segmented into blocks

of L points, and L >> M.


Overlap-Save Method
The size of the input data block is N = L + M 1, so is DFT and IDFT.
Each data block consists of the last M 1 data points of the previous data block

followed by L new data points to form a block of length L + M 1.


With N-point DFT and IDFT:
The first M 1 points of

are corrupted by aliasing and must be discarded;

YmL(kpoints
) H of
(k ) X m (k are
), exactly
y m (n) the
IDFT{
0 k, n N 1
the last
sameYas
m ( k )},
the result from linear convolution.
y (n)
m

y m (n)
20

EENG 5610, UNT

21

Dr. Xinrong Li

EENG 5610, UNT

Overlap-Add Method
The size of the input data block is L points.
The size of DFT and IDFT is N = L + M 1.
Append M 1 zeros to each data

block and compute N-point DFT.


Two N-point DFTs are multiplied to
form: Ym(k) = H(k)Xm(k), 0 k N 1.
The last M 1 points from each output
block is overlapped and added to the first
M 1 points of the succeeding block.

22

Dr. Xinrong Li

EENG 5610, UNT

Frequency Analysis of Signals using DFT


Frequency spectrum from finite data record
Signal spectrum can only be approximated from a finite data record.
The finite observation interval T0 for a signal limits frequency
resolution; that is, it limits our ability to distinguish two frequency
components that are separated by less than 1/T0 in frequency.
Limiting the sequence x(n) to L samples is equivalent to multiplying x(n)

by a rectangular window w(n) of length L:


x (n) x(n) w( n),
1
X ( w)
2

1, 0 n L 1
,
0, otherwise

w(n)

W ( w) F {w(n)}

sin( wL / 2) jw ( L 1) / 2
e
sin( w / 2)

X ( )W (w )d

Windowing causes spectral leakage.


Example:

x(n) cos( w0 n),


23

1
X ( w) [W ( w w0 ) W ( w w0 )]
2

EENG 5610, UNT

Windowing also reduces spectral resolution.


The spectrum W(w) of the rectangular window sequence has its first zero

crossing at w = 2/L. Thus, two spectral lines at w1 and w2 are not


distinguishable if | w1 w2 | < 2/L.
Example:

x(n) cos(0.2 n) cos(0.22 n) cos(0.6 n)

24

Dr. Xinrong Li

EENG 5610, UNT

Hanning window
To reduce leakage, we can select a window w(n) that has lower sidelobes in

the frequency domain as compared with the rectangular window.


However, in general, a reduction of the sidelobes in a window W(w) is
obtained at the expense of an increase in the width of the main lobe of W(w)
and hence a loss in resolution.
Hanning window:

2
1
n)],
[1 cos(
w(n) 2
L 1
0,

0 n L 1
otherwise

Example:

x(n) cos( w0 n),


1
X ( w) [W ( w w0 ) W ( w w0 )]
2

25

Dr. Xinrong Li

EENG 5610, UNT

Example:

26

Dr. Xinrong Li

x(n) cos(0.2 n) cos(0.22 n) cos(0.6 n)

EENG 5610, UNT

Example:

27

Dr. Xinrong Li

EENG 5610, UNT

If the spectrum of the window W(w) is relatively narrow in width as compared

to the signal spectrum X(w), the window function has only small (smoothing)
effect on the signal spectrum X(w).
On the other hand, if the

window function has a wide


spectrum as compared to the
signal spectrum X(w), the
window spectrum W(w) masks
the signal spectrum and thus
the DFT of the data reflects
the spectral characteristics of
the window function.

28

Dr. Xinrong Li

EENG 5610, UNT

S-ar putea să vă placă și