Lecture2 Noise Freq
Lecture2 Noise Freq
H z z 1
Z-1
Delay of k Samples
Similarly, the system y[n] = x[n-k], i.e., the k-sampledelay system, is the z-transform of the impulse
response x[n - k].
H z z
Z-k
Signal-flow diagram of a moving-average filter of order N. Each block with the symbol
z1 represents a delay of one sample, and serves as a memory unit for the
corresponding signal sample value.
(Non-Recursive)
1 z 1 z 2 z 3
z3 z2 z 1
Y z X z
X z
4
4z 4
Block Diagram
Z Transform
Transfer Function
Y
z3 z2 z 1
z
X
4z 4
symmterical.
Y[80] = ( x[79] + x[80]+x[81] ) / 3 : symmterical
A potential problem is look-ahead
Assignment 2
Apply an 8 point moving average filter on the raw ECG data
already provided.
Apply a 32 point filter on the raw ECG data.
Frequency Analysis
Next few slides are taken from book Advanced Engineering Mathematics by Erwin Kreyszig John Wiley & Sons,
Inc. Consult the book for further info.
Pages 478-479b
Advanced Engineering
Mathematics by Erwin Kreyszig
Copyright 2007 John Wiley &
Sons, Inc. All rights reserved.
Advanced Engineering
Mathematics by Erwin Kreyszig
Copyright 2007 John Wiley &
Sons, Inc. All rights reserved.
Pages 480-482c
Fourier Transform
Before we start, lets discuss a little about Fourier Transform.
The basic idea is: A signal can be decomposed into periodic
cosine and sine waves with different frequencies.
Frequency Spectra
example : g(t) = sin(2f t) + (1/3)sin(2(3f) t)
Frequency Spectra
Example: Music
We think of music in terms of frequencies at different
magnitudes
Fourier Transforms
All of us has basic concept of functions.
In signal processing, most functions fall into two categories:
1. waveforms, images, or other data;
2. and entities that operate on waveforms, images, or other data
The later group can be further divided into functions
i.
that modify the data,
ii. and functions used to analyze or probe the data.
For example, the basic filters use functions (the filter coefficients) that
modify the spectral content of a waveform.
The Fourier Transform detailed uses functions (harmonically related
sinusoids) to analyze the spectral content of a waveform.
Functions that modify data are also termed operations or transformations.
Fourier Transform
A transform can be thought of as a re-mapping of the original
data into a function that provides more information than the
original.
The Fourier Transform is classic example as it converts the
original time data into frequency information which often
provides greater insight into the nature and/or origin of the
signal.
Fourier Transform
How we do that?....
Fourier Transform
It is a technique for examining signals in the frequency domain.
Our immediate goal is to represent a given function as a
convergent series in the elementary trigonometric functions
(already studied them few slides before)
f(x)
Fourier
Transform
F(w)
Fourier Analysis
a0
2nt
2nt
f (t ) an cos
bn sin
2 n 1
T
T
n 1
DC Part
Even Part
Odd Part
ao can be calculated by
Fourier: Examples
The typical syntax for computing the FFT of a signal is FFT(x,N)
where x is the signal, x[n], you wish to transform, and N is the
number of points in the FFT. N must be at least as large as the
number of samples in x[n]. Matlab Example: To demonstrate
the effect of changing the value of N,
i.e 64, 128,256, 512
Matlab example
Fourier: Examples
N = 16
20
10
0
0.1
0.2
0.3
0.4
0.5
N = 32
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
N = 64
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
N = 128
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
N = 256
0.6
0.7
0.8
0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
20
10
0
20
10
0
20
10
0
20
10
0
Fourier: Examples
In the previous slide
Upon examining the plot one can see that each of the transforms
adheres to the same shape, differing only in the number of FFT
samples used to approximate that shape.
But once the number of FFT points are very small the shape is
different (N=16 and N=32).
Fourier: Examples
1. The FFT does not directly give you the spectrum of a signal. As we
have seen with the last two examples, the FFT can vary
dramatically depending on the number of points (N) of the FFT,
and the number of periods of the signal that are represented.
2. The FFT contains information between 0 and fs, however, we
know that the sampling frequency must be at least twice the
highest frequency component. Therefore, the signal's spectrum
should be entirly below fs/2 , the Nyquist frequency.
3. Also real signal should have a transform magnitude that is
symmetrical for positive and negative frequencies. So instead of
having a spectrum that goes from 0 to fs, it would be more
appropriate to show the spectrum from fs/2 to fs/2 .
Fourier: Examples
16
14
12
10
8
6
4
2
0
-0.5
-0.4
-0.3
-0.2
-0.1
0
0.1
frequency / f s
0.2
0.3
0.4
0.5
DC component
remains same
Provides excellent
localization in the
frequency domain
but poor localization
in the time domain.
2. In its current form Not useful for analyzing time-variant, nonstationary signals.
3. Not appropriate for representing discontinuities or sharp corners
(i.e., requires a large number of Fourier components to represent
discontinuities).
Stationary vs non-stationary
signals
Stationary signals: timeinvariant spectra
Non-stationary signals:
time-varying spectra
Stationary vs non-stationary
signals
Stationary signal:
Three frequency
components,
present at all
times!
Stationary vs non-stationary
signals
Non-stationary signal:
Frequency
parameter
Signal to
be analyzed
1D 2D
STFT fu (t , u ) f (t ) W (t t ) e j 2 ut dt
t
STFT of f(t):
computed for each
window centered at t=t
Windowing
function
centered at t=t
STFT fu (t , u ) f (t ) (t t ) e j 2 ut dt f (t ) e jut
t
Example
Use this link for an Excellent work of Polikar on STFT and wavelets
http://users.rowan.edu/~polikar/WAVELETS/WTpart2.html
Example
Example
Assignment
Take the FFT of complete single trial signal. Already provided
to you.
Remember that FFT has both Real and Imagery Parts. So take
real part only, you can also use abs function.
Length of FFT window should also be the part of your concept.
Vary the fft length and look into its influence on the signal.
Spectrum Types
Magnitude: Amplitude Spectrum
Squared magnitude: Power Spectrum
Squared magnitude per unit bandwidth: Power Spectral
Density
Squared magnitude block time length: Energy
Spectrum
Squared magnitude block length per unit bandwidth:
Energy Spectral Density
Averaging in Spectrum
Combine multiple time blocks together to form one spectral
estimate
Random data: higher average number, better estimate of
random characteristics
Flow diagram