Signal Processing Lihi Zelnik-Manor #4 Fourier Transform of 1D signals
Outline for today • The Fourier Transform – Continuous signals • Periodic • Non-periodic
– Discrete signals
Periodic signals • A Fourier series represents a wave-like signal as a (possibly infinite) sum of sines and cosines (i.e., complex exponentials)
A simple periodic signal • A very simple periodic signal is a sine wave:
x(t ) a sin 0t • Complex signals can also be periodic:
x(t ) ae
j0t
A sum of periodic signals • Q: What will we get from a finite sum of periodic signals? N
x(t ) ak e
jk t
k 1
• Ans: This is also a periodic signal • Note: We are only using frequencies 𝜔𝑘 = 𝑘𝜔0 where 𝜔0 is a constant
An infinite sum of periodic signals • Q: What will we get from an infinite sum of periodic signals?
x(t ) ak e
jk t
k 1
• Ans: It turns out that if
a k k 1
then 𝑥(𝑡) is well defined
• Such signals have more than one frequency
Fourier series • A periodic signal with period 𝑇0 can be described mathematically like this: 𝑥(𝑡 + 𝑛𝑇0 ) = 𝑥(𝑡) • Fourier showed that any complex periodic signal can be decomposed as: ∞
𝑎𝑘 𝑒 𝑗𝑘𝜔0𝑡
𝑥(𝑡) = 𝑘=−∞
Where 𝜔0 = 2 𝜋 𝑇0 and 1 𝑎𝑘 = 2𝜋
𝜋
𝑥(𝑡)𝑒 −𝑗𝑘𝜔0 𝑡 𝑑𝑡 −𝜋
Triangular wave 1 coefficients
The Fourier series for a triangular wave is: ( 1)( n 1)/2 n t x(t ) 2 sin 2 n 1,3,5... n L 8
2 coefficients
1
1
0.5
0.5
0
0
-0.5
-0.5
-1 -2
-1
0
1
2
-1 -2
5 coefficients 1
0.5
0.5
0
0
-0.5
-0.5
-1
0
0
1
2
1
2
20 coefficients
1
-1 -2
-1
1
2
-1 -2
-1
0
Error Graph MSE
1 M
f ( x) triangular 𝑥(𝑡)
Infinite _ error max triangular 𝑥(𝑡) f ( x)
2
period
period
Infinite error Vs. coefficients number
Mean square error Vs. coefficients number -3
5
x 10
0.2
4.5
0.18
4
0.16
3.5
0.14
3
0.12
2.5
0.1
2
0.08
1.5
0.06
1
0.04
0.5
0.02
0
0 0
20
40
60
80
100
0
20
40
60
80
100
Rectangular Wave The Fourier series for a square wave is: 1 n t x(t ) sin n 1,3,5... n L 4
5 coefficients
2 coefficients
1 coefficients 2
2
2
1
1
1
0
0
0
-1
-1
-1
-2 -2
0
2
-2 -2
0
2
-2 -2
2
2
2
1
1
1
0
0
0
-1
-1
-1
-2 -2
0
2
-2 -2
0
2
500 coefficients
50 coefficients
15 coefficients
0
2
-2 -2
0
2
Error Graph 1 MSE M
f ( x) SquareWave 𝑥(𝑡)
2
Infinite _ error max SquareWave 𝑥(𝑡) f ( x) period
period Mean square error Vs. number of coefficients
Infinite error Vs. coefficients number
0.2
1
0.18
0.9
0.16
0.8
0.14
0.7
0.12
0.6
0.1
0.5
0.08
0.4
0.06
0.3
0.04
0.2
0.02
0.1
0
0
500
1000
0
0
500
1000
Fourier series • A periodic signal with period 𝑇0 can be described mathematically like this: 𝑥(𝑡 + 𝑛𝑇0 ) = 𝑥(𝑡) • Fourier showed that any complex periodic signal can be decomposed as: ∞
𝑎𝑘 𝑒 𝑗𝑘𝜔0𝑡
𝑥(𝑡) = 𝑘=−∞
Where 𝜔0 = 2 𝜋 𝑇0 and 1 𝑎𝑘 = 2𝜋
𝜋
𝑥(𝑡)𝑒 −𝑗𝑘𝜔0 𝑡 𝑑𝑡 −𝜋
What are the frequencies? • Q: How can we tell what frequencies 𝜔𝑘 = 𝑘𝜔0 a signal has?
• We can easily visualize the frequencies via the following continuous function: ∞ a0 A( ) a 1 a2 𝐴(𝜔) = 2𝜋 𝑎𝑘 𝛿(𝜔 − 𝑘𝜔0 ) a 1 a 𝑘=−∞
2
What are the frequencies? • Using some mathematical tricks we can re-write our signal as: 1 𝑥(𝑡) = 2𝜋
∞
𝐴(𝜔)𝑒 𝑗𝜔𝑡 𝑑𝜔 −∞
• We could do this because 𝐴(𝜔) is a sum of deltas
What are the frequencies? 𝑥(𝑡)
𝐴(𝜔)
Non-periodic signals • The Fourier Integral represents non-periodic signals as a “sum” of periodic signals (complex exponents): 1 𝑥(𝑡) = 2𝜋
∞
X(𝜔)𝑒 𝑗𝜔𝑡 𝑑𝜔 −∞
• The Fourier Transform defines the coefficients X(𝜔): ∞
𝑥(𝑡)𝑒 −𝑗𝜔𝑡 𝑑𝑡
X 𝜔 = −∞
Some important notes • The Fourier Integral and the Fourier transform are not always the inverse of each other
• When both 𝑥(𝑡) and X 𝜔 are absolutely integrable then the inversion holds. (but also it could work for other functions)
Fourier examples Temporal domain cos(2𝜋𝑎𝑡) 𝑡
𝜔
𝑡
𝜔
cos(2𝜋𝑏𝑡)
Fourier examples Temporal domain Π(𝑡) 𝜔
𝑡
G𝑎𝑢𝑠𝑠(𝑡, 𝜎)
G𝑎𝑢𝑠𝑠(𝜔, 1/𝜎) 𝑡
G𝑎𝑢𝑠𝑠(𝑡, 1/𝜎) 𝑡
𝜔
G𝑎𝑢𝑠𝑠(𝜔, 𝜎) 𝜔
Fourier transform example 𝑋(𝜔) 𝑥(𝑡)
arg{𝑋 𝜔 }
Fourier Transforms
Fourier Series (FS) Fourier Transform (FT)
Time Continuous, Periodic Continuous, Infinite
Frequency Discrete, Infinite Continuous, Infinite
Discrete-Time FT (DTFT) Discrete FT (DFT)
Discrete, Infinite Discrete, Finite / periodic
Continuous, Periodic Discrete, Finite / periodic
Discrete Time FT (DTFT) • For any discrete signal we define its DTFT as: ∞
𝑥[𝑛]𝑒 −𝑗𝑛𝛺
𝑋(𝛺) = 𝑛=−∞
• 𝛺 is measured in radians. • We can relate it to frequency 𝑓 in Hz by: 𝛺 = 2𝜋/𝑓 • The DTFT is defined only when ∞
|𝑥[𝑛]| < ∞ 𝑛=−∞
DTFT example • Lets take for example a right-hand exponent 𝑥 𝑛 = • If we’ll compute its DTFT we’ll get 𝑋 𝛺 = • We can plot this:
𝑋 Ω • You can see it is periodic
1 𝑛 𝛼
𝑛≥0
1 1−𝛼𝑒 −𝑗𝜔
arg{𝑋 Ω }
𝑋(Ω)
Discrete Time FT (DTFT) • DTFT is always periodic: 𝑋 𝛺 = 𝑋 𝛺 + 2𝜋𝑘 • This is true since 𝑒 −𝑗𝑛2𝜋𝑘 = 1 for any integers 𝑘, 𝑛
• This means that knowing 𝑋 𝛺 in the interval 𝛺 = [−𝜋, 𝜋] suffices
DTFT and FT
Sampling audio signals • Q: The standard CD recording sampling rate is 𝑓𝑠𝑎𝑚 =44.1kHz. Why? • Ans: – The range [−𝜋, 𝜋] for 𝛺 corresponds to the range [−0.5𝑓𝑠𝑎𝑚 , 0.5𝑓𝑠𝑎𝑚 ] in kHz – For CD’s this means [−22.05, +22.05]kHz – Our ears can only hear up to ~20kHz, so 22.05kHz suffices Recall: 𝛺 = 2𝜋/𝑓
Inverse Discrete Time FT (DTFT) • (sometimes) We can obtain a signal from its DTFT: 1 𝜋 𝑥𝑛 = 𝑋(𝛺)𝑒 𝑗𝛺𝑛 𝑑𝛺 2𝜋 −𝜋 • This is actually a Fourier series analysis
Time-Frequency scale • Narrow in time wide in frequency 𝑋(𝛺)
𝛺
• And vice versa for 𝑥 𝑛 = 1 we get 𝑋(𝛺) =2𝜋δ(𝛺)
DTFT of real x[n] • Magnitude is symmetric • Phase is anti-symmetric
Fourier Transforms
Fourier Series (FS) Fourier Transform (FT)
Time Continuous, Periodic Continuous, Infinite
Frequency Discrete, Infinite Continuous, Infinite
Discrete-Time FT (DTFT) Discrete FT (DFT)
Discrete, Infinite Discrete, Finite / periodic
Continuous, Periodic Discrete, Finite / periodic
Discrete FT (DFT) • A finite or periodic discrete signal has only N unique values • Its spectrum can be defined by N discrete frequency samples 1 𝑥[𝑛] = 𝑁
𝑁−1
𝑋[𝑘]𝑒 𝑗𝑛𝑘𝛺0 𝑘=0
𝑁−1
𝑥[𝑛]𝑒 −𝑗𝑛𝑘𝛺0
𝑋[𝑘] = 𝑛=0
DFT and DTFT • DFT
𝑋[𝑘] =
• DTFT
𝑋(𝛺) =
𝑁−1 −𝑗𝑛𝑘𝛺0 𝑥[𝑛]𝑒 𝑛=0 ∞ −𝑗𝑛𝛺 𝑥[𝑛]𝑒 𝑛=−∞
• DFT “samples” DTFT at discrete frequencies
𝑋(𝛺)
𝛺 = 𝑘𝛺0
𝑋(𝛺) 𝛺
DFT and DTFT
DFT, DTFT and FT
Some cool Fourier facts • Energy (sum of squares) is the same in each domain – Rayleigh’s theorem (Parseval)
• Temporal shift only changes phase • Transform of a Gaussian is a Gaussian • We’ll see this once more, after we do convolution
• In a conventional DSP course these are homework exercises
35