Documente Academic
Documente Profesional
Documente Cultură
Transform(FT), Short-time
Fourier Transform(STFT) and
Wavelet Transform(WT)
Zafar Ahmed
University of Oklahoma
A few concepts
A few concepts
Complex Numbers.
Analog Signal.
Discrete time signal vs continuous time signal.
Nyquist rate for signal sampling.
Time Domain VS frequency Domain
Discrete Fourier Transform.
Dirichlets equation.
Orhogonality of functions.
Discrete and Continuous Frequency Domain
Multi-resolution analysis
STFT short time fourier transform
Complex numbers
Review: complexnumbers
Rectangular form: s =a+j b, j =
1
a =Re(s), b=Im(s)
Polar form: s =re
j
Eulers formula: e
j
=cos+j sin
Complex conjugate: s
=aj b=re
j
ss
=|s|
2
=a
2
+b
2
0
Re s
Im s
a
b
r =|s| = a
2
+b
2
=tan
1
b
a
MaximRaginsky Lecture II: Continuous-Time and Discrete-Time Signals
Analog Signal
Mathematically, a signal is a function of time.
Most fundamental signal sinusoidal
Any periodic signal is composed of may different sine and
cosine signals.
Three parameters
Amplitude
The absolute value of how up the wave goes
Angular Frequency
How many times the signal repeats itself within a unit of time.
Phase Angle
Phase in waves is the fraction of wave cycles that has elapsed after an arbitrary point.
Continuous time VS discrete
time signals
Continuous time signals are defined at any value of time
Discrete time signals are defined only at discrete values of time.
Continuous time signal takes a value at every point in time
discrete time signal takes values on at discrete points in time. For
the rest of the points in time , we dont know the value.
Continuous time signal contains infinite values of time and the
corresponding amplitude.
Discrete time signal only contains
Periodic discrete-timesignals
x[n] is periodic if thereexists a positiveinteger T, such that
x[n +T] =x[n], for all n.
Fundamental period: smallest positiveinteger T, such that theabove
holds.
x[n]
n 0
fundamental period = 6
Example: x[n] =A cos(n +) is periodic if and only if thereare
positiveintegers q and r, such that =2q/ r (in other words, if is a
rational multipleof 2).
MaximRaginsky Lecture II: Continuous-Time and Discrete-Time Signals
Periodic continuous-timesignals
x(t) is periodic if thereexists a number T >0, such that
x(t +T) =x(t), for all t.
Fundamental period: smallest positiveT, such that theaboveholds.
Examples:
0
x(t)
t
period = 2 /
sinusoid x(t) =A cos(t +)
0
x(t)
-
1
1
period
triangular wave
MaximRaginsky Lecture II: Continuous-Time and Discrete-Time Signals
Nyquist Rate
A signals sampling rate must be twice of the highest frequency
contained within that signal.
Nyquist frequency = half the sampling frequency of a signal processing
system (a system which samples a signal).
So, if the highest frequency contained within a signal is 40 Hz then that
signal must be sampled at a rate of nyquist rate (80 times/sec) to
prevent antialiasing.
Time Domain VS Frequency Domain
Time Domain is a curve of Amplitude (Y axis ) VS Time (X - Axis)
Frequency Domain is a discrete or continuous thing of magnitude (Y -
axis) vs Frequency(Hz) (X-axis)
Time Domain & Frequency Domain K. Craig 18
Converting from time
domain to frequency
domain
Discrete Fourier Transform
Time Domain & Frequency Domain K. Craig 13
Discrete Fourier Transform (Contd)
How do we analyze the frequency components of a complex signal
Time space x(t) Frequency space X()
single frequency signal
0
t
0
t
X() is complex -- complex conjugate encodes phase
Fourier transform is invertable
Some properties
it
e
Cos(t) +iSin(t)
it
e
Cos(t) +iSin(t)
FFT in MATLAB
We want this
as a result
of FFT of
this
as output (in
frequency
domain)
as input
(in time
domain)
Look at this
Discrete Fourier Transform(Example)
Fourier Transform tells me
Which frequency components are present in a signal
What is the amplitude and phase of that frequency component in the signal
Here is a sample code of fourier transform
fs = 100; % Sample frequency (Hz)
t = 0:1/fs:10-1/fs; % 10 sec sample
x = (1.3)*sin(2*pi*15*t) + (1.7)*sin(2*pi*30*t); % 40 Hz component
% + (2.5)*randn(size(t)); % Gaussian noise;
figure(3)
plot(t,x)
m = length(x); % Window length
n = pow2(nextpow2(m)); % Transform length
y = fft(x,n); % DFT
f = (0:n-1)*(fs/n) % Frequency range
power = y.*conj(y)/n; % Power of the DFT this is done to take all amplitudes in the positive
direction
y0 = fftshift(y); % Rearrange y values
f0 = (-n/2:n/2-1)*(fs/n); % 0-centered frequency range
power0 = y0.*conj(y0)/n; % 0-centered power
figure(1);
stem(f0,power0,'r')
% plot(f,power)
xlabel('Frequency (Hz)')
ylabel('Power')
title('{\bf Periodogram}')
clear x;
clear y;
clear power;
clear f0;
clear y0;
clear power0;
Inpu
t
sign
al
Outpu
t
signal
Short-time Fourier Transform
But look at the following signal. It does not have all the
frequency component present at all the time!!!
The frequency
changes with
time!!!
0 300
ms
100 Hz
sine
300
600 ms
has a
50Hz
sine
600-
800 ms
has a
25Hz
sine
800
1000 has
a 10 Hz
sine
Consider another
one
FFT of
this
Results
in
Shows the 4 component frequency
but does not say at which point in
time these 4 frequencies occur
When do we need Wavelet
Transform??
dt
The input signal
The complex exponential
,
[ ]
x
CWT
(, s)
x
(, s)
1
s
x(t)
t
s
_
,
dt
The input signal
The mother wavelet
Fourier Transform VS Wavelet Transform
The mother
wavelet is
translated
gradually from
the beginning to
the end of the
input signal
Then the mother
wavelet is
scaled(dilated or
compacted) and
the whole
translation
process is
repeated again.
Similarity between FT and WT
dt 0 for m n
period T period T
Basics of Signal Processing
SIGNAL SOURCE
RECEIVER
describe waves in terms of their
significant features
understand the way the waves originate
effect of the waves
will the people in the boat notice ?
ACTION
frequency = 1/T
speed of sound T, where T is a period
sine wave
period (frequency)
amplitude
phase
f (t) Asin(2t/T+ )
f (t) Asin(t+ )
Asin(t+ /2)
Acos(t)
sine cosine
Phase
Sinusoidal grating of image
Fourier idea
describe
the signal
by a sum of
other well
defined
signals
T
O
Fourier Series
A periodic function as an infinite weighted
sum of simpler periodic functions!
f(t) w
i
i0
f
i
(t)
A good simple function
T
i
=T
0
/ i
f
i
(t) sin(i
2
t+),
where
2
2 / T
2
f (t) k
i
sin(i
0
i1
+
n
)
[b
i
i1
sin(i
0
) + a
i
cos(i
0
)]
Re
c
i
e
j
0
n
i 0
,
c complex
e.t.c. ad infinitum
f (t) k
i
sin(i
0
i1
+
n
) [b
i
i1
sin(i
0
) + a
i
cos(i
0
)]
T=1/f
e.t.c
T=1/f
e.t.c
Fouriers Idea
Describe complicated function as a weighted sum of simpler functions!
-
simpler functions are known
-
weights can be found
Simpler functions - sines and cosines are orthogonal on period T, i.e.
f(mt) f(nt)
0
T
dt 0 for m n
period T period T
Orthogonality
sin nt cos mtdt 0
0
T
for n m
sin nt sin mtdt 0 for n mand
T
2
0
T
for n m
0
+
-
0
+
-
0
+
-
x
0
+ +
- -
x
0
+ +
=
0
+ +
- -
=
area is positive (T/2) area is zero
f(t) = 1.5 + 3sin(2t/T) + 4sin(4t/T)
= +
+
0 T
1
T
f(t)dt
0
T
1.5
0 T
1.5
b
1
2
T
f
0
T
(t)sin(
2t
T
)dt 3
=
+
+
0 T
0 3 0
=
f(t) DC+ a
i
cos(
2it
T
) + b
1
sin(
2it
T
)
1
]
1
i1
DC+ a
1
cos(
2t
T
) + b
1
sin(
2t
T
) + a
2
cos(
4t
T
) + b
2
sin(
4t
T
) + a
3
cos(
6t
T
) + b
3
sin(
6t
T
) + .........
f(t)sin(
2t
T
)dt
0
T
{DC
0
T
sin(
2t
T
) + a
1
cos(
2t
T
)sin(
2t
T
) + b
1
sin(
2t
T
)sin(
2t
T
) + a
2
cos(
4t
T
)sin(
2t
T
) + b
2
sin(
4t
T
)sin(
2t
T
) + .........}dt
0 0 b
1
T/2 0 0
area=b
1
T/2
area=b
2
T/2
f(t) DC+f
1
(t) +f
2
(t) DC+b
1
sint +b
2
sin2t
sin
2
0
T
(
t
T
) dt
T
2
T=2
+
-
+ +
+ + + +
+
+
+
+
+ +
- -
- - - -
f(t)
f(t) sin(2t)
f(t) sin(4t)
area = DC area = b
1
T/2 area = b
2
T/2
Spacing of spectral components is 1/T
Periodicity in one domain (here time)
implies discrete representation in the dual
domain (here frequency)
0 1/T 2/T
frequency
0 1/T 2/T
frequency
Phase spectrum Magnitude spectrum
Aperiodic signal
Discrete spectrum becomes continuous (Fourier integral)
0 1/T
0
2/T
0
frequency
0 1/T
0
2/T
0
frequency
Phase spectrum Magnitude spectrum
Spacing of spectral components is f
0
=1/T
0
Magnitude spectrum of voiced
speech signal
frequency
log | S() |
F
1
F
2
F
3
F
4
f
0
1/f
0
1/F
1
1/F
2
Waveform
Logarithmic power spectrum
f
0
F
1
F
2
F
3
P
R
O
C
E
S
S
I
N
G
One way of signal processing
Going digital
sampling
22 samples per 4.2 ms 0.19 ms per sample 5.26 kHz
t
s
=1/f
s
Sampling
> 2 samples per period,
f
s
> 2 f
T = 10 ms (f = 1/T=100 Hz)
Sinusoid is characterized by three parameters
1.Amplitude
2.Frequency
3.Phase
We need at least three samples per the period
T = 10 ms (f = 1/T=100 Hz)
t
s
= 7.5 ms (f
s
=133 Hz < 2f )
Undersampling
T = 40 ms
(f= 25 Hz)
Sampling at the Nyquist frequency
2 samples per period,
f
s
= 2 f
Nyquist rate
t
s
= 5 ms (f
s
=200 Hz)
?
??
f
s
> 2 f
Sampling of more complex signals
period period
highest frequency
component
Sampling must be at the frequency which is higher than the twice
the highest frequency component in the signal !!!
f
s
> 2 f
max
Sampling
1. Make sure you know what is the highest
frequency in the signal spectrum f
MAX
2. Chose sampling frequency f
s
> 2 f
MAX
NO NEED TO SAMPLE ANY FASTER !
Periodicity in one domain implies discrete
representation in the dual domain
0 1/T 2/T
frequency
Magnitude spectrum T
frequency
F
=1/t
s
f
s
= 1/T
time
t
s
T
Sampling in time implies periodicity in frequency !
1
0
2
1
) ( ) (
N
n
N
kn
j
N
e k X n x
1
0
2
1
) ( ) (
N
n
N
kn
j
N
e n x k X