0% found this document useful (0 votes)
172 views

Multirate Signal Processing Tutorial Using MATLAB : I. II. Iii

This document provides a tutorial on multirate signal processing using MATLAB. It begins with background on signal processing, including sampling rate requirements to avoid aliasing when sampling analog signals. It then provides an example of downsampling a signal, showing that the sampling rate must be high enough to avoid aliasing effects from high frequency components wrapping around. It demonstrates using a low-pass filter before downsampling to remove high frequencies and successfully recover the original signal after downsampling. Finally, it gives an example of upsampling a signal by inserting zeros between original samples.

Uploaded by

Saravana Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
172 views

Multirate Signal Processing Tutorial Using MATLAB : I. II. Iii

This document provides a tutorial on multirate signal processing using MATLAB. It begins with background on signal processing, including sampling rate requirements to avoid aliasing when sampling analog signals. It then provides an example of downsampling a signal, showing that the sampling rate must be high enough to avoid aliasing effects from high frequency components wrapping around. It demonstrates using a low-pass filter before downsampling to remove high frequencies and successfully recover the original signal after downsampling. Finally, it gives an example of upsampling a signal by inserting zeros between original samples.

Uploaded by

Saravana Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Multirate Signal Processing*

Tutorial using MATLAB**


I. Signal processing background
II. Downsample Example
III. Upsample Example
* Multrate signal processing is used for the practical applications in signal processing to save
costs, processing time, and many other practical reasons.
** MATLAB is an industry standard software which performed all computations and corresponding
figures in this tutorial
By, Deborah Goshorn
[email protected]
I. Signal processing
background
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Receive an analog signal
Receive an analog signal at 5 Hz
(as pictured below left, there are 5 wave cycles in one second.)
The highest frequency component (5 Hz) of the signal is
called the signals bandwidth, BW, since in the examples
in this presentation, the minimum frequency component
is 0Hz.
This signal can be represented in two ways:
time representation (sec) frequency representation (Hz)
Peak signal
strength at 5 Hz
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
BW
Add high frequency components
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
1.5
2
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
2. Add a
10 Hz
component
3. Then add
a 15 Hz
component!
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
1. Original
5 Hz signal
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Adding high
frequency
components
creates
jagged
edges in
the original
5 Hz signal.
BW = 5 Hz
BW = 10 Hz
BW = 15 Hz
0 5 10 15 20 25 30 35
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
In order to sample the signal without losing
information, use a sampling rate (S
R
) of at least the
Nyquist Rate (N
R
), which is 2 x BW of the received
analog signal.


Signal
bandwidth
BW = 15 Hz
Nyquist Rate N
R
= 2 x 15Hz
= 30 Hz
RULE: Sampling Rate S
R
Nyquist Rate N
R
Sampling the signal: Nyquist Rate
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Since Bandwidth BW = 15 Hz,
the Nyquist Rate N
R
= 2 x 15Hz = 30Hz.



RULE #1: Sampling Rate S
R
Nyquist Rate N
R
Signal
bandwidth
BW = 15 Hz
Nyquist Rate
N
R
= 30 Hz
Sample Rate
S
R
= 40 Hz
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
Let Sample Rate S
R
= 40 Hz,
so sample signal every 0.025 sec (25 milliseconds).
Sampling the signal: Nyquist Rate
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Sampling the signal: Nyquist Freq
The Nyquist Frequency (N
F
) is equal to half of the sampling rate
(S
R
). The N
F
must be equal to or greater than the bandwidth
BW of the desired signal to reconstruct.


Signal
bandwidth
BW = 15 Hz
Nyquist Freq N
F
= 40/2
= 20 Hz
Rule #2: Nyquist Frequency N
F
Bandwidth BW
Sample Rate
S
R
= 40 Hz
II. Downsample Example
Recall, our original signal at 5Hz
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
2. We added
10 & 15 Hz
components!
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
1. Original
5 Hz signal
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
BW = 5 Hz
BW = 15 Hz
3. Then we
sampled at
S
R1
= 40Hz
BW = 15 Hz
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Resample the sampled signal:
downsampling
4
Downsample by 4 means to retain only every 4
th
sample
Sample Rate 1 S
R1
= 40Hz
Sample Rate 2 S
R2
= 10 Hz
N
F1
= 20Hz > 15Hz = BW
N
F2
= 5Hz < 15Hz = BW
GOOD!
BAD!
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Nyquist Freq < Bandwidth
Signal
bandwidth
BW = 15 Hz
Nyquist Freq 2
N
F2
= 10/2
= 5 Hz
Cannot recover original signal bandwidth, since new Nyquist
Frequency (5Hz) is less than the desired signal bandwdidth
BW (15Hz).

Is the original 5Hz signal recoverable? It should be, since N
F2
BW 5 Hz


Nyquist Freq 1
N
F1
= 40/2
= 20 Hz
N
F2
< BW means we cannot recover 15Hz BW signal
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Why 5Hz signal not recoverable:
High Frequency band causes aliasing when
downsampled
Signal
bandwidth
BW = 15 Hz
Nyquist Freq 2
N
F2
= 10/2
= 5 Hz
Nyquist Freq 1
N
F1
= 40/2
= 20 Hz
N
F2
N
F1
High
frequency
band
Will wrap down to 0Hz
High frequency band will wrap down to 0Hz when downsampled
Why 5Hz signal not recoverable:
Aliasing Effects
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25 30 35 40
0
20
40
60
80
100
120
140
160
180
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Aliasing effects: high
frequency components
wrapped around to 0Hz!
Recovered 5Hz
component
S
R2
= 10 Hz
Due to the high frequency components at 10Hz and 15Hz that show up
at 0Hz when the signal is downsampled, the 5Hz component is not
recoverable.
unless we remove the high frequency components before downsampling.
How to Remove the High Frequency
components before downsampling using a
low-pass filter
A low-pass filter (LPF) removes high frequency
components by only letting low frequency components
pass through.
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
It removes the jagged edges that were due to
high frequencies.
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
LPF
LPF
4 4.2 4.4 4.6 4.8 5
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25 30 35 40
0
20
40
60
80
100
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Proof in the pudding: No more aliasing
effects when using low pass filter!
0 5 10 15 20 25 30 35 40
0
1
2
3
4
5
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
LPF
4
S
R1
= 40 Hz
S
R2
= 10 Hz
The original 5Hz signal is successfully recovered!
Proof in the pudding: LPF+downsampling
<==> multirate polyphase filter resampling
LPF
4
MATLABS*
Polyphase-filter
Implemented
Resample (by 1/4)
Function
Sample Rate 1
S
R1
= 40 Hz
Sample Rate 2
S
R2
= 10 Hz
Sample Rate 2
S
R2
= 10 Hz
* MATLAB is an industry standard software which performed all
computations and corresponding figures in this presentation
0 5 10 15 20 25 30 35 40
0
50
100
150
200
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25 30 35 40
0
1
2
3
4
5
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
III. Upsampling example
Assume our original signal at 5Hz
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
1. Original
5 Hz signal
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
BW = 5 Hz
2. We sample
at S
R1
= 15Hz
BW = 5Hz
Nyquist Rate N
R
= 2 x BW 5Hz = 10Hz, so sample
at sampling rate S
R
= 15Hz

0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25
0
50
100
150
200
250
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Resample the sampled signal:
upsampling
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e

If you need to increase the number of samples in a given time by a
factor of 5, you upsample

by 5 (insert 5-1=4 zeros between each
sample).

5
Sample Rate 1
S
R1
= 15 Hz
Sample Rate 2
S
R2
= 75 Hz
0 0.05 0.1 0.15 0.2
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0.2 sec
0.2 sec
Upsampled signal in frequency
representation
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
5
Sample Rate 1
S
R1
= 15 Hz
Sample Rate 2
S
R2
= 75 Hz
0 0.05 0.1 0.15 0.2
-1
-0.5
0
0.5
1
Time (sec)
S
i
g
n
a
l

V
a
l
u
e
0 5 10 15 20 25 30 35 40
0
20
40
60
80
100
120
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0.2 sec
0.2 sec
0 5 10 15 20 25 30 35 40
0
50
100
150
200
250
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Oops!
0 5 10 15 20 25 30 35 40
0
50
100
150
200
250
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Upsampling causes aliasing in
higher frequencies
5
0 5 10 15 20 25 30 35 40
0
20
40
60
80
100
120
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Signal
bandwidth
BW = 5 Hz
Signal
bandwidth
BW = 5 Hz
Mirror Images at:
15 5 = 10 Hz
15 + 5 = 20 Hz
2*15 - 5 = 25 Hz
2*15 + 15 = 35 Hz

Sample Rate 1
S
R1
= 15 Hz
Upsampling causes copies of the original 5Hz component at multiples
of original sampling rate, 15Hz, plus/minus 5Hz
How do we remove these extra high frequency components?
How to remove the extra high frequency
components caused by upsampling
using a low-pass filter
0 5 10 15 20 25 30 35 40
0
20
40
60
80
100
120
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
LPF
0 5 10 15 20 25 30 35 40
0
2
4
6
8
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Low pass filter removes these extra high frequency components
0 5 10 15 20 25 30 35 40
0
50
100
150
200
250
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Proof in the pudding: No more aliasing
effects when using low pass filter!
S
R1
= 40 Hz
S
R2
= 10 Hz
All high frequency copies of the 5Hz signal are removed!
LPF
5
0 5 10 15 20 25 30 35 40
0
2
4
6
8
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25 30 35 40
0
50
100
150
200
250
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
0 5 10 15 20 25 30 35 40
0
2
4
6
8
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Proof in the pudding: upsampling and
lowpass filter <==> multirate polyphase
filter resampling
LPF
5
MATLABS*
Polyphase-filter
Implemented
Resample (by 5)
Function
0 5 10 15 20 25 30 35 40
0
100
200
300
400
500
Frequency (Hz)
S
i
g
n
a
l

S
t
r
e
n
g
t
h
Sample Rate 1
S
R1
= 15 Hz
Sample Rate 2
S
R2
= 75 Hz
Sample Rate 2
S
R2
= 75 Hz
* MATLAB is an industry standard software which performed all
computations and corresponding figures in this presentation

You might also like