Vous êtes sur la page 1sur 11

MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L.

San Andrs 2013




1
MEEN 617 Handout 3
A Super Brief Introduction to the Discrete Fourier Transform
Original from Dr. J oe-Yong Kim (ME 459/659), modified by Dr. Luis San Andrs (MEEN 617, J an 2013).
This handout is a pale substitution for the detailed and elegant discussion presented in your textbook.
TheDiscreteFourierTransform
The Fourier Transform (FT) and its inverse FT are defined as

( ) ( )
2 i t
t
F f e dt
te
e

=
}
, (1)

( ) ( )
2
1
2
i t
t
f F e d
te
e
e
t

=
}
(2)
Above note the integrals are evaluated over infinite limits.

Consider the set { }
0,1,..., 1
n
n N
x
=
recorded at discrete times
{ } ( )
0 1 0 2 0 1 0
, , 2 ,...., 1
n N
t t t t t t t t t t t N

= = + A = + A = + A , where N is the number of samples acquired.



The Discrete Fourier Transform (DFT) of a spatially or time sampled series x
n
is

1
2
0
e , 0,..., 1
mn
N
i
N
m n
n
X x m N
t
| |


|
\ .
=
= =

. (3)
and the inverse DFT is

1
2
0
1
e , 0,..., 1
mn
N
i
N
n m
m
x X n N
N
t
| |

|
\ .
=
= =

. (4)

Note the DFT and its inverse are the discrete form of a truncated FT.

The vector { } ( )
0,..., 1
m m m
m N
X a i b
=
= + is complex.

Presently, the DFT and inverse DFT can be calculated fast and efficiently by using various Fast
Fourier Transform (FFT) algorithms. (e.g., the fft command in Matlabor MATCAD)

The DFT shows that,
* * *
0 1 1 2 2 3
, ,...., ,...
N N N
X X X X X X

= = = where (*) denotes the complex
conjugate,( )
m m
a i b .

MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


2
In practice, software usually delivers a vector of N values (shifted), i.e.,
( ) ( )
0 1 1 2 1 1 1 1
, ;.....; ; ;
2
k N k N N k N k
N
X X X X X X X X k
+
= = = = =

(5)


The maximum frequency (f
max
) of the DFT of a time series {x
n
}
n=0, N_1
sampled at At satisfies the
Nyquist Sampling Theorem, i.e.,

sample
max
1
2 2
f
f
t
s =
A
. (6)
There are k=N data points in the frequency spectrum (complex numbers). Since the maximum
frequency is f
max
=f
sample
/2, the frequency resolution (Af) equals

sample
1 1 1
time record length
f
f
N N t T
A = = = =
A
. (7)

Example 1
Figure 1(a) below shows x
(t)
=1 sin(et), with e=2tf, f=22 Hz, sampled at 100 Hz (samples/s) or
At=0.01 s, and the number of points is N=256 (T
max
=2.55 s). Note that At <<0.045 s, the period of
the f=22 Hz wave.
Figure 1(b) shows the amplitude of the DFT,
2
0,..., 1
N m
m
X
=
versus frequency. The maximum
frequency in the DFT is f
max
=50 Hz with a step of
1
f
t N
A =
A
=0.391 Hz. The number of frequencies
in the DFT is 128. Note the amplitude of the DFT |X
m
| shows components at other frequencies than
22 Hz.
The DFT is a collection of k= N complex numbers, i.e., it is a discrete set (not continuous).
Figure 1(c) graphs the real and imaginary parts of the DFT X
m
.
*
f
req
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0
0.391
0.781
1.172
1.563
1.953
2.344
2.734
3.125
3.516
3.906
4.297
4.688
5.078
5.469
5.859
Hz = X
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
4.92110
-3
9.84310 +1.683i10
-3 -4
9.84810 +3.368i10
-3 -4
9.85610 +5.059i10
-3 -4
9.86710 +6.758i10
-3 -4
9.88210 +8.468i10
-3 -4
9.910 +1.019i10
-3 -3
9.92110 +1.193i10
-3 -3
9.94510 +1.369i10
-3 -3
9.97410 +1.548i10
-3 -3
0.01+1.729i10
-3
0.01+1.913i10
-3
0.01+2.101i10
-3
0.01+2.292i10
-3
0.01+2.488i10
-3
0.01+2.688i10
-3
=


MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


3
.
0 0.051 0.1 0.15 0.2 0.26
1.2
0.6
0
0.6
1.2
X(t)
sampled
wave form (actual and sampled w window
time (s)
S
i
g
n
a
l

X
(
t
)
*
T
max
2.55s =

Fig. 1(a): 22 Hz signal sampled at 100 samples/s.
0 6 12 18 24 30 36 42 48 54 60
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequency (Hz)
F
F
T

m
a
g
n
i
t
u
d
e
f
1
f
max
*
N
P
256 =
Af 0.391Hz =
f
max
50Hz =
f
1
22Hz =
max A ( ) 0.843 =

Fig. 1(b): amplitude of DFT for 22 Hz signal sampled at 100 samples/s.
0 10 20 30 40 50 60 70 80 90 100
5
0
5
10
Real
Frequency (Hz)
F
F
T

r
e
a
l
max Re_X ( ) 0.456 =
min Re_X ( ) 0.206 =
0 20 40 60 80 100
0.5
0
0.5
1
Imag
Frequency (Hz)
F
F
T

i
a
m
g
i
n
a
r
y
max Im_X ( ) 0.709 =
min Im_X ( ) 0.334 =

Fig. 1(c): Real and imaginary parts of DFT for 22 Hz signal sampled at 100 samples/s.

MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


4

The ideal case should be a single amplitude X=1 at 22 Hz and 0s at all other frequencies. This ideal
representation only occurs when sampling at a frequency that is a multiple of the signal frquency, as
shown in Fig 1(d) for sampling at 88 Hz.
0 10 20 30 40 50 60 70 80 90 100
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequency (Hz)
F
F
T

m
a
g
n
i
t
u
d
e
f
1
f
max
*
Arate 88Hz =
N
P
32 =
Af 2.75Hz =
f
1
22Hz = max A ( ) 1 =

Fig. 1(d): amplitude of DFT for 22 Hz signal sampled at 88 samples/s.
f
req
T
1 2 3 4 5 6 7 8 9 10
1 0 2.75 5.5 8.25 11 13.75 16.5 19.25 22 24.75
Hz =
X
T
1 2 3 4 5 6 7 8 9 10
1 0 0 0 0 0 0 0 0 1 0
=

Notes
1) increasing the number of recorded data points N, while keeping the same sampling rate,
increases the total time (T) for sampling, but has no impact on the span of the frequency
range (f
max
is the same), only on Af that decreases (the frequency resolution increases).
2) increasing the sampling rate (f
sample
) while keeping N extends the span of the frequency range
(f
max
= f
sample
), and also increases the frequency step Af (decreases resolution, it makes Af
larger). Increasing f
sample
, decreases the total elapsed time for measurement.

The table below shows verifies the relationships f
max
= f
sample
and (f
max
/Af ) =k= N.

N f
sample
(Hz) f
max
(Hz) Af (Hz) T (s)
2
5
=32 40 20 1.250 0.775
2
6
=64 40 20 0.625 1.575
2
7
=128 40 20 0.313 3.175
2
6
=64 40 20 0.625 1.575
2
6
=64 80 40 1.250 0.788
2
6
=64 160 80 2.500 0.394






MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


5
ALIASING
Figure 2(a) shows the same function x
(t)
=1 sin(et), with e=2tf, f=22 Hz, sampled at 30 Hz
(samples/s) or At=0.033 s, and the number of points is N=2
8
=256 (T
max
=8.5 s). Note that At ~0.045s,
the period of the 22 Hz wave.

0 0.053 0.11 0.16 0.21 0.27 0.32 0.37 0.42
1.2
0.6
0
0.6
1.2
X(t)
sampled
wave form (actual and sampled w window
time (s)
S
i
g
n
a
l

X
(
t
)
*
N
P
256 =
Arate 30s
-1
=
At 0.033s =
f
1
22Hz =
1
f
1
0.045s =
T
max
8.5s =

Fig. 2(a): 22 Hz wave sampled at 30 samples/s.
As shown in Fig. 2(b) depicting the amplitude of the DFT, when a 22 Hz sinusoidal signal is sampled
at 30 Hz, the sampled data can be misinterpreted as an 8 Hz sinusoidal signal. This is referred to as
aliasing. Thus, the sampling frequency should be at least 44 samples/s (22 Hz Nyquist) in order
to avoid this problem.

0 4 8 12 16 20 24 28 32 36 40
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequency (Hz)
F
F
T

m
a
g
n
i
t
u
d
e
f
1
f
max
*
N
P
256 =
Af 0.117Hz =
f
max
15Hz =
f
1
22Hz =
max A ( ) 0.89 =


Fig. 2(a): DFT of 22 Hz wave sampled at 30 samples/s.








MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


6
Leakage
Consider a case where a continuous signal with main frequency 12 Hz is sampled at a frequency
of 100 samples/s, and the number of the total sampled data is N =32, as shown in Fig. 3(a). Note in
Fig, 3(b) the amplitude of the DFT with components at other frequencies than 12 Hz, including 0
frequency.
0 0.052 0.1 0.16 0.21 0.26 0.31
1.2
0.6
0
0.6
1.2
X(t)
sampled
wave form (actual and sampled w window
time (s)
S
i
g
n
a
l

X
(
t
)
*
N
P
32 =
Arate 100s
-1
=
At 0.01s =
f
1
12Hz =
1
f
1
0.083s =
T
max
0.31s =

Fig. 3(a): 12 Hz wave sampled at 100 samples/s.
0 10 20 30 40 50 60 70 80 90 100
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequency (Hz)
F
F
T

m
a
g
n
i
t
u
d
e
f
1
f
max
*
N
P
32 =
Af 3.125Hz =
f
max
50Hz =
f
1
12Hz =
max A ( ) 0.963 =

Fig. 3(b): Amplitude of DFT for 12 Hz wave sampled at 100 Hz.
The amplitudes at near zero-frequencies (i.e., the first data points in Fig. 18-3) show leakage and
is caused by the truncation of time data. That is, the time data at t =0 and t =T have non-zero
amplitudes, see Fig. 3(a).

To reduce the truncation error and leakage effect, a Hanning window
1
is introduced. The
window is defined as

1 2
1 cos
2
m
m
H
N
t ( | |
=
| (
\ .
. (8)
and displayed below in Fig. 4.

1
There are many different types of windows or windowing procedures. Refer to a more advanced resource for details on
their implementation and accuracy.
MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


7
0 8 16 24 32
0
0.5
1
H k ( )
k
N
P
32 =

Fig. 4. Hanning window with 32 data points.
Figure 5 shows the signal data set x
n
weighted with the Hanning window. The DFT of a windowed
time data is

1
2
0
mn
N
i
N
m n n
n
X w x e
t
| |


|
\ .
=
=

, (9)
where w
n
represents the window function. Based on the window function, two constants are defined
as
1 1
2
1 2
1 1
and
N N
n n
n n
w w o o

= =
= =

(10)

0 0.052 0.1 0.16 0.21 0.26 0.31
1.12
0.56
0
0.56
1.12
X(t)
sampled
wave form (actual and sampled w window
time (s)
S
i
g
n
a
l

X
(
t
)
*
N
P
32 =
Arate 100s
-1
=
At 0.01s =
f
1
12Hz =
T
max
0.31s =

Fig. 5: Sampled 12 Hz wave (100 samples/s) with Hanning window.
At t =0 and t =T, the amplitude of the signal =0. In the frequency domain, as shown in Fig. 6, the
leakage of the windowed data is smaller than that for the original data (see Fig. 3(b)), although the
frequency resolution of the windowed data is lower than the original data (i.e., the peaks of the
windowed data become broader than the original data).

MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


8
0 10 20 30 40 50 60 70 80 90 100
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Frequency (Hz)
F
F
T

m
a
g
n
i
t
u
d
e
f
1
f
max
*
N
P
32 =
Af 3.125Hz =
f
max
50Hz =
f
1
12Hz =
max A ( ) 0.492 =


Fig. 6: Amplitude of DFT with Hanning window for 12 Hz wave sampled at 100 Hz.

SpectrumandSpectralDensity
All experimental data contains noise. Spectral averaging is applied to reduce the effects of noise.
The cross-spectrum of two signals X and Y is (think of a dot product or projection of one signal
onto the other)

*
2
1
2
m
m m
xy
X Y
S
o
= ,
0,1,...,
2
N
m k = =
(11)
where X
m
*
is the complex conjugate of X
m
.

The auto-spectrum is also defined as

*
2
1
2
m
m m
xx
X X
S
o
= .
0,1,...,
2
N
m k = =
(12)
The cross-spectral density is defined as

*
sample 2
2
CSD
m
m m
xy
X Y
f o
= .
0,1,...,
2
N
m k = =
(13)
The cross spectral density is the spectrum per unit frequency interval.
MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


9
SpectralEstimation

Fig. 7: Averaging process of time data.

Based on the procedure shown in Fig. 7, when the maximum number of averaging is N
a
, the spectral
averaging process is represented as

( )
1
1
a
N
xx xx m
m
a
S S
N
=
=

. (14)
When the statistical properties of a signal do NOT change with respect to time, the signal is
referred to as astationary signal. Thus, (random) noise effects can be reduced by using a time
averaging process, as shown in Fig. 7 and Eq. (14) for any stationary signals.



MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


10
TransferFunctionEstimation
Figure 8 shows a single input and single output (SISO) system with transfer function H.

Fig. 8: Depiction of SISO system with transfer function H.
x: input, y: output, and n: noise
In an ideal case without measurement noise, the transfer function is expressed as

( )
( )
Y
H
X
e
e
= . (15)
where
( ) ( )
( )
t
X DFT x
e
= and
( ) ( )
( )
t
Y DFT y
e
= .However, when noise components n
x
and n
y
are
present at the input and output of the system, one records the input and output signals as
( ) ( )
( ) ( ) ( ) ( )
,
t t
t t x t t y
x x n y y n = + = + , respectively. Hence, the transfer function becomes

( )
( )
( )
( ) ( )
( ) ( )
y
x
Y Y N
H
X X N
e e e
e
e e e
+
= =
+
. (16)
Here, the estimated transfer function is biased due to the noise.

To estimate an accurate transfer function, the noise components must be suppressed. Two types of
transfer function estimators are introduced. The first type uses a cross-spectral correlation with
respect to the input.


( )
( )
( ) ( )
( ) ( )
*
*
1 * *
y x x y
x x x x
xy xn n y n n x y
m
xx xn n x n n
x x
S S S S X Y X N Y N
H
S S S S X X X N X N
+ + + + +
= = =
+ + +
+ +
. (17)

When the input x
(t)
and output y
(t)
are not correlated with either noise (input) n
x
and (output) n
y
,
( )
0, 0, 0, 0
y x x x
xn n y xn n x
S S S S = = = = , and further the noise (n
x
, n
y
) are not correlated to each other
( )
0
x y
n n
S =
, the estimator of the transfer function can be simplified, after taking the time average, as

1
x x
xy
m
xx n n
S
H
S S
=
+
. (18)

Similarly, the second type of estimator uses the cross-spectral correlation with respect to the
MEEN 617-HD# 3 A brief introduction to the Fast Fourier Transform L. San Andrs 2013


11
output


( )
( )
( ) ( )
( ) ( )
*
*
2 * *
y y y y
x y y x
yy yn n y n n y y
m
yx yn n x n n
y x
S S S S Y Y Y N Y N
H
S S S S Y X
Y N X N
+ + + + +
= = =
+ + +
+ +
. (19)

It can be simplified to
2 *
y y
yy n n
m
xy
S S
H
S
+
= . (20)
This estimator has no bias error if the noise is present only in the input signal (x); i.e., 0
y y
n n
S ~ .
Thus, the second type estimator becomes
2 *
yy
m
xy
S
H
S
= . (21)
This estimator is good at resonance frequencies of a system where the output signal has a large
signal to noise ratio (SNR).

Similarly, the first kind estimator has no bias error when the uncorrelated noise is present only in
the output signal (y), i.e., 0
x x
n n
S ~ .
Then, the first type estimator becomes

1
xy
m
xx
S
H
S
= . (22)
This estimator is good at anti-resonance frequencies of a system.

Final note:
More on estimations of transfer functions for actual physical systems (experimental data) will follow
as the class progresses.