Transform(FT), Shorttime
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
• Multiresolution 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 θ
Euler’s formula: e
j θ
=cosθ+j sinθ
Complex conjugate: s
∗
=a−j 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: ContinuousTime and DiscreteTime 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 don’t know the value.
• Continuous time signal contains infinite values of time and the
corresponding amplitude.
• Discrete time signal only contains
Periodic discretetimesignals
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 Ω=2πq/ r (in other words, if Ωis a
rational multipleof 2π).
MaximRaginsky Lecture II: ContinuousTime and DiscreteTime Signals
Periodic continuoustimesignals
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: ContinuousTime and DiscreteTime 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) (Xaxis)
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
−iωt
e
· Cos(ωt) +iSin(ωt)
−iωt
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:101/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:n1)*(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/21)*(fs/n); % 0centered frequency range
power0 = y0.*conj(y0)/n; % 0centered 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
Shorttime Fourier Transform
•
Sample code for STFT
Multiresolution analysis
•
The time window is not fixed anymore.
•
MRA analyzes different frequency at different time
resolution. So, every spectral component is not
resolved equally.
• MRA gives
– At high frequency : Good time resolution but poor freq
resolution
– At low frequency : Good freq resolution but poor time resolution
•
The above is tolerable when we have high freq
component for short period of time and low freq
component for long period of time.
•
Most of the practical signals are of this type.
Wavelet Transform
• We have looked at Fourier Transform – now it is time to look at
others.
• A few other signal processing techniques are
– Hilbert transform
– Shorttime Fourier transform (more about this later)
– Wigner distributions
– Radon Transform
– Wavelet transform
–
THE LIST IS LONG!!!!
• Each one has its own characteristics and utilities.
• We will particularly look at the Wavelet Transform.
• What makes it different and possibly in cases more useful than
Fourier Transform
• What are the uses of Fourier Transform.
Wavelet Transform
•
We can do fourier Transform
– Fourier Transform is a reversible transform– we can go back and
forth between time domain and frequency domain
– But we cannot have both at the same time – in time domain
signal we do not have frequency information and in frequency
domain (fourier transformed signal ) ,we do not have time
information.
– What if we want to have both at the same time?
– That means fourier transform can tell us which frequency
component is contained in the signal but it cannot say when it
occurs in time in the signal.
When in time the
signal with this
frequency
component occurs??
When in time the
signal with this
frequency
component
occurs??
When do we need WT??
•
First we have to understand – when we don’t need the
WT ??
– When the signal is stationary (stationary signals are very
important in signal analysis)
– Definition  The signal whose frequency components do not
change with time is called stationary signal. In other words, the
frequency components of the signal do not change with time.
– So, all the frequency components exist all the time – so one
does not need to know which frequency component comes into
play at what point in time.
– Ex : x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t)
+cos(2*pi*100*t)
• There are 4 frequency components 10Hz, 25Hz, 50Hz and 100Hz
• These 4 components exist at every point in time.
FFT
When do we need WT??
•
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??
•
So, for nonstationary signals, if we don’t need the
time information related to the occurrence of each
component frequency, Fourier transform is enough.
•
Otherwise, go for the wavelet transform.
•
Some practical nonstationary signals
– ECG  ecocardiogram
– EEG  electroencephalograph
– EMG – electromyogram
•
Wavelet transform gives time frequency information at
the same time. Some other transforms gives it too.
– Short time fourier analysis
– Wigner transform
Do I need Wavelet Transform
•
Our need – spectral analysis of accelerometer reading
of human gait
– Is human gait a nonstationary signal?
– Is it possible that at certain points in one gait cycle, some
frequency components occur ?
– We don’t know the answer – we need to figure out.
What is resolution????
•
In this discussion – resolution is directly analogous to
precision.
•
Precision = how near you can go to the exact value
– 99.999999999999% = this is high precision when exact value is
100
• Accuracy = Is the value you are producing correct??
– f(x) = x^2 ; f(2) should be 4, you produce 3; so, not accurate.
•
Generally, we need higher resolution(precision) for
smaller values
– f = 2.3; if we say 2.1 then we are loosing (2.32.1 = 0.2/2.1 =
10% ) a lot for such a small range
– So we need to be more precise (have higher resolution) for
smaller values
•
We can have lower resolution at higher values
– f = 10000;if we say f = 9950 then(100009950 = 50/9950 =
0.5%) , so we do not loose much.
– So, we can afford less resolution at higher values of frequency
Resolution contd…
•
In signal analysis = higher frequency components occur
less time
– Freq is higher = so low resolution is OK. Time is smaller, so high
reolution is needed
•
In signal analysis = lower frequency components occur
for more time
– Time is higher = so lower resolution is OK, frequency is smaller
= so higher resolution is needed
•
Wavelet gives us just that thing for lower values (of
either time or frequency) it gives higher resolution.
Example Non Stationary Signal
• x = (1.3)*sin(2*pi*15*power(t,2)) +
(1.7)*sin(2*pi*30*power(t,2));
•
Corresponding Signal in MATLAB
– The signal looks like
Correspondi
ng FFT
Fourier Transform VS Wavelet Transform
X( f ) · x(t)•
− jωt
e
−∞
∞
∫
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
•
Both breaks a signal to its constituent parts for
analysis.
Classification of WT
Actually there is nothing continuous about scale and translation when it comes to
computer simulation of wavelet transform. Because computers does not generate
continuous points – it generates discrete points. We can only say that CWT is much
Smoother than DWT.
Result analysis
•
How to interpret the results of the wavelet transform.
•
First we try to understand what the MATLAB function
returns
• Coefficients = cwt(x(t),scaleRange,waveletName)
– computes the wavelet transform of the input signal x(t) with the
positive scaleRange using the mother wavelet with
waveletName
– Ex: Coefficients = cwt(x(t),1:128,’haar’) – mother wavelet is
haar, the scale is 1 to 128 .So, there are 128 rows of output co
efficient values where each row corresponds to 1 scale. Column
dimension each row = duration length of input signal.
Result Analysis
Wavelet transform
output in 2D and 3D plot
Input signal
Different mother wavelet produces different Wavelet transform result on the same input
CWT using
“Morlet”
mother wavelet
CWT using
“Haar” mother
wavelet
Signals at 3
different
scales (10,50
and 90)
Signals at 3
different
scales(10,50
and 90)
Fourier’s 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
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(2πt/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
i·0
∞
∑
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
i·1
∞
∑
+ϕ
n
)
· [b
i
i·1
∞
∑
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
i·1
∞
∑
+ ϕ
n
) · [b
i
i·1
∞
∑
sin(iω
0
) + a
i
cos(iω
0
)]
T=1/f
e.t.c……
T=1/f
e.t.c……
Fourier’s 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 nωt⋅ cos mωtdt ·0
0
T
∫
cos nωt⋅ cos mωtdt ·0 for n≠ mand
T
2
0
T
∫
for n· m
sin nωt⋅ sin mωtdt ·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(2πt/T) + 4sin(4πt/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(
2πt
T
)dt · 3
=
+
+
0 T
0 3 0
=
f(t) · DC+ a
i
cos(
2πit
T
) + b
1
sin(
2πit
T
)
¸
1
]
1
·
i·1
∞
∑
DC+ a
1
cos(
2πt
T
) + b
1
sin(
2πt
T
) + a
2
cos(
4πt
T
) + b
2
sin(
4πt
T
) + a
3
cos(
6πt
T
) + b
3
sin(
6πt
T
) + .........
f(t)sin(
2πt
T
)dt
0
T
∫
· {DC
0
T
∫
sin(
2πt
T
) + a
1
cos(
2πt
T
)sin(
2πt
T
) + b
1
sin(
2πt
T
)sin(
2πt
T
) + a
2
cos(
4πt
T
)sin(
2πt
T
) + b
2
sin(
4πt
T
)sin(
2πt
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
• sinωt +b
2
• sin2ωt
sin
2
0
T
∫
(
t
T
) dt ·
T
2
T=2π
+

+ +
+ + + +
+
+
+
+
+ +
 
   
f(t)
f(t) sin(2πt)
f(t) sin(4πt)
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
π
Discrete and periodic in both domains (time and frequency)
DISCRETE FOURIER TRANSFORM
Recovery of analog signal
Digitaltoanalog converter (“sampleandhold”)
Lowpass filtering
0.000000000000000
0.309016742003550
0.587784822932543
0.809016526452407
0.951056188292881
1.000000000000000
0.951057008296553
0.809018086192214
0.587786969730540
0.309019265716544
0.000000000000000
0.309014218288380
0.587782676130406
0.809014966706903
0.951055368282511
1.000000000000000
0.951057828293529
0.809019645926324
0.587789116524398
0.309021789427363
0.000000000000000
Quantization
11 levels
21 levels
111 levels
a part of vowel /a/
16 levels (4 bits) 32 levels (5 bits) 4096 levels (12 bits)
Quantization
•
Quantization error = difference between the
real value of the analog signal at sampling
instants and the value we preserve
•
Less error less “quantization distortion”
Discrete Fourier Transform (DFT)
• Takes a discrete signal in time domain – transform the signal into
discrete frequency domain representation.
• 2 concepts – Discrete Fourier Transform(DFT), Discrete time Fourier
Transform(DTFT).
– Discrete time signal [DFT] Discrete Frequency Domain
– Discrete Time Signal [DTFT] Continuous frequency domain
• In DTFT, frequency becomes continuous but in DFT , frequency is
discrete.
• We are working with DFT only.
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 Multiresolution analysis STFT – short time fourier transform
Review: complex numbers
Complex numbers
Im s b
Rectangular form: s = a + j b, a = Re(s), b= Im(s)
jθ
j =
√
−1
θ 0
Polar form: s = re
a Re s
Euler’s formula: ej θ = cosθ + j sinθ Complex conjugate: s∗= a − j b= re−j θ ss∗= s2 = a2 + b2
r = s = θ = tan
−1
2 a2 + b
b a
Analog Signal • • • • Mathematically. – Angular Frequency – Phase Angle . Three parameters – Amplitude • • • The absolute value of how up the wave goes How many times the signal repeats itself within a unit of time. a signal is a function of time. Phase in waves is the fraction of wave cycles that has elapsed after an arbitrary point. Most fundamental signal – sinusoidal Any periodic signal is composed of may different sine and cosine signals.
contains Fundamental period: smallest positive T . M axim Raginsky Lecture II: ContinuousT ime and DiscreteT ime Signals M axim Raginsky Lecture II: ContinuousT ime and DiscreteT ime Signals . Periodic discretetime signals • Continuous time positive integer T . such that the above holds. x[n + ] = x[n]. For on at discrete points the rest of the points in time . such that Ω = 2πq/ r (in other words. for all n. x(t + T ) = x(t). such that infinite values of number T > 0. suchthe time and that x[n] is periodic if there exists a signal contains x(t) is periodic if there exists a corresponding Tamplitude. we don’t know the value. • Discrete period: smallest positive only . Fundamental time signal integer T such that the above holds.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 valuesPeriodic continuoustime signals in time. for all t. if Ω is a rational multiple of 2π). x[n] Examples: x(t) period = 2 π/ω x(t) 1 period=π 0 t 0 n π −1 0 π fundamental period = 6 sinusoid x(t) = A cos(ωt + θ) triangular wave Example: x[n] = A cos(Ωn + θ) is periodic if and only if there are positive integers q and r.
• So. . • Nyquist frequency = half the sampling frequency of a signal processing system (a system which samples a signal).Nyquist Rate • A signals sampling rate must be twice of the highest frequency contained within that signal. 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 . Craig 18 Converting from time domain to frequency domain .Axis) • Frequency Domain is a discrete or continuous thing of magnitude (Y axis) vs Frequency(Hz) (Xaxis) Time Domain & Frequency Domain K.
Discrete Fourier Transform .
Discrete Fourier Transform (Contd…) How do we analyze the frequency components of a complex signal e Time space x(t) single frequency signal ω 0 −iω t = Cos(ω t) + iSin(ω t) Frequency space X(ω) e −iω t = Cos(ω t) + iSin(ω t) t ω0 ω t Some properties ω • X(ω) is complex .complex conjugate encodes phase • Fourier transform is invertable .
FFT in MATLAB • We want this as output (in frequency domain) as a result of FFT of this as input (in time domain) Look at this .
n). % Power of the DFT this is done to take all amplitudes in the positive direction y0 = fftshift(y). % Window length n = pow2(nextpow2(m)).*conj(y)/n. % Rearrange y values f0 = (n/2:n/21)*(fs/n).7)*sin(2*pi*30*t). % 0centered frequency range power0 = y0.power) xlabel('Frequency (Hz)') ylabel('Power') title('{\bf Periodogram}') clear x.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.5)*randn(size(t)).'r') % plot(f. % Gaussian noise. stem(f0. clear power0. % 0centered power figure(1).x) m = length(x). clear power. % 10 sec sample x = (1.*conj(y0)/n. clear y. % DFT f = (0:n1)*(fs/n) % Frequency range power = y. % Sample frequency (Hz) t = 0:1/fs:101/fs. % 40 Hz component % + (2.3)*sin(2*pi*15*t) + (1. clear f0. clear y0.power0. Inpu t sign al Outpu t signal . % Transform length y = fft(x. figure(3) plot(t.
Shorttime Fourier Transform • Sample code for STFT .
Multiresolution analysis • The time window is not fixed anymore. So. every spectral component is not resolved equally. . • MRA gives – At high frequency : Good time resolution but poor freq resolution – At low frequency : Good freq resolution but poor time resolution • The above is tolerable when we have high freq component for short period of time and low freq component for long period of time. • MRA analyzes different frequency at different time resolution. • Most of the practical signals are of this type.
What makes it different and possibly in cases more useful than Fourier Transform What are the uses of Fourier Transform. A few other signal processing techniques are – Hilbert transform – Shorttime Fourier transform (more about this later) – Wigner distributions – Radon Transform – Wavelet transform – THE LIST IS LONG!!!! • • • • Each one has its own characteristics and utilities.Wavelet Transform • • We have looked at Fourier Transform – now it is time to look at others. We will particularly look at the Wavelet Transform. .
Wavelet Transform • We can do fourier Transform – Fourier Transform is a reversible transform– we can go back and forth between time domain and frequency domain – But we cannot have both at the same time – in time domain signal we do not have frequency information and in frequency domain (fourier transformed signal ) . – What if we want to have both at the same time? – That means fourier transform can tell us which frequency component is contained in the signal but it cannot say when it occurs in time in the signal.we do not have time information. When in time the signal with this frequency component occurs?? When in time the signal with this frequency component occurs?? .
all the frequency components exist all the time – so one does not need to know which frequency component comes into play at what point in time. – Ex : x(t)=cos(2*pi*10*t)+cos(2*pi*25*t)+cos(2*pi*50*t) +cos(2*pi*100*t) • There are 4 frequency components 10Hz. the frequency components of the signal do not change with time. .When do we need WT?? • First we have to understand – when we don’t need the WT ?? – When the signal is stationary (stationary signals are very important in signal analysis) – Definition .The signal whose frequency components do not change with time is called stationary signal. In other words. – So. 50Hz and 100Hz FFT • These 4 components exist at every point in time. 25Hz.
It does not have all the frequency component present at all the time!!! The frequency changes with time!!! Consider another one FFT of this Results in 0 – 300 ms 100 Hz sine 300 – 600 ms has a 50Hz sine 800 – 6001000 has 800 ms a 10 Hz has a sine 25Hz sine Shows the 4 component frequency – but does not say at which point in time these 4 frequencies occur .When do we need WT?? • But look at the following signal.
• Some practical nonstationary signals – ECG .• So.ecocardiogram – EEG . go for the wavelet transform. Some other transforms gives it too. if we don’t need the time information related to the occurrence of each component frequency. Fourier transform is enough. • Otherwise.electroencephalograph – EMG – electromyogram When do we need Wavelet Transform?? • Wavelet transform gives time frequency information at the same time. – Short time fourier analysis – Wigner transform . for nonstationary signals.
some frequency components occur ? – We don’t know the answer – we need to figure out.Do I need Wavelet Transform • Our need – spectral analysis of accelerometer reading of human gait – Is human gait a nonstationary signal? – Is it possible that at certain points in one gait cycle. .
What is resolution???? • In this discussion – resolution is directly analogous to precision. • Generally. if we say 2. • Precision = how near you can go to the exact value – 99. so we do not loose much. f(2) should be 4.32. not accurate. we can afford less resolution at higher values of frequency .1 = 10% ) a lot for such a small range – So we need to be more precise (have higher resolution) for smaller values • We can have lower resolution at higher values – f = 10000.5%) . you produce 3.999999999999% = this is high precision when exact value is 100 • Accuracy = Is the value you are producing correct?? – f(x) = x^2 . – So.1 then we are loosing (2.if we say f = 9950 then(100009950 = 50/9950 = 0. so.1 = 0.3.2/2. we need higher resolution(precision) for smaller values – f = 2.
so high reolution is needed • In signal analysis = lower frequency components occur for more time – Time is higher = so lower resolution is OK. . frequency is smaller = so higher resolution is needed • Wavelet gives us just that thing for lower values (of either time or frequency) it gives higher resolution.Resolution contd… • In signal analysis = higher frequency components occur less time – Freq is higher = so low resolution is OK. Time is smaller.
2)). Corresponding Signal in MATLAB – The signal looks like Correspondi ng FFT .2)) + (1.Example Non Stationary Signal • • x = (1.3)*sin(2*pi*15*power(t.7)*sin(2*pi*30*power(t.
∞ ] The input signal The mother wavele . s) = Ψ x (τ . s) = ψ 1 s ∫ x(t)ψ * t− τ dt s The input signal complex exponential The [ −∞.Fourier Transform VS Wavelet Transform X( f ) = ∫ ∞ −∞ x(t)• e dt − jω t CWT ψ x (τ .
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
• Both breaks a signal to its constituent parts for analysis.
Classification of WT
Actually there is nothing continuous about scale and translation when it comes to omputer simulation of wavelet transform. Because computers does not generate ontinuous points – it generates discrete points. We can only say that CWT is much Smoother than DWT.
1:128. there are 128 rows of output coefficient values where each row corresponds to 1 scale.Result analysis • How to interpret the results of the wavelet transform.scaleRange. Column dimension each row = duration length of input signal. • First we try to understand what the MATLAB function returns • Coefficients = cwt(x(t). the scale is 1 to 128 .So. .waveletName) – computes the wavelet transform of the input signal x(t) with the positive scaleRange using the mother wavelet with waveletName – Ex: Coefficients = cwt(x(t).’haar’) – mother wavelet is haar.
50 and 90) .50 and 90) Signals at 3 different scales(10.Result Analysis Input signal Wavelet transform output in 2D and 3D plot Different mother wavelet produces different Wavelet transform result on the same input CWT using “Haar” mother wavelet CWT using “Morlet” mother wavelet Signals at 3 different scales (10.
i. T ∫ f(mt)⋅ f(nt) dt = 0 for m ≠ n 0 .Fourier’s Idea period T period T 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.e.
Basics of Signal Processing .
SOURCE SIGNAL RECEIVER ACTION 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 ? .
frequency = 1/T sine wave •period (frequency) •amplitude •phase λ = speed of sound × T. where T is a period .
f (t) = Asin(2πt/T + φ ) f (t) = Asin(ω t + φ ) Phase Φ sine cosine Asin(ωt + π /2 ) = Acos(ωt) .
Sinusoidal grating of image .
TO • Fourier idea – describe the signal by a sum of other well defined signals .
Fourier Series A periodic function as an infinite weighted sum of simpler periodic functions! f (t) = ∑ wi fi (t) i=0 ∞ .
t where ω 2 = 2 / T2 π .A good simple function Ti=T0 / i fi (t) = sin(iω 2 + φ).
f (t) = ∑ ki sin(iω 0 + ϕ n ) i=1 ∞ = ∑[bi sin(iω 0 ) + ai cos(iω 0 )] i=1 ∞ ˆ = Re ∑ ci ⋅ e i= 0 ∞ − jω 0 n ˆ . c − com plex .
ad infinitum .c.t.e.
c…… .t.c…… e.t.f (t) = ∑ ki sin(iω 0 + ϕ n ) = ∑ [bi sin(iω 0 ) + ai cos(iω 0 )] i=1 i=1 ∞ ∞ T=1/f T=1/f e.
sines and cosines are orthogonal on period T.Fourier’s Idea period T period T Describe complicated function as a weighted sum of simpler functions! simpler functions are known weights can be found Simpler functions .e. i. T ∫ f(mt)⋅ f(nt) dt = 0 for m ≠ n 0 .
Orthogonality T ∫ sin nωt⋅ cos mωtdt = 0 0 T ∫ cos nωt⋅ cos mωtdt = 0 for n ≠ mand 0 T 2 for n = m T ∫ sin nωt⋅ sin mωtdt = 0 for n ≠ mand 0 T 2 for n = m .
0 + x 0 + x 0 + = 0 + = 0 +  +  + +  + 0 area is positive (T/2) area is zero .
5 0 1.0 T = = 1.5 + + 3sin(2πt/T) + + 4sin(4πt/T) f(t) 1 T T ∫ f(t)dt = 1.5 0 T 2 b1 = T T ∫ f (t)sin( 0 2πt )dt = 3 T 0 T = + + 0 3 0 .
......... T T T T T T T T i=1 ∞ T 2πt ∫ f(t)sin( T )dt = 0 T ∫ {DC sin( 0 2πt 2πt 2πt 2πt 2πt 4πt 2πt 4πt 2πt ) + a1 cos( )sin( ) + b1 sin( )sin( ) + a 2 cos( )sin( ) + b 2 sin( )sin( ) + ..}dt T T T T T T T T T 0 0 b1T/2 0 0 …………… = area=b1T/2 area=b2T/2 ..... 2πit 2πit 2πt 2πt 4πt 4πt 6πt 6πt f(t) = DC + ∑ a i cos( ) + b1 sin( ) =DC + a1 cos( ) + b1 sin( ) + a 2 cos( ) + b 2 sin( ) + a 3 cos( ) + b 3 sin( ) + ...
f(t) = DC + f1 (t) + f2 (t) = DC + b1 • sinωt + b 2 • sin 2ωt area = DC f(t) area = b1T/2 f(t) sin(2πt) area = b2T/2 f(t) sin(4πt) T=2π T +  + + +   + t T sin 2 ( ) dt = ∫ T 2 0 +  +  +   + + + + + .
Magnitude spectrum Phase spectrum 0 1/T 2/T frequency 0 1/T 2/T frequency Spacing of spectral components is 1/T Periodicity in one domain (here time) implies discrete representation in the dual domain (here frequency) .
Magnitude spectrum Phase spectrum 0 1/T0 2/T0 frequency 0 1/T0 2/T0 frequency Spacing of spectral components is f0 =1/T0 Aperiodic signal Discrete spectrum becomes continuous (Fourier integral) .
Magnitude spectrum of voiced speech signal F1 log  S(ω)  F2 F3 F4 f0 frequency .
1/f0 Waveform 1/F1 F1 1/F2 Logarithmic power spectrum F2 F3 f0 .
One way of “signal processing” PROCESSING .
Going digital .
19 ms per sample 5.26 kHz .2 ms 0.sampling ts=1/fs 22 samples per 4.
Phase We need at least three samples per the period .Amplitude 2.Frequency 3. fs > 2 f Sinusoid is characterized by three parameters 1.Sampling T = 10 ms (f = 1/T=100 Hz) > 2 samples per period.
Undersampling T = 10 ms (f = 1/T=100 Hz) ts = 7.5 ms (fs=133 Hz < 2f ) T’ = 40 ms (f’= 25 Hz) .
Sampling at the Nyquist frequency ? ?? ts = 5 ms (fs=200 Hz) 2 samples per period. fs = 2 f Nyquist rate fs > 2 f .
Sampling of more complex signals highest frequency component period period Sampling must be at the frequency which is higher than the twice the highest frequency component in the signal !!! fs > 2 fmax .
Make sure you know what is the highest frequency in the signal spectrum fMAX 2. Chose sampling frequency fs > 2 fMAX NO NEED TO SAMPLE ANY FASTER ! .Sampling 1.
T Magnitude spectrum 0 1/T 2/T Periodicity in one domain implies discrete representation in the dual domain frequency .
Sampling in time implies periodicity in frequency ! T F =1/ts ts time DISCRETE FOURIER TRANSFORM frequency fs = 1/T x ( n) = 1 N ∑ X (k ) ⋅ e n=0 N −1 j 2πkn N X (k ) = 1 N ∑ x ( n) ⋅ e n =0 N −1 −j 2πkn N Discrete and periodic in both domains (time and frequency) .
Recovery of analog signal Digitaltoanalog converter (“sampleandhold”) Lowpass filtering .
000000000000000 0.587789116524398 0.587784822932543 0.809016526452407 0.309021789427363 0.000000000000000 .309014218288380 0.309019265716544 0.809018086192214 0.951057008296553 0.0.000000000000000 0.000000000000000 0.587786969730540 0.309016742003550 0.587782676130406 0.951057828293529 0.000000000000000 0.809014966706903 0.951055368282511 1.951056188292881 1.809019645926324 0.
Quantization 11 levels 21 levels 111 levels .
a part of vowel /a/ 16 levels (4 bits) 32 levels (5 bits) 4096 levels (12 bits) .
Quantization • Quantization error = difference between the real value of the analog signal at sampling instants and the value we preserve • Less error less “quantization distortion” .
frequency is discrete. We are working with DFT only. . 2 concepts – Discrete Fourier Transform(DFT). Discrete time Fourier Transform(DTFT). frequency becomes continuous but in DFT .Discrete Fourier Transform (DFT) • • Takes a discrete signal in time domain – transform the signal into discrete frequency domain representation. – – Discrete time signal [DFT] Discrete Frequency Domain Discrete Time Signal [DTFT] Continuous frequency domain • • In DTFT.