Documente Academic
Documente Profesional
Documente Cultură
Introduction
The discrete Fourier Transform (DFT)
The DFT matrix
The Fast Fourier Transform (FFT)
The Short-time Fourier Transform (STFT)
Fourier Descriptors
Introduction
Similarity between time series
Suppose that you are to determine whether two time series () and
() are similar
x(k)
y(k)
If the inner product is large, then the two signals are very much in in
alignment
If the inner product is zero, the two signals are orthogonal
CSCE 666 Pattern Analysis | Ricardo Gutierrez-Osuna | CSE@TAMU
=1
then the Euclidean distance and the inner product are equivalent
Small distance large inner product
Large distance small inner product
For this reason, we will use the inner product for the rest of this lecture
Example
Assume the following time series
= 1,1, 1, 1,1,1 1, 1,1,1 1, 1,
= 1, 1,1, 1,1, 1,1, 1,1, 1,1, 1,
Compute their inner product
What can you say about their degree of similarity?
Since all inner products are zero, the three signals (x,y,z) are
orthogonal, and therefore independent
Thus, linear combinations of these signals defines a subspace with
three dimensions
= 1 + 2 + 3
x
y
z
a1
a2
u
v
a3
+
=
+ = , ( + )
+
=
Example
Recall the two signals on slide 2
x(k)
y(k-100)
The cross correlation function reveals that one signal is very close (in
our case identical ) to a delayed version of the other
1
0.8
0.6
Rxy()
0.4
0.2
0
-0.2
-0.4
-200
-150
-100
-50
50
100
150
200
Example II
x(k) = randn(1000,1)
x(k) = 100sin(20.01k)
100
2
50
x(k)
x(k)
0
-1
-2
-50
-3
100
200
300
400
500
600
700
800
900
1000
-100
100
200
300
400
500
600
700
800
900
1000
k
1
0.8
0.5
0.6
Rxx()
Rxx()
0.4
0.2
-0.5
0
-200
-150
-100
-50
50
100
150
200
-200
-150
-100
-50
50
100
150
200
2ft = , 2ft
which you can recognize as the inner product between our signal
() and the complex sine wave 2ft
Recall Eulers formula = cos sin
And the inner product of functions and being defined as
, =
10
2ft = , 2ft
11
12
2
,
, = 0,1,2 1
=0
So the DFT is (again) the inner product of our signal [] with a sine
wave
13
()
#.
So, the longer the recording, the better the frequency resolution
[Sethares, 2007]
14
=
= cos 2 sin 2
Then, the DFT can be expressed as
1
=0
1
1
1
2
= 1
2(1)
2(1)
(1)(1)
0
1
2
1
15
X[0]
X[1]
X[2]
X[3]
=
X[4]
X[5]
X[6]
X[7]
X[8]
x[0]
x[1]
x[2]
x[3]
x[4]
x[5]
x[6]
x[7]
x[8]
16
where the solid line represents the real part and the dashed line represent
the imaginary part of the corresponding sine wave
Note how this illustration brings us back to the definition of the DFT as an
inner product between our signal [] and a complex sine wave
Illustration borrowed from http://en.wikipedia.org/wiki/DFT_matrix
CSCE 666 Pattern Analysis | Ricardo Gutierrez-Osuna | CSE@TAMU
17
Example I
Sampling rate = 2
Signal () = sin(210)
2
Recording length 1 sec
x(t)
1
0
-1
-2
5
0.1
0.2
0.3
0.5
t (sec)
0.6
0.7
0.8
0.9
Symmetry around /2
-5
-10
0
0.4
20
40
60
80
100
10
|X(f)|
0
-5
-10
/2 (Nyquist rate)
0
200
400
600
800
18
Example II
Sampling rate = 2
Signal () = 10sin(210) + 3sin(2100)
Recording length 1 sec
15
10
()
5
0
-5
-10
-15
0
0.1
0.2
0.3
0.4
0.5
t (sec)
0.6
0.7
0.8
0.9
20
40
60
80
100
f (Hz)
120
140
160
180
200
|()|
10
5
0
-5
-10
0
19
20
21
[Sethares, 2007]
22
Windowing
The window function serves several purposes
It localizes the Fourier Transform in time, by considering only a short time
interval in the signal
By having a smooth shape, it minimizes the effects (e.g., high side lobes)
of chopping the signal into pieces
By overlapping windows, it provides spectral continuity across time
23
, =
= ,
=0
24
Example I
FS = 2kHz
Two concatenated sine waves
FFT
1024 points
490
0.8
390
0.6
0.4
1
290
SFTF (Hz)
X(f)
0.2
x(t)
-1
-0.2
-0.4
200
-2
-0.6
-3
100
-0.8
-4
-1
50
100
time (sa.)
150
200
-5
0
0
100
200
300
frequency (Hz)
400
500
time (frames)
25
Example II
FS = 10kHz
Voiced speech
5000
4000
0.5
x(t)
SFTF (Hz)
3000
2000
0
1000
-0.5
0
1000
2000
time (sa.)
50
100
150
time (frames)
200
50
100
150
200
250
time (frames)
26
Fourier descriptors
Problem definition
Consider the object below, with contour defined in terms of the
coordinates of N points along its periphery
We assume that these points are ordered (e.g., CW or CCW)
(x0,y0)
(x1,y1)
(x4,y4)
(x2,y2)
(x3,y3)
27
= =
=1
Properties of U(n)
Translation ( + ) only affects the first FD ((0) (0) + )
Scaling by a factor ( ) scales all FDs accordingly ( )
Rotation by an angle , results in a phase shift ( )
Changing the starting point by positions ([] [ + ]), also
results in a phase shift () 2/ ()
28
Original
shape
n=1..5
n=1..13
n=1..25
n=1..65
[Krzyzak et al. 1988]
29