Sunteți pe pagina 1din 75

Chapter 2

Discrete Fourier Transform


Instructor: Ted
Email:yzmhit@163.com
Phone:13836034068
03/04/16

Three Questions about Discrete Fourier Transform


Q1: WHAT is DFT?
WHAT is relationship between DFT and other kinds of Fourier
Transform?

Q2: WHY is DFT?


WHY we need DFT?

Q3: HOW to DFT?


HOW to realize DFT? How to use DFT to solve the practical
problems?
03/04/16

Basic contents of this chapter


2.1 Review of Fourier Transform
2.2 Discrete Fourier Series
2.3 Discrete Fourier Transform
2.4 Relationship between DFT, z-Transform and sequences
Fourier Transform
2.5 Frequency sampling theorem
2.6 Compute sequences linear convolution using DFT
2.7 Spectrum analysis based on DFT
2.8 Review
03/04/16

2.1 Fourier Transform


Signal Analysis and Processing
1 Time Domain Analysis: t-A
2 Frequency Domain Analysis: f-A
Fourier
Transform

x t in time-domain
x t sin 2 500
f t t 2 randn

x t in frequency-domain

In some situation, signals frequency spectrum can represent its characteristics


more clearly.
03/04/16

2.1 Fourier Transform


Signal Analysis and Processing:
1 Time Domain Analysis
2 Frequency Domain Analysis
Fourier Transform is a bridge from time domain to frequency domain.
Characteristic: continuousdiscrete, periodic nonperiodic .
Type:
Continuous periodic signals
Continuous nonperiodic signals
Discrete nonperiodic signals
Discrete periodic signals
03/04/16

1) Continuous periodic signal--Fourier Series


It is proved that continuous-time periodic signal can be represented by a
Fourier Series corresponding to a sum of harmonically related complex
exponential signal. To a periodic function f t with period

T ,
T
2

1
f t Fn e jn0t , 0
Fn 2T f t e jn0t dt
T
T 2
n
f (t )
Fn

L
0

2 2

Time-domain

Frequency-domain

Conclusion: Continuous periodic function


Nonperiodic discrete frequency impulse sequence
03/04/16

2) Continuous nonperiodic functions Fourier Transform

X ( j ) x ( t )e jt dt

1
x( t )
2

A x (t )

X ( j )e jt d
X ( j)

Time-domain

Frequency-domain

Conclusion : Continuous nonperiodic function


Nonperiodic continuous function
03/04/16

3) Discrete-time nonperiodic sequences Fourier Transform

j
j n
X
(
e
)

x
n
e

x n 1 X (e j )e j n d

X (e

j ( 2 M )

x n e

j ( 2 M ) n

x n e

j n j 2 nM

x n e

j n

X (e j )

x ( n)

A
n
N 2

N 2

Time-domain

Frequency-domain

Conclusion : Discrete nonperiodic function


Continuous-time periodic function
03/04/16

4) Conclusion
1 Sampling in time domain brings periodicity in frequency
domain.
2 Sampling in frequency domain brings periodicity in time
domain.

3 Relationship between frequency domain and time domain

Time domain

Frequency domain

Transform

Continuous periodic

Discrete nonperiodic

Fourier series

Continuous nonperiodic

Continuous nonperiodic

Fourier Transform

Continuous periodic

Sequences Fourier

Discrete nonperiodic
Discrete periodic

Discrete periodic

Transform
Discrete Fourier Series

Periodic Discrete; Nonperiodic Continuous


03/04/16

5) Basic idea of Discrete Fourier Transform


In practical application, signal processed by computer has two main characteristics:
(1) Discrete

(2) Finite length

Similarly, signals frequency must also have two main characteristics:


(1) Discrete

(2) Finite length

But nonperiodic sequences Fourier Transform is a continuous function of , and it


is a periodic function in with a period 2. So it is not suitable to solve practical
digital signal processing.
Idea:
Expand finite-length sequence to periodic sequence , compute its Discrete
Fourier Series, so that we can get the discrete spectrum in frequency domain.

03/04/16

10

2.2 Discrete Fourier Series


1) Discrete Fourier Series Transform Pair

Similar with continuous-time periodic signals, a periodic sequence x


% n with
period N, can be represented by a Fourier Series corresponding to a sum of
harmonically related complex exponential sequences, such as:

1
%
x n
N

N 1

jk n
%
X
k
e

2-1

k 0

2
where 1
% n 's fundamental angular frequency
, x
N
2
k
k, %
x n 's kth harmonic angular frequency
N
Attention: Fourier Series for discrete-time signal with period N requires
only N harmonically related complex exponentials.

Qe
03/04/16

2
kn
N

2
k (n N )
N

:that is k N k
11

X% k computation
computation

After multiplying both sides of Eq.(2-1) with e


from n 0 to N -1, we obtain
N 1

x% n e

n 0

N
1
N

2
kn
N

N 1 N 1

X% r e
n 0 r 0
N 1

e
n 0

2
r k n
N

N 1 N 1

X% r e

-j

2
kn
N

, and summing

2
2
rn j
kn
N
N

n 0 r 0

2
r k n
N

1
%
X r
r 0
N
N 1

2
r k N
N

1 1 e

2
j
r k
N
N
1 e
N 1

N 1

2
r k n
N

n 0

1r k mN

0otherwise

X% r X% k x% n e

2
kn
N

n0

03/04/16

12

Discrete Fourier Series for periodic sequence:


N 1

X% k DFS [ x% n ] x% n e

2
kn
N

n 0

1
%
x n IDFS [ X% k ]
N

N 1

X% k e
k 0

N 1

x% n W
n0

2
kn
N

kn
N

WN e

2
N

N 1

kn
%
X
k
W

N
n0

Attention:
2

N 1
N 1
j
( k mN ) n
j
kn
~
~
~
~
N
N
X ( k mN ) x ( n)e
x ( n)e
X (k )
n0

n 0

so: X%(k ) is also a periodic sequence with period N.


X%(k ) and x%( n) is a period sequence pair in frequency domain and time domain.

03/04/16

13

2) Properties of DFS
Suppose
DFS[ x%(n)] X%( k ) DFS[ %
y (n)] Y%( k )
1 Linear

~
~
~
~
DFS[ax ( n) by ( n)] aX ( k ) bY ( k )

2 Sequence Shift

DFS [ x%(n m)] WN km X%(k )


IDFS [ X%(k l )] W nl x%(n)
N 1

Proof : DFS [ x%(n m)] x%(n m)WNkn , let r n m :


n0

Then

N m 1

r m

km
N

W
03/04/16

x%(r )WNk r m WN km

N m 1

r m

x%(r )WNkr

N 1

kr
km %
%
%
x
(
r
)
W

DFS
[
x
(
n

m
)]

W
X (k )

N
N
r 0

14

2) Properties of DFS
Suppose
DFS[ x%( n)] X%( k ) DFS[ %
y ( n)] Y%( k )
3 Periodic Convolution

If
F%(k
) X%(k )Y%(k )

then
N 1

N 1

m0

m 0

%
f (n) IDFS [ F%(k )] x%(m) %
y (n m) %
y (m) x%(n m)
Periodic convolution
Compared with linear convolution, periodic convolutions main
difference is:

The sum is over the finite interval m=0~N-1.

03/04/16

15

Periodic convolution
N 1

%
f (n) x%(m) %
y ( n m)
m 0

N 1

%
f (0) x%(m) %
y (0 m) 1
m 0

N 1

%
f (1) x%(m) %
y (1 m) 0
m 0

N 1

%
f (2) x%(m) %
y (2 m) 1
m0

03/04/16

16

Symmetry:
Symmetry
%
If
f ( n) %
x ( n) %
y (n) then
1
%
%
F (k ) DFS [ f (n)]
N

N 1

1
%
%
X (l )Y (k l )

N
l 0

N 1

Y%(l )X%(k l )
l 0

Multiplication of periodic sequence in time-domain is


correspond to convolution of periodic sequence in
frequency domain.

03/04/16

17

Periodic sequence and its DFS


03/04/16

18

2.3 Discrete Fourier Transform-DFT


Periodic sequence and its DFS

03/04/16

19

HINTS
HINTS
Periodic sequence is infinite length.
but only N sequence values contain information.
Periodic sequence finite length sequence.
Relationship between these sequences?

Infinite Finite
Periodic Nonperiodic

03/04/16

20

2.3 Discrete Fourier Transform-DFT


Relationship between periodic sequence and finite-length sequence
Periodic sequence can be seen as periodically copies of finitelength sequence.
Finite-length sequence can be seen as extracting one period from
periodic sequence.

Finite-duration Sequence

Periodic Sequence

Main period
03/04/16

21

2.3 Discrete Fourier Transform-DFT


Suppose x(n) is a finite-length sequence; x%(n) is a periodic sequence;

x(n) x%(n) RN (n)


1,
RN (n) is a square-wave sequenceRN (n)
0,

x%(n)

otherwise

x(n rN ) x n

x 5 12 x 5

x 20 12 x 8

x 1 12 x 11

x(11)

we use (( n)) N to denote (n modulo N)

03/04/16

0 n N 1
x(0)

x(1)

x(10)

x(2)
x(3)

x(9)
x(8)
x(7)

x(4)
x(6)

x(5)

N 12
22

2.3 Discrete Fourier Transform


Computation of DFT by extracting one period of DFS
To a finite-length sequence

X k
DFT

x n :

DFS[x n N ]
Periodical
copies

RN (k )

DFS of periodic sequence


Get DFT by extracting one period of DFS

Attention DFT is acquired by extracting one period of


DFS, it is not a new kind of Fourier Transform.
03/04/16

23

finite-length sequence can be expressed in this way:


x(n) x%(n) RN (n)
N 1

X (k ) X%(k ) RN (k ) [ x((n)) N WNkn ]RN (k )


n 0

N 1

then
X (k ) x(n)WNkn 0 k N 1
n 0

1
then
x ( n)
N

N 1

kn
X
(
k
)
W
0 n N 1

N
k 0

Inverse Transform

X ( k ) N 1 x ( n)W kn

N 0 k N 1

DFT
DFTTransform
Transform

Pair
Pair

n0

1 N 1
x( n)
X ( k )W N kn
0 n N 1

N k 0

abbr. X (k ) DFT [ x(n)] x(n) IDFT [ X (k )]


03/04/16

24

Property of DFT
SupposeX ( k ) DFT [ x( n)]Y ( k ) DFT [ y ( n)]

(1) Linearity
DFT [ax (n) by (n)] aX (k ) bY (k )a, b are coefficient

(2) Circular Shift


Circular shift of x(n) can be defined:

xm (n) x((n m)) N RN (n)


x ( n)

03/04/16

Periodic
Copies

x%(n)

Shift

x%(n m)

Extract

Main period

xm (n)

x((n m)) N

25

x2(n)

N -3

Circular shift of sequence


03/04/16

Linear shift of sequence


26

X m (k ) DFT [ xm (n)] DFT [ x(( n m)) N RN (n)] WN mk X (k )


DFT [ x((n m)) N RN (n)] DFT [ x%(n m) RN (n)]
DFS [ x%(n m)]RN (k )
WN mk X%(k ) RN (k )
WN mk X (k )
Symmetric between DFT and IDFT

IDFT [ X ((k l )) N RN (k )] WNnl x(n)


03/04/16

27

3 Parsevals Theorem
N 1
1 N 1

x
(
n
)
y
(
n
)

X
(
k
)
Y
(k )

N k 0
n 0
When
x ( n) y ( n)

N 1

1
|
x
(
n
)
|

N
n 0
2

N 1

2
|
X
(
k
)
|

k 0

Conservation
Conservationof
ofenergy
energyin
intime
timedomain
domainand
andfrequency
frequencydomain.
domain.
N 1

1 N 1

Proof: x(n) y (n) x( n) [ Y (k )WN nk ]


N k 0
n 0
n0
N 1
1 N 1
x(n) [ Y (k )WNnk ]
N k 0
n 0
1 N 1 N 1
1 N 1
nk
Y (k ) x(n)WN X (k )Y (k )
N k 0
N k 0
n 0
03/04/16

N 1

28

4 Circular convolution
Suppose F ( k ) X (k )Y ( k )
N 1

thenf ( n) IDFT [ F (k )] x(m) y ((n m)) N RN (n)


m0

N 1

orf (n) y (m) x((n m)) N RN (n)


m0

Circular
convolution

Periodic convolution is convolution of two sequences with period


N in one period, so it is also a periodic sequence with period N.
Circular convolution is acquired by extracting one period of
periodic convolution, expressed by .

03/04/16

29

f 0

f 1

f 2

%
y 0 - m RN n

%
y 1 - m RN n

%
y 2 - m RN n

f(n)

03/04/16

Circular convolution

Periodic convolution

30

DFT [ x(n)] X (k )
DFT [ y (n)] Y (k )
IDFT [ X (k )Y (k )] x(n) y (n)
Circular convolution can be used to
compute two sequences linear
convolution.

03/04/16

31

5 Conjugate symmetric properties


a DFT of conjugate sequence
Suppose
x (n) is complex conjugate sequence of x(n) then
DFT [ x (n)] X ( N k ), 0 k N 1
N 1

ProofDFT [ x (n)] x (n)W

n0

nN
N

QW

j 2N nN

nk
N

N 1

[ x(n)WNn ( k ) ] , 0 k N 1
n 0

e j 2 n 1

N 1

DFT [ x ( n)] [ x(n)W W

n 0

nN
N

N 1

] [ x(n)WNn ( N k ) ]

n(k )
N

n0

X ( N k ), 0 k N 1
Attention X(k) has only k valid values 0k N-1

butwhen k 0X (( N 0)) N X (0)not X ( N ),


soDFT [ x (n)] X (( N k )) N RN (k ) in a strict way.
03/04/16

32

b DFT of sequences real and imaginary part


Suppose x(n)' s real and imaginary part are
xr ( n) and jxi (n)
thenx( n) xr ( n) jxi ( n)
1
1

xr (n) [ x(n) x ( n)],


jxi ( n) [ x( n) x ( n)]
2
2
xr (n) and jxi ( n)'s DFT are X e ( k ) and X o ( k ), then:
1
1

X e (k ) DFT [ xr (n)] DFT [ x(n) x (n)] [ X (k ) X ( N k )]


2
2
1
1

X o ( k ) DFT [ jxi (n)] DFT [ x(n) x (n)] [ X (k ) X ( N k )]


2
2
X (k ) X e (k ) X o (k )

03/04/16

33

Analysis of X e (k ) and X o (k )'s symmetric


1
Q X e (k ) [ X (k ) X ( N k )]
2
1
1

X e ( N k ) [ X ( N k ) X ( N N k )] [ X ( N k ) X (k )]
2
2
thenX e (k ) X e ( N k )

Xe(k) is even components of X(k), Xe(k) is conjugate symmetric;


that is real part is equal, imaginary part is opposite.

thenX o (k ) X o ( N k )
Xo(k) is odd components of X(k), Xo(k) is conjugate asymmetric;
that is real part is opposite, imaginary part is equal.

03/04/16

34

Xe(k)s real part


Xo(k)s real part

Xe(k)s imaginary part


XXe(k)
conjugate even part,
e(k) conjugate even part,
conjugate
conjugatesymmetric;
symmetric;
real
realpart
partisisequal,
equal,imaginary
imaginary
part
partisisopposite.
opposite.

03/04/16

Xo(k)s imaginary part


XXo(k)
conjugate odd part
o(k) conjugate odd part

conjugate
conjugateasymmetric;
asymmetric;
real
realpart
partis
isopposite,
opposite,imaginary
imaginary
part
partisisequal.
equal.
35

Conclusion
1 DFT of sequences real part is corresponding to X(k)s conjugate symmetric part.
2 DFT of sequences imaginary part is corresponding to X(k)s conjugate asymmetric
part.
3 Suppose x(n) is a real sequence, that is x(n)=xr(n),
then X(k) only has conjugate symmetric part, that is X(k) =Xe(k)

satisfy: X (k ) X ( N k )
N
N
X (0) X (0) X ( ) X ( )
2
2

So: If we get half X(k), we can acquire all X(k) using symmetric
properties.

03/04/16

36

DFT Programming Example


N 1

X (k ) x(n)WNkn
0 k N 1
n 0

X 0

X 1

x 0
M

X N 1

0 k N 1
W N0

0
N

1
N

W N0

W K
W
x 1 K x N 1 M
O

W N0 W NN-1 K

DFT Matrix

03/04/16

W N0

(N-1)(N-1)

WN

N-1
N

0 n N 1
37

function [Xk]=dft(xn)
N=length(xn);
n=0:N-1;
k=0:N-1;

%length of sequence
% time sample

WN=exp(-j*2*pi/N);
nk=n'*k;
WNnk=WN.^nk;

%calculate the DFT Matrix

Xk=xn*WNnk;

%compute DFT

More effective method.

03/04/16

38

Fs = 400;

% Get the analyzed signal

T = 1/Fs;
L = 1000;
t = (0:L-1)*T;
x = 0.7*sin(2*pi*50*t);
plot(1000*t(1:200),x(1:200));
Y = dft(x)/L;

% Discrete Fourier Transform

f = Fs/2*linspace(0,1,L/2+1);
stem(f,2*abs(Y(1:L/2+1)));

03/04/16

39

03/04/16

40

2.4 DFT, Sequences Fourier Transform and z-transform


Continuous
-time

Fourier Transform

X a j

Sequences Fourier
Transform

X e jw

DFS

X% k

xa ( t )
Sampling

Discretetime

x n xa ( nT )
Periodic Copies

x n N
Extract One period

x n

03/04/16

Extract One period


DFT

X k

41

Three
Three different
different frequency-domain
frequency-domain representations
representations of
of aa finitefinitelength
length discrete-time
discrete-time sequence
sequence
1. z-Transform

X (z)

N 1

x(n)z nx(n)
n 0

1
2

X ( z )z

n 1

dz

2. Sequences Fourier Transform

X (e )
jw

N 1

x(n)e

1
x ( n )
2

jwn

n 0

X (e

jw

)e

jwn

dw

z e jw

3. Discrete Fourier Transform (DFT)


N 1

X ( k ) x ( n)e

2
kn
N

W Nkn
0 k N 1,

n 0

1
x ( n)
N
03/04/16

N 1

X (k )e

2
kn
N

0 n N 1

k 0

42

jIm[z]

X ( k ) X ( z ) |z W k

X(k) and X(z) ?

W N2
W N1
W N0

W N ( N 1 )
W N ( N 2 )

X(k) and X(ejw) ?

z W N k e

2
k
N
N 1

X ( z ) x ( n) z n

Re[z]
X(k )

n0

N 1

kn
x
(
n
)
W
0 k N 1

N
n 0

N 1

X (e jw ) x(n)e jwn
n 0

X ( k ) X (e
03/04/16

2
k
N

43

Relationship between X ( k ) and X (e j )


03/04/16

44

2.5 Frequency sampling theorem

X (k ) X (e j ) or X ( z )
How to realize? Prerequisite for implementation?
What is interpolation formula?
1 Sampling
x(n)s z-transform:

X (z)

n
x
(
n
)
z

Regular interval sampling on unit circle:

X N (k ) X ( z ) |z W k
N

z WN k e
03/04/16

2
k
N

x(n)WNkn

Loss after sampling?


45

After sampling in frequency-domain, can we acquire sequence


representing x(n) by inverse transforming from X N(k)?

xN n IDFT X N k
xN n x%N n RN (n)


=
x n

x(n rN )R

(n) (Proof in page 78)

x~N ( n) is periodical copies of x(n), that is sampling in frequency

domain causes periodical copies of sequence in time-domain.

If we want to recover the finite-length sequence x(n) with no


loss after sampling in frequency domain, then it must be satisfied:
Suppose: M is number of points in time domain;
N is number of points in frequency domain.
Then: N M must be satisfied if we want to recovery x(n) with no
loss from

03/04/16

x~ N ( n) .
46

2 Interpolation formula
XN k

x n , n 1...M
M 1

XN k

X ( z ) x ( n) z n
n0

M 1

X (e ) x n e jn
j

n 0

N 1

X ( z ) X N (k ) k ( z ),
k 0

2
X (e ) X N ( k )
N

k 0
j

03/04/16

N 1

1 1 zN
k ( z)
N 1 WNk z 1

1 sin(N / 2)

e
k , ( )
N sin( / 2)

N 1

47

2.6 Computing sequences linear convolution with DFT


Objective
DFT or IDFT can be used to compute two sequences circular
convolution, and DFT, IDFT have their fast algorithm. So if we
can

build

the

relationship

between

two

sequences

circular

convolution and linear convolution, we can improve computation


speed of linear convolution by fast Fourier Transform algorithm.

03/04/16

48

Suppose x n is a length M sequence and h n is a length N sequence,


their linear convolution is:

M 1

Linear Convolution yl (n) x n h n x (m)h(n m)


m0

Circular Convolution

Zero padding x( n) and h( n) to the same length L, L max N , M , then

x(n), 0 n M 1
h(n), 0 n N 1
'
x ( n)
and h (n)
0, M n L 1
0, N n L 1
'

DFT x ' (n) X k DFT [h ' n ] H k Y k =X k H k

yc (n) IDFT Y k x(n)

h(n) x(m)h((n m)) N RL (n)


m0

What relationship between yl (n) and yc (n) ?


03/04/16

49

It can be proved that that the relationship between yl (n) and yc (n) is:

yc ( n )

yl ( n qL)RL n

which means L points circular convolution yc (n) is periodic copies


of yl (n) by extracting the main period.
And yl (n)'s length is N M 1.
so when L N M -1, two sequence's L points circular convolution
yc ( n) is exactly their linear convolution yl (n).

yc (n) x(n)

03/04/16

h(n)

yl (n) x n h n

50

h n , N 3

yl (n)

x n , M 5

L5

L6

L7

L8
03/04/16

51

Process

x ( n), 0 n M 1
M n L 1
0,

let x ' ( n)

h( n), 0 n N 1
N n L 1
0,

h ' (n)

Zero padding

x (n)

DFT

X(k)
X(k)H(k)

Zero padding

h(n)

DFT

IDFT

x(n) h(n)
x(n) h(n)

H(k)

Conclusion:
We can compute linear convolution using circular convolution if
length of DFTs satisfy L N M -1

03/04/16

52

Problems:
In practical application: y(n)=x(n)*h(n),
suppose x(n)s length is M h(n) length is N
Usually, M>>N, If L=N+M-1, then:
For short sequence: many zeros padded into h(n).
For long sequence: compute after all sequence input.
Difficulties Large memory, long computation time,
so real-time property can not be satisfied.
Solution: decomposition computation on long sequence.
After
After FFT
FFT algorithm,
algorithm, overlap-add
overlap-add method
method and
and over-lap
over-lap save
save
method
method will
will be
be learned.
learned.

Divided and Conquer


03/04/16

53

2.7 Spectrum analysis using DFT


Spectrum analysis DFT Computation

Discretization in time and


frequency domain

1) Process of spectrum analysis using DFT


xa ( t ) Sample

x n xa ( nT )

X a j

X k

DFT
N 1

x n W
n0

nk
N

(1) Approximation process.


(2) Error analysis.
(3) Important parameters.
03/04/16

54

Basic theory of Fourier Transform

Finite duration signal Infinite width frequency spectrum;

Finite width frequency spectrum Infinite duration signal.


In practice, finite duration signal with finite width spectrum does not
really exist.

Wide band signals Filtering fc fs/2

Infinite duration signals Extract finite points

Engineering application
Filter high frequency component with small amplitude.
Cut away signal component with small amplitude.
In below sections, all signals xa(t) are supposed to be finite-length,
band-limited signals after filtering and extracting.
03/04/16

55

2 Errors of spectrum analysis using DFT


Process of spectrum analysis using DFT
Sampling

Windowing

xa ( t ) x n x n x n w n
1 2

Xe

X e

Convolution

(1) Aliasing

X e *W e
j

X a j

X k
X e j

2
k
N

(2) Cutoff effect


(3) Fence effect
03/04/16

56

2 Errors of spectrum analysis using DFT


Process of spectrum analysis using DFT
xa ( t )
X a j

Sampling

x n xa ( nT )

X k

DFT
N 1

x n W
n 0

nk
N

(1) Aliasing Sampling f s 2 f c


If condition is not met: there will be spectrum distortion at fs/2;
Solution: increase fs, or using anti-aliasing pre-filtering.
In practical application, f s 3 : 5 f c

03/04/16

57

2 Errors of spectrum analysis using DFT


Process of spectrum analysis using DFT
Windowing

xa ( t ) x n x n x n w n
1 2

Xe

X e

X e *W e

Convolution

X a j

X k
X e j

2
k
N

2 Cutoff effect of DFT

03/04/16

58

Cutoff effect of DFT

Leakage

Disturbance

Amplitude of square-wave functions

cos( n) s spectrum before and after


4
windowing by square-wave function.
Solution: increase Sampling points N, or using other kind of
window function.
03/04/16

59

2 Errors of spectrum analysis using DFT


Process of spectrum analysis using DFT

x n

X a j

DFT

3 X k

X e j

xa ( t )

X e j

2
k
N

(3) Fence effect


N DFTN equal interval sampling of FT.
Spectrum function value is omitted between sampling points, N intervals.
Solution: Zero padding, or change sequences length, increase N.
03/04/16

60

3 DFT important parameters


Time-domain: fs, T, N, Tp; frequency domain F
f
1
1
FF fs s 1 1
NN NT
NT TTpp
Tp

X e j

Page 46: analog frequency fs/2


digital frequency
03/04/16

61

3 Important parameter of DFT


Some important conclusion
1
1
(1) F

Tp NT

ffs
11
11
s
FF

NN NT
NT TTp

(2) If N unchanged, F incensement can only be acquired by

lowering fs . So spectrum analysis scope will be small.


(3) fs unchanged, F incensement can only be acquired by
increase N, Tp=NT, that is increase sampling length.

03/04/16

62

3 Important parameter of DFT


Some important conclusion
1
1
(1) F

Tp NT

ffs
11
11
s
FF

NN NT
NT TTp

(2) If N unchanged, F incensement can only be acquired by

lowering fs . So spectrum analysis scope will be small.


(3) fs unchanged, F incensement can only be acquired by
increase N, Tp=NT, that is increase sampling length.

03/04/16

63

Procedure of spectrum analysis using DFT


Determine sampling rate f s by signals highest
frequency f .
c
Determine extracting length N by frequency
resolution.
Adjust parameters by DFT results.

03/04/16

64

DFT Programming Example


N 1

X (k ) x(n)WNkn
0 k N 1
n 0

X 0

X 1

x 0
M

X N 1

0 k N 1
W N0

0
N

1
N

W N0

W K
W
x 1 K x N 1 M
O

W N0 W NN-1 K

DFT Matrix

03/04/16

W N0

(N-1)(N-1)

WN

N-1
N

0 n N 1
65

function [Xk]=dft(xn)
N=length(xn);
n=0:N-1;
k=0:N-1;

% length of sequence
% time sample

WN=exp(-j*2*pi/N);
nk=n'*k;
WNnk=WN.^nk;

%calculate the DFT Matrix

Xk=xn*WNnk;

%compute DFT

More effective method?

03/04/16

66

Fs = 400;

% Get the analyzed signal

T = 1/Fs;
L = 1000;
t = (0:L-1)*T;
x = 0.7*sin(2*pi*50*t);
plot(1000*t(1:200),x(1:200));
Y = dft(x)/L;

% Discrete Fourier Transform

f = Fs/2*linspace(0,1,L/2+1);
stem(f,2*abs(Y(1:L/2+1)));

03/04/16

67

03/04/16

68

Matlab Example #2
f1=2Hz f2=2.05Hz
fs=10Hz
x(n)=sin(2f1n/fs)+ sin(2f2n/fs) N
f

f f 2 f1 0.05 Hz

F 0.05 Hz

11
11
f
ss
FF

NN NT
NT TTpp

fs
N N min 200
F
(1) N=128 x(n) X(k) ?
(2) N=256 x(n) X(k) ?
(3) N=512 x(n) X(k) ?

03/04/16

69

03/04/16

70

x(n) 0<=n<256

150
100
50

03/04/16

71

03/04/16

72

x(n) 0<=n<1024

03/04/16

73

Three Questions about Discrete Fourier Transform


Q1: WHAT is DFT?
WHAT is relationship between DFT and other kinds of Fourier
Transform?

Q2: WHY is DFT?


WHY we need DFT?

Q3: HOW to DFT?


HOW to realize DFT? How to use DFT to solve the practical
problems?
03/04/16

74

HOMEWORK

105 1
106 3,4
107 14

03/04/16

75

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