CMU SCS Indexing and Mining Biological Images Christos Faloutsos CMU.
310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos...
Transcript of 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos...
![Page 1: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/1.jpg)
C. Faloutsos 15-826
1
15-826: Multimedia Databases and Data Mining
Lecture #21: DSP tools –DFT – Discrete Fourier Transform
C. Faloutsos
1
15-826 Copyright (c) 2019 C. Faloutsos 2
Problem
Goal: given a signal (eg., sales over time and/or space)
Q: Find patterns and/or compress
year
count
2
![Page 2: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/2.jpg)
C. Faloutsos 15-826
2
15-826 Copyright (c) 2019 C. Faloutsos 3
Solutions:
Goal: given a signal (eg., sales over time and/or space)
Q: Find patterns and/or compress
year
count
actual mean mean+freq12
A1: Fourier (DFT)
A2: Wavelets (DWT)
3
15-826 Copyright (c) 2019 C. Faloutsos 4
Must-read Material
• DFT/DCT: In PTVF ch. 12.1, 12.3, 12.4; in Textbook Appendix B.
• Wavelets: In PTVF ch. 13.10; in MM Textbook Appendix C
4
![Page 3: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/3.jpg)
C. Faloutsos 15-826
3
15-826 Copyright (c) 2019 C. Faloutsos 5
Outline
Goal: ‘Find similar / interesting things’• Intro to DB• Indexing - similarity search• Data Mining
5
15-826 Copyright (c) 2019 C. Faloutsos 6
Indexing - Detailed outline• primary key indexing• ..• Multimedia –
– Digital Signal Processing (DSP) tools• Discrete Fourier Transform (DFT)• Discrete Wavelet Transform (DWT)
6
![Page 4: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/4.jpg)
C. Faloutsos 15-826
4
15-826 Copyright (c) 2019 C. Faloutsos 7
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
7
15-826 Copyright (c) 2019 C. Faloutsos 8
Introduction
Goal: given a signal (eg., sales over time and/or space)
Find: patterns and/or compress
year
countlynx caught per year
8
![Page 5: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/5.jpg)
C. Faloutsos 15-826
5
15-826 Copyright (c) 2019 C. Faloutsos 9
What does DFT do?
A: highlights the periodicities
9
15-826 Copyright (c) 2019 C. Faloutsos 10
Why should we care?
A: several real sequences are periodicQ: Such as?
10
![Page 6: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/6.jpg)
C. Faloutsos 15-826
6
15-826 Copyright (c) 2019 C. Faloutsos 11
Why should we care?
A: several real sequences are periodicQ: Such as?A:
– sales patterns follow seasons;– economy follows 50-year cycle– temperature follows daily and yearly cycles
Many real signals follow (multiple) cycles
11
15-826 Copyright (c) 2019 C. Faloutsos 12
Why should we care?
For example: human voice!• Frequency analyzer
http://www.relisoft.com/freeware/freq.html• speaker identification• impulses/noise -> flat spectrum• high pitch -> high frequency
12
![Page 7: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/7.jpg)
C. Faloutsos 15-826
7
15-826 Copyright (c) 2019 C. Faloutsos 13
‘Frequency Analyzer’
time
frequency
13
15-826 Copyright (c) 2019 C. Faloutsos 14
DFT: definition
• Discrete Fourier Transform (n-point):
inverse DFT
€
X f =1/ n xt *exp(− j2π f t /n)t=0
n−1
∑ f = 0,...,n −1
( j = −1)
xt =1/ n X f *exp(+ j2π f t /n)f =0
n−1
∑
14
![Page 8: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/8.jpg)
C. Faloutsos 15-826
8
(Reminder)
(fun fact: the equation with the 5 most important numbers:
)15-826 Copyright (c) 2019 C. Faloutsos 15
€
exp(φ * j) = cos(φ) + j *sin(φ)
€
e jπ +1 = 0
f
Re
Im
15
15-826 Copyright (c) 2019 C. Faloutsos 17
DFT: definition
• Good news: Available in all symbolic math packages, eg., in ‘mathematica’x = [1,2,1,2];X = Fourier[x];Plot[ Abs[X] ];
17
![Page 9: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/9.jpg)
C. Faloutsos 15-826
9
15-826 Copyright (c) 2019 C. Faloutsos 18
DFT: examples
flat
0.000
0.010
0.020
0.030
0.040
0.050
0.060
0.070
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0
0.20.4
0.60.8
11.2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time freq
AmplitudePlot[ Abs[Fourier[x]] ];
18
15-826 Copyright (c) 2019 C. Faloutsos 19
DFT: examples
Low frequency sinusoid
-0.150
-0.100
-0.050
0.000
0.050
0.100
0.150
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0
0.20.4
0.60.8
11.2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time freq
19
![Page 10: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/10.jpg)
C. Faloutsos 15-826
10
15-826 Copyright (c) 2019 C. Faloutsos 20
DFT: examples
• Sinusoid - symmetry property: Xf = X*n-f
-0.150
-0.100
-0.050
0.000
0.050
0.100
0.150
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0
0.20.4
0.60.8
11.2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time freq
20
15-826 Copyright (c) 2019 C. Faloutsos 21
DFT: examples
• Higher freq. sinusoid
-0.080-0.060-0.040-0.0200.0000.0200.0400.0600.080
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
00.10.20.3
0.40.50.6
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
time freq
21
![Page 11: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/11.jpg)
C. Faloutsos 15-826
11
15-826 Copyright (c) 2019 C. Faloutsos 22
DFT: examples
examples
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
=
+
+
22
15-826 Copyright (c) 2019 C. Faloutsos 23
DFT: examples
examples
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
00.20.40.6
0.81
1.2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Freq.
Ampl.
23
![Page 12: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/12.jpg)
C. Faloutsos 15-826
12
15-826 Copyright (c) 2019 C. Faloutsos 24
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
24
15-826 Copyright (c) 2019 C. Faloutsos 25
How does it work?Decomposes signal to a sum of sine (and
cosine) waves.Q:How to assess ‘similarity’ of x with a
wave?
0 1 n-1 time
valuex ={x0, x1, ... xn-1}
details
…
25
![Page 13: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/13.jpg)
C. Faloutsos 15-826
13
15-826 Copyright (c) 2019 C. Faloutsos 26
How does it work?
A: consider the waves with frequency 0, 1, ...; use the inner-product (~cosine similarity)
0 1 n-1 time
value
freq. f=0
0 1 n-1 time
valuefreq. f=1 (sin(t * 2 p/n) )
details
26
15-826 Copyright (c) 2019 C. Faloutsos 27
How does it work?
A: consider the waves with frequency 0, 1, ...; use the inner-product (~cosine similarity)
0 1 n-1 time
value
freq. f=2
details
27
![Page 14: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/14.jpg)
C. Faloutsos 15-826
14
15-826 Copyright (c) 2019 C. Faloutsos 28
How does it work?‘basis’ functions(vectors)
0 1 n-1
01 n-1
0 1 n-1sine, freq =1
sine, freq = 2
0 1 n-1
0 1 n-1
cosine, f=1
cosine, f=2
details
28
15-826 Copyright (c) 2019 C. Faloutsos 29
How does it work?
• Basis functions are actually n-dim vectors, orthogonal to each other
• ‘similarity’ of x with each of them: inner product
• DFT: ~ all the similarities of x with the basis functions
details
29
![Page 15: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/15.jpg)
C. Faloutsos 15-826
15
15-826 Copyright (c) 2019 C. Faloutsos 30
DFT: definition
• Good news: Available in all symbolic math packages, eg., in ‘mathematica’x = [1,2,1,2];X = Fourier[x];Plot[ Abs[X] ];
30
15-826 Copyright (c) 2019 C. Faloutsos 31
DFT: definition
(variations:• 1/n instead of 1/sqrt(n)• exp(-...) instead of exp(+...)
31
![Page 16: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/16.jpg)
C. Faloutsos 15-826
16
15-826 Copyright (c) 2019 C. Faloutsos 32
DFT: definition
Observations:• Xf : are complex numbers except
– X0 , who is real• Im (Xf ): ~ amplitude of sine wave of
frequency f• Re (Xf ): ~ amplitude of cosine wave of
frequency f• x: is the sum of the above sine/cosine waves
32
Intuition behind Xf - ‘phasors’
15-826 Copyright (c) 2019 C. Faloutsos 33
more details
33
![Page 17: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/17.jpg)
C. Faloutsos 15-826
17
15-826 Copyright (c) 2019 C. Faloutsos 34
DFT: definition
• Discrete Fourier Transform (n-point):
inverse DFT
€
X f =1/ n xt *exp(− j2π f t /n)t=0
n−1
∑ f = 0,...,n −1
( j = −1)
xt =1/ n X f *exp(+ j2π f t /n)f =0
n−1
∑
more details
34
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 35
n=180
0 1 179
xt
IBM stock
more details
35
![Page 18: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/18.jpg)
C. Faloutsos 15-826
18
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 36
xt
IBM stock
€
X f =1/ n xt *exp(− j2π f t /n)t=0
n−1
∑ f = 0,...,n −1
( j = −1)
xt =1/ n X f *exp(+ j2π f t /n)f =0
n−1
∑
f
Re
Im
X1: A1 exp(j f)
X1
more details
36
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 37
xt
IBM stock
€
X f =1/ n xt *exp(− j2π f t /n)t=0
n−1
∑ f = 0,...,n −1
( j = −1)
xt =1/ n X f *exp(+ j2π f t /n)f =0
n−1
∑
f
Re
Im
X1: A1 exp(j f)
X1
t=1
Rotationas t =0, …
more details
37
![Page 19: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/19.jpg)
C. Faloutsos 15-826
19
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 38
€
X f =1/ n xt *exp(− j2π f t /n)t=0
n−1
∑ f = 0,...,n −1
( j = −1)
xt =1/ n X f *exp(+ j2π f t /n)f =0
n−1
∑
f
Re
Im
X1: A1 exp(j f)
X1
t=1
Rotationas t =0, …
Each Xf: phasor, ierotating complex number ->Generates a wave of• Amplitude Af• Phase ff• Frequency f
more details
38
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 39
Re
Im Each Xf: phasor, ierotating complex number ->Generates a wave of• Amplitude Af• Phase ff• Frequency f• By its projection on Re• (and another, imaginary, on Im
• But those cancel out
tAf See en.wikipedia.org/wiki/Phasor
more details
39
![Page 20: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/20.jpg)
C. Faloutsos 15-826
20
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 40
Re
Im
tAf
Re
Im
tA f
more details
40
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 41
Re
Im
tA 1
X1
X2
Re
Im
t
A 2
….
(every 2nd tick)
more details
41
![Page 21: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/21.jpg)
C. Faloutsos 15-826
21
Phasors – intuition behind Xf
15-826 Copyright (c) 2019 C. Faloutsos 42
….R
e
Im tA 1
X1
X2R
e
Im t
A 2X179
X0
Sum:
more details
42
15-826 Copyright (c) 2019 C. Faloutsos 43
43
![Page 22: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/22.jpg)
C. Faloutsos 15-826
22
15-826 Copyright (c) 2019 C. Faloutsos 44
DFT: definition
Observation - SYMMETRY property:Xf = (Xn-f )*
( “*”: complex conjugate: (a + b j)* = a - b j )
details
44
15-826 Copyright (c) 2019 C. Faloutsos 45
DFT: definition
Definitions• Af = |Xf | : amplitude of frequency f• |Xf |2 = Re(Xf )2 + Im(Xf )2 = energy of
frequency f • phase ff at frequency f
Xf
Re
Im Afff
45
![Page 23: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/23.jpg)
C. Faloutsos 15-826
23
15-826 Copyright (c) 2019 C. Faloutsos 46
DFT: definition
Amplitude spectrum: | Xf | vs f (f=0, 1, ... n-1)
0 1 n-1
SYMMETRIC (Thus, we plot the first half only)
details
46
15-826 Copyright (c) 2019 C. Faloutsos 47
DFT: definition
Phase spectrum | ff | vs f (f=0, 1, ... n-1):Anti-symmetric
(Rarely used)
details
47
![Page 24: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/24.jpg)
C. Faloutsos 15-826
24
15-826 Copyright (c) 2019 C. Faloutsos 48
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
48
15-826 Copyright (c) 2019 C. Faloutsos 49
DFT: examples
examples
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
00.20.40.6
0.81
1.2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Freq.
Ampl.
49
![Page 25: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/25.jpg)
C. Faloutsos 15-826
25
15-826 Copyright (c) 2019 C. Faloutsos 50
DFT: Amplitude spectrum
actual mean mean+freq12
1 12 23 34 45 56 67 78 89 100
111
year
count
Freq.
Ampl.
freq=12
freq=0
)(Im)(Re 222fff XXA +=Amplitude:
50
15-826 Copyright (c) 2019 C. Faloutsos 51
DFT: Amplitude spectrum
actual mean mean+freq12
1 12 23 34 45 56 67 78 89 100
111
year
count
Freq.
Ampl.
freq=12
freq=0
51
![Page 26: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/26.jpg)
C. Faloutsos 15-826
26
15-826 Copyright (c) 2019 C. Faloutsos 52
1 12 23 34 45 56 67 78 89 100
111
DFT: Amplitude spectrum
actual mean mean+freq12
year
count
Freq.
Ampl.
freq=12
freq=0
52
15-826 Copyright (c) 2019 C. Faloutsos 53
DFT: Amplitude spectrum
• excellent approximation, with only 2 frequencies!
• so what?
actual mean mean+freq12
1 12 23 34 45 56 67 78 89 100
111
Freq.
53
![Page 27: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/27.jpg)
C. Faloutsos 15-826
27
15-826 Copyright (c) 2019 C. Faloutsos 54
DFT: Amplitude spectrum
• excellent approximation, with only 2 frequencies!
• so what?• A1: compression• A2: pattern discovery• (A3: forecasting)
54
15-826 Copyright (c) 2019 C. Faloutsos 55
DFT: Amplitude spectrum
• excellent approximation, with only 2 frequencies!
• so what?• A1: (lossy) compression• A2: pattern discovery 1 12 23 34 45 56 67 78 89 10
0
111
55
![Page 28: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/28.jpg)
C. Faloutsos 15-826
28
15-826 Copyright (c) 2019 C. Faloutsos 56
DFT: Amplitude spectrum
• excellent approximation, with only 2 frequencies!
• so what?• A1: (lossy) compression• A2: pattern discovery
actual mean mean+freq12
56
15-826 Copyright (c) 2019 C. Faloutsos 57
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
57
![Page 29: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/29.jpg)
C. Faloutsos 15-826
29
15-826 Copyright (c) 2019 C. Faloutsos 58
DFT: Amplitude spectrum
• Let’s see it in action (defunct now…)• (http://www.dsptutor.freeuk.com/jsanalyser/FFTSpectrumAnalyser.html)
• plain sine• phase shift• two sine waves• the ‘chirp’ function• http://ion.researchsystems.com/
58
15-826 Copyright (c) 2019 C. Faloutsos 59
Plain sine
59
![Page 30: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/30.jpg)
C. Faloutsos 15-826
30
15-826 Copyright (c) 2019 C. Faloutsos 60
Plain sine
60
15-826 Copyright (c) 2019 C. Faloutsos 61
Plain sine – phase shift
61
![Page 31: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/31.jpg)
C. Faloutsos 15-826
31
15-826 Copyright (c) 2019 C. Faloutsos 62
Plain sine – phase shift
62
15-826 Copyright (c) 2019 C. Faloutsos 63
Plain sine
63
![Page 32: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/32.jpg)
C. Faloutsos 15-826
32
15-826 Copyright (c) 2019 C. Faloutsos 64
Two sines
64
15-826 Copyright (c) 2019 C. Faloutsos 65
Two sines
65
![Page 33: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/33.jpg)
C. Faloutsos 15-826
33
15-826 Copyright (c) 2019 C. Faloutsos 66
Chirp
66
15-826 Copyright (c) 2019 C. Faloutsos 67
Chirp
67
![Page 34: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/34.jpg)
C. Faloutsos 15-826
34
15-826 Copyright (c) 2019 C. Faloutsos 68
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
68
Properties
• Time shift sounds the same– Changes only phase, not amplitudes
• Sawtooth has almost all frequencies– With decreasing amplitude
• Spike has all frequencies
15-826 Copyright (c) 2019 C. Faloutsos 69
69
![Page 35: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/35.jpg)
C. Faloutsos 15-826
35
15-826 Copyright (c) 2019 C. Faloutsos 70
DFT: Parseval’s theorem
sum( xt2 ) = sum ( | X f | 2 )
Ie., DFT preserves the ‘energy’or, alternatively: it does an axis rotation:
x0
x1x = {x0, x1}
70
15-826 Copyright (c) 2019 C. Faloutsos 71
DFT: Parseval’s theorem
sum( xt2 ) = sum ( | X f | 2 )
Ie., DFT preserves the ‘energy’or, alternatively: it does an axis rotation:
x0
x1x = {x0, x1}
71
![Page 36: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/36.jpg)
C. Faloutsos 15-826
36
15-826 Copyright (c) 2019 C. Faloutsos 72
DFT: Parseval’s theorem
sum( xt2 ) = sum ( | X f | 2 )
= 𝑒"#$%&'
𝑥)𝑥*⋮𝑥'⋮
𝑋)𝑋*⋮𝑋&⋮
… equivalently, matrix F (= 𝟏
𝒏𝒆"𝒋𝟐𝝅𝒇𝒕 )
is row-orthonormalRow: fColumn: t
F
72
15-826 Copyright (c) 2019 C. Faloutsos 73
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
73
![Page 37: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/37.jpg)
C. Faloutsos 15-826
37
15-826 Copyright (c) 2019 C. Faloutsos 74
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?
0 1 time
value
1
details
74
15-826 Copyright (c) 2019 C. Faloutsos 75
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) =
1/2• X1=?• X2=?• X3=?
details
75
![Page 38: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/38.jpg)
C. Faloutsos 15-826
38
15-826 Copyright (c) 2019 C. Faloutsos 76
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) =
1/2• X1= -1/2 j• X2= - 1/2• X3= + 1/2 j• Q: does the ‘symmetry’ property hold?
details
76
15-826 Copyright (c) 2019 C. Faloutsos 77
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) = 1/2• X1= -1/2 j• X2= - 1/2• X3= + 1/2 j• Q: does the ‘symmetry’ property hold?• A: Yes (of course)
details
77
![Page 39: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/39.jpg)
C. Faloutsos 15-826
39
15-826 Copyright (c) 2019 C. Faloutsos 78
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) =
1/2• X1= -1/2 j• X2= - 1/2• X3= + 1/2 j• Q: check Parseval’s theorem
details
78
15-826 Copyright (c) 2019 C. Faloutsos 79
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) =
1/2• X1= -1/2 j• X2= - 1/2• X3= + 1/2 j• Q: (Amplitude) spectrum?
details
79
![Page 40: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/40.jpg)
C. Faloutsos 15-826
40
15-826 Copyright (c) 2019 C. Faloutsos 80
Arithmetic examples• Impulse function: x = { 0, 1, 0, 0} (n = 4)• X0=?• A: X0 = 1/sqrt(4) * 1* exp(-j 2 p 0 / n ) = 1/2• X1= -1/2 j• X2= - 1/2• X3= + 1/2 j• Q: (Amplitude) spectrum?• A: FLAT!
80
15-826 Copyright (c) 2019 C. Faloutsos 81
Arithmetic examples• Q: What does this mean?
81
![Page 41: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/41.jpg)
C. Faloutsos 15-826
41
15-826 Copyright (c) 2019 C. Faloutsos 82
Arithmetic examples• Q: What does this mean?• A: All frequencies are equally important ->
– we need n numbers in the frequency domain to represent just one non-zero number in the time domain!
– “frequency leak”
82
15-826 Copyright (c) 2019 C. Faloutsos 83
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
83
![Page 42: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/42.jpg)
C. Faloutsos 15-826
42
15-826 Copyright (c) 2019 C. Faloutsos 84
Observations• DFT of ‘step’ function:
x = { 0, 0, ..., 0, 1, 1, ... 1}
t
xt
84
15-826 Copyright (c) 2019 C. Faloutsos 85
Observations• DFT of ‘step’ function:
x = { 0, 0, ..., 0, 1, 1, ... 1}
t
xt
f = 0
85
![Page 43: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/43.jpg)
C. Faloutsos 15-826
43
15-826 Copyright (c) 2019 C. Faloutsos 86
Observations• DFT of ‘step’ function:
x = { 0, 0, ..., 0, 1, 1, ... 1}
t
xt
f = 0
f=1
86
15-826 Copyright (c) 2019 C. Faloutsos 87
Observations• DFT of ‘step’ function:
x = { 0, 0, ..., 0, 1, 1, ... 1}
t
xt
f = 0
f=1•the more frequencies,
the better the approx.
•‘ringing’ becomes worse
•reason: discontinuities; trends
87
![Page 44: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/44.jpg)
C. Faloutsos 15-826
44
15-826 Copyright (c) 2019 C. Faloutsos 88
Observations• Ringing for trends: because DFT ‘sub-
consciously’ replicates the signal
t
xt
88
15-826 Copyright (c) 2019 C. Faloutsos 89
Observations• Ringing for trends: because DFT ‘sub-
consciously’ replicates the signal
t
xt
89
![Page 45: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/45.jpg)
C. Faloutsos 15-826
45
15-826 Copyright (c) 2019 C. Faloutsos 90
Observations• Ringing for trends: because DFT ‘sub-
consciously’ replicates the signal
t
xt
90
15-826 Copyright (c) 2019 C. Faloutsos 91
original
91
![Page 46: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/46.jpg)
C. Faloutsos 15-826
46
15-826 Copyright (c) 2019 C. Faloutsos 92
DC and 1st
92
15-826 Copyright (c) 2019 C. Faloutsos 93
And 2nd
DC and 1st
93
![Page 47: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/47.jpg)
C. Faloutsos 15-826
47
15-826 Copyright (c) 2019 C. Faloutsos 94
And 3rd
DC and 1st
And 2nd
94
15-826 Copyright (c) 2019 C. Faloutsos 95
And 4th
DC and 1st
And 3rd
And 2nd
95
![Page 48: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/48.jpg)
C. Faloutsos 15-826
48
15-826 Copyright (c) 2019 C. Faloutsos 96
Observations• Q: DFT of a sinusoid, eg.
xt = 3 sin( 2 p / 4 t)(t = 0, ... , 3)• Q: X0 = ?• Q: X1 = ?• Q: X2 = ? • Q: X3 = ?
96
15-826 Copyright (c) 2019 C. Faloutsos 97
Observations• Q: DFT of a sinusoid, eg.
xt = 3 sin( 2 p / 4 t)(t = 0, ... , 3)• Q: X0 = 0• Q: X1 = -3 j• Q: X2 = 0 • Q: X3 = 3j
•check ‘symmetry’•check Parseval
97
![Page 49: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/49.jpg)
C. Faloutsos 15-826
49
15-826 Copyright (c) 2019 C. Faloutsos 98
• Q: DFT of a sinusoid, eg.xt = 3 sin( 2 p / 4 t)
(t = 0, ... , 3)• Q: X0 = 0• Q: X1 = -3 j• Q: X2 = 0 • Q: X3 = 3j
Observations
•Does this make sense?
f
Af
0 1 2
98
15-826 Copyright (c) 2019 C. Faloutsos 99
• Shifting x in time does NOT change the amplitude spectrum
• eg., x = { 0 0 0 1} and x’ = { 0 1 0 0 }: same (flat) amplitude spectrum
• (only the phase spectrum changes)• Useful property when we search for patterns
that may ‘slide’
Property
99
![Page 50: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/50.jpg)
C. Faloutsos 15-826
50
Summary of properties• Spike in time: -> all frequencies
• Step/Trend: -> ringing (~ all frequencies)
• Single/dominant sinusoid: -> spike in spectrum
• Time shift -> same amplitude spectrum
15-826 Copyright (c) 2019 C. Faloutsos 100
100
15-826 Copyright (c) 2019 C. Faloutsos 101
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
101
![Page 51: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/51.jpg)
C. Faloutsos 15-826
51
15-826 Copyright (c) 2019 C. Faloutsos 102
DCTDiscrete Cosine Transform • motivation#1: DFT gives complex numbers• motivation#2: how to avoid the ‘frequency
leak’ of DFT on trends?
t
xt
details
102
15-826 Copyright (c) 2019 C. Faloutsos 103
DCT• brilliant solution to both problems: mirror
the sequence, do DFT, and drop the redundant entries!
t
xt
details
103
![Page 52: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/52.jpg)
C. Faloutsos 15-826
52
15-826 Copyright (c) 2019 C. Faloutsos 104
DCT• (see Numerical Recipes for exact formulas)
details
104
15-826 Copyright (c) 2019 C. Faloutsos 105
DCT - properties• it gives real numbers as the result• it has no problems with trends• it is very good when xt and x (t+1) are
correlated
(thus, is used in JPEG, for image compression)
105
![Page 53: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/53.jpg)
C. Faloutsos 15-826
53
15-826 Copyright (c) 2019 C. Faloutsos 106
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
106
15-826 Copyright (c) 2019 C. Faloutsos 107
2-d DFT
• Definition:
åå-
=
-
=
--=1
0222111
1
0,
21,
1
1
2
1
2121)/2exp()/2exp(11 n
i
n
iiiff nfijnfijx
nnX pp
107
![Page 54: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/54.jpg)
C. Faloutsos 15-826
54
15-826 Copyright (c) 2019 C. Faloutsos 108
2-d DFT• Intuition:
n1
n2
do 1-d DFT on each row
and then1-d DFTon each column
108
15-826 Copyright (c) 2019 C. Faloutsos 109
2-d DFT
• Quiz: how do the basis functions look like?• for f1= f2 =0• for f1=1, f2=0• for f1=1, f2=1
109
![Page 55: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/55.jpg)
C. Faloutsos 15-826
55
15-826 Copyright (c) 2019 C. Faloutsos 110
2-d DFT
• Quiz: how do the basis functions look like?• for f1= f2 =0 flat• for f1=1, f2=0 wave on x; flat on y• for f1=1, f2=1 ~ egg-carton
110
15-826 Copyright (c) 2019 C. Faloutsos 111
2-d DFT
• Quiz: how do the basis functions look like?• for f1= f2 =0 flat• for f1=1, f2=0 wave on x; flat on y• for f1=1, f2=1 ~ egg-carton
111
![Page 56: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/56.jpg)
C. Faloutsos 15-826
56
15-826 Copyright (c) 2019 C. Faloutsos 112
DSP - Detailed outline• DFT
– what– why– how – Arithmetic examples– properties / observations– DCT– 2-d DFT– Fast Fourier Transform (FFT)
112
15-826 Copyright (c) 2019 C. Faloutsos 113
FFT• What is the complexity of DFT?
)/2exp(*/1
)1(
)/2exp(*/1
1
0
1
0
ntfjXnx
j
ntfjxnX
n
tft
n
ttf
p
p
+=
-=
-=
å
å
-
=
-
=
details
113
![Page 57: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/57.jpg)
C. Faloutsos 15-826
57
15-826 Copyright (c) 2019 C. Faloutsos 114
FFT• What is the complexity of DFT?
• A: Naively, O(n2) )/2exp(*/1
)1(
)/2exp(*/1
1
0
1
0
ntfjXnx
j
ntfjxnX
n
tft
n
ttf
p
p
+=
-=
-=
å
å
-
=
-
=
details
114
15-826 Copyright (c) 2019 C. Faloutsos 115
FFT• However, if n is a power of 2 (or a number
with many divisors), we can make it O(n log n)
Main idea: if we know the DFT of the odd time-ticks, and of the even time-ticks, we can quickly compute the whole DFT
Details: in Num. Recipes
details
115
![Page 58: 310 DSP DFT - Carnegie Mellon School of Computer Science · Title: 310_DSP_DFT Author: Christos Faloutsos school2 Created Date: 10/30/2019 7:42:58 AM](https://reader035.fdocuments.in/reader035/viewer/2022080717/5f78301a1dd0e67f7943f669/html5/thumbnails/58.jpg)
C. Faloutsos 15-826
58
15-826 Copyright (c) 2019 C. Faloutsos 116
DFT - Conclusions• It spots periodicities (with the ‘amplitude
spectrum’)• can be quickly computed (O( n log n)),
thanks to the FFT algorithm.• standard tool in signal processing (speech,
image etc signals)actual mean mean+freq12
1 12 23 34 45 56 67 78 89 100
111
Freq.
116
15-826 Copyright (c) 2019 C. Faloutsos 117
Solutions:
Goal: given a signal (eg., sales over time and/or space)
Q: Find patterns and/or compress
year
count
actual mean mean+freq12
A1: Fourier (DFT)
A2: Wavelets (DWT)
✔
117