You are on page 1of 32

Signal Processing in Mechatronics

Summer semester, 2012

Lecture 4, Discrete Fourier Transform, Sampling Theorem, Aliasing

Dr. Zhu K.P. AIS, TUM

1
Fourier Analysis

a0
x(t ) = + ( an cos n0t +bn sin n0t )
2 n =1

Fourier Series
1 T2
cn = T x(t )e jn0t dt ( cn is complex generally.)
T 2

x(t ) = ce
n =
n
jn0 t
,(n = 0, 1, 2,...)

Fourier transform pair


X ( ) = x(t )e jt dt (Fourier transform)

1
x(t ) =
2
X ( )e jt d (Inverse Fourier transform)

2
Discrete Fourier Series

For discrete period signal x( n) , x( n) = x( n + kN )


2 Im
j n
e1 (n) = e N

2 2 90 1
j ( k + mN ) n j kn 120 60
ek + mN (n) = e N
=e N
= ek (n) 0.5
150 30
2 n
N 1
1 e j 2
e
j
N
= =0 180 0 Re
j 2 / N
n=0 1 e
210 330
Discrete Fourier series is finite because 240 300
only N of the harmonics are independent. 270

1 N 1 j 2 kn / N
ck = xn e ; k = 0,1,..., N 1 Example with N = 8 .
N n =0
N 1
xn = c e
k =0
k
j 2 kn / N

3
Fourier Analysis Summary

The basic premise of Fourier analysis is that any signal can be expressed as a linear
superposition, that is, a sum or integral of sinusoidal signals. The presence of an infinite
sum or integral prevents exact numerical computation of the corresponding transform.

4
5
2. The Discrete Fourier Transform (DFT)

Discrete Fourier Transform (DFT)


Given N consecutive samples x[n], 0 n N 1 of a periodic or aperiodic sequence, the
N-point Discrete Fourier Transform (DFT) X[k], 0 k N 1 is defined by

N 1
X k = xn e j 2 kn / N
n =0
The Inverse DFT
1 N 1
xn = X k e j 2 kn / N ; n = 0,1,..., N 1
N k =0

X[k] is a function of the discrete frequency index k, which corresponds to a discrete


set of frequencies k = (2/N), k = 0, 1, . . . ,N 1.

DFT is discrete both in time and frequency.

6
The Discrete Fourier Transform (DFT)

Where the complex quantity WN, known as the twiddle factor,

(W ) = ( e )
N N
j 2 k / N
k
N = e j 2 k = 1

Representation of the Nth roots of unity, for N = 3 and N = 6,

7
The Discrete Fourier Transform (DFT)

There are two important properties that make the DFT so eminently useful in signal
processing.
First, the N-point DFT provides a unique representation of the N-samples of a
finite duration sequence.
Second, the DFT provides samples of the DTFT of the sequence at a set of equally
spaced frequencies. This sampling process results in the inherent periodicity of the DFT.

Understanding the underlying periodicity of DFT is absolutely critical for the correct
application of DFT and meaningful interpretation of the results obtained.

We note that sampling in one domain is equivalent to periodization in the other domain.
Periodic replication may cause frequency-domain or time-domain aliasing.

8
9
DFT input sequence x(n) x(2)
x(3) x(1)
n n
N
x(n)
0 1 2 3 4 5 6 7 8
x(4) x(0)
NT

x(5) x(7)
x(6)
DFT output sequence X(k) X(2)
X(3) X(1)
k k
N
X(k)
0 1 2 3 4 5 6 7 8
X(4) X(0)
0=2 /NT

N0 X(5) X(7)
s
X(6)
N, k, n: N: points of input; k: the sequence number of spectrum X(k), n: the sequence
number of input x(n).
For N=8, s sampling frequency, 0 fundamental frequency X(7)= s 0
10
Examples:
Determine the N-point DFTs of the following sequences defined over 0 n < N.
(a) x[n] = 4 n, N = 8.
(b) x[n] = 4 sin(0.2n), N = 10.
(c) x[n] = 5(0.8)n, N = 16.

11
Example: The DFT of a Rectangular Pulse

x[n] is of length 5
We can consider x[n] of any length greater than 5
Lets pick N=5
Calculate the DFS of the periodic form of x[n]

j ( 2 k /5) n
4
X [k ] = e
n =0

1 e j 2 k
=
1 e ( )
j 2 k /5

5 k = 0, 5, 10,...
=
0 else

2
k
5

12
If we consider x[n] of length 10
We get a different set of DFT coefficients
Still samples of the DTFT but in different places

13
Amplitude and Phase Spectra of DFT

Learn to think in terms of vectors and arrays:


x = [ x0 x1 ... xN 1 ]
X = [X0 X 1 ... X N 1 ]

Amplitude spectrum = abs ( X ) = [| X 0 | | X 1 | | X N 1 |]

Phase spectrum = ( X ) = [ X 0 X 1 X N 1 ]

Power Spectrum (1)

0.2
xk

-0.2
0 50 100 150 200
k

14
Relative Power Spectrum (2)

| X |= amplitude spectrum. | X | power or energy spectrum.


2

Sometimes energy is measured in decibels: dB = 10log10 | X |


2

xk 0.2

-0.2
0 50 100 150 200
k
1 0
2
|Xm|

dB
0.5 -50

0 -100
0 50 100 0 50 100
m m

15
Linear Phase Shift of DFT

If a signal vector, x, is delayed (shifted to the right) k samples, then the phase of DFT{x}
is decreased by 2 mk / N rad.
Proof: Let x = [ x0 , x1 ,..., xN 1 ] . Let y be the delayed version of x so that
[ yk , yk +1 ,..., yN + k 1 ] = [ x0 , x1 ,..., xN 1 ] . The DFT of y is
N + k 1 2 mn N 1 2 m ( k + i ) 2 mk
j j j
Ym =
n=k
yn e N
= xi e
i =0
N
= X me N
;

m = 0,1,..., N 1.
(To get the second sum, we let i = n k .)
Thus, the phase angle of X m is decreased by 2 mk / N rad.
This is called linear phase shift because the phase shift is a linear function of m.

16
Linear Phase Shift Example

Example with N = 50 and k = 4 . The resulting phase shift is


2 mk 4 m
= samples, or kT = 4T radians.
N 25
0

X phase (rad)
1
xn

0.5 -10

0
-20
0 20 40 0 10 20
Sample (n) Index (m)
0
-2mk/N

Y phase (rad)
1
yn = xn-k

0.5 -10

0
-20
0 20 40 0 10 20
Sample (n) Index (m)

17
DTF Properties

18
3. The Fast Fourier Transform (FFT)

Not a new transform. Computes


N 1
DFT { x = [ x0 x1 ... xN 1 ]} = xn e j 2 kn / N ; k = 0,1, 2,..., N 1
n =0
j 2 / N
Repeated complex DFT products with W = e and N = 8 :

W6=W14=W22=...
90
1
120 60
0.8
W5=W13=W21=... 0.6
W7=W15=W23=...
150 30
0.4

0.2

W4=W12=W20=...180 0 W0=W8=W16=...

210 330

W3=W11=W19=... W1=W9=W17=...
240 300
270
W2=W10=W18=...

19
The Fast Fourier Transform (FFT)

If N = power of 2,
N
# complex products = log 2 N instead of N 2 .
2
10
10
flops

5
10

0
10
0 500 1000 1500 2000 2500
FFT size (N)

20
4. Fourier analysis of signals using the DFT

The application of DFT requires three steps: (a) sample the continuous-time signal,
(b) select a finite number of samples for analysis, and (c) compute the spectrum at a
finite number of frequencies.

1). Effects of time-windowing on sinusoidal signals


The operation of selecting a finite number of samples is equivalent to multiplying the
actual sequence x[n], defined in the range < n < , by a finite-length sequence w[n]
called a data window or simply a window.

21
The effects of rectangular windowing (truncation) on the spectrum of a sinusoidal signal. In this case,
windowing can be interpreted as modulation of a sinusoidal carrier by the window function.

22
Peak merging (loss of spectral resolution) when two spectral lines are closer than the
width of the mainlobe of the window.

23
2). Effects of time-windowing on signals with continuous spectra

The spectrum of a windowed aperiodic signal is obtained by taking the CTFT.


The result is the following convolution integral:

Thus, the Fourier transform of the windowed signal is obtained by convolving the Fourier
transform of the original signal with the Fourier transform of the window.

Approximate the integral using trapezoidal integration as follows:

24
The effects of
windowing on the
spectrum of an ideal
bandpass signal using a
sum of equally spaced
sinusoidal components:

(a) spectrum of infinite


duration signal,
(b) spectrum of
rectangular window,
(c) shifted copies of
window spectrum, and
(d) spectrum of
windowed signal.

25
Good windows and the uncertainty principle

In summary, time-windowing of a signal introduces two types of spectral distortion:

Smearing The predominant effect of the main lobe is to smear or spread the original
spectrum.
The result is loss of resolution. An ideal spectral line in the original spectrum
will have a width of about 2/T0 after windowing. Two equal amplitude sinusoids with
frequencies less than 2/T0 apart will blend with each other and may appear as a single
sinusoid.

Leakage The major effect of the side lobes is to transfer power from frequency bands
that contain large amounts of signal power into bands that contain little or no power. This
transfer of power, which is called leakage, may create false peaks (that is, peaks at
wrong frequencies), nonexisting peaks, or change the amplitude of existing peaks.

A good window should have a narrow main lobe (to minimize spectral spreading) and
low side lobes (to minimize spectral leakage). Unfortunately, as we show below, it is
impossible to satisfy both of these requirements simultaneously. This is a consequence
of the uncertainty principle of Fourier transforms.

26
27
5. Sampling theorem

Representation of the ideal analog-to-digital converter (ADC) or ideal sampler.

Three different continuous-time signals with the same set of sample values, that is, x[n] =
xc1(nT) = xc2(nT) = xc3(nT).
If T were decreased to 1, the sample vectors would differ.
In general, how small must the time step be in order to convey all the information in x(t ) ,
that is, in order to be able to recover x(t ) from its sample vector, x?

28
The Sampling Theorem

If a continuous signal is sampled at a rate greater than


twice its highest frequency component, it is possible to
recover the signal from its samples.

The proof of the sampling theorem lies in the following relationship. X is the Fourier
transform before sampling.
N 1
1 2 m
DFT { x} = xn e jnT
= X j
n =0 T m = T
The terms in the sum are disjoint (do not overlap) provided X ( j ) = 0 at and above
half the sampling rate, that is, for / T .
If this condition holds, then (with m = 0 ) X ( j ) = T * DFT( x) , and so
x(t ) = FT 1 { X ( j} is recoverable from the samples.

29
Terminology in sampling operation

The highest frequency FH, in Hz, present in a bandlimited signal xc(t) is called the Nyquist
frequency. The minimum sampling frequency required to avoid overlapping bands is 2FH,
which is called the Nyquist rate. The actual highest frequency that the sampled signal x[n]
contains is Fs/2, in Hz, and is termed as the folding frequency.

30
6. Aliasing

Frequency-domain
interpretation of uniform
sampling.

(a) Spectrum of continuous-


time bandlimited signal
xc(t),

(b) spectrum of discrete-


time signal x[n] = xc(nT)
with s > 2H, and

(c) spectrum of x[n],


showing aliasing distortion,
when s < 2H.

31
Lecture 4: Summary

The Discrete Fourier Transform (DFT) is a finite orthogonal transform which provides
a unique representation of N consecutive samples x[n], 0 n N 1 of a sequence
through a set of N DFT coefficients X[k].

The DFT does not provide any information about the unavailable samples of the
sequence, that is, the samples not used in the computation. The interpretation or physical
meaning of the DFT coefficients depends upon the assumptions we make about the
unavailable samples of the sequence.

The DFT is widely used in practical applications to determine the frequency content
of continuous-time signals (spectral analysis). The basic steps are: (a) sampling
the continuous-time signal, (b) multiplication with a finite-length window (Hann or
Hamming) to reduce leakage, (c) computing the DFT of the windowed segment.

The value of the DFT stems from its relation to the DTFT, its relation to convolution
operations, and the existence of very efficient algorithms for its computation.
These algorithms are collectively known as Fast Fourier Transform (FFT) algorithms.
The FFT is not a new transform; it is simply an efficient algorithm for computing
the DFT.

32

You might also like