Multirate Tutorial
-
Upload
amit-singh -
Category
Documents
-
view
245 -
download
0
Transcript of Multirate Tutorial
-
8/3/2019 Multirate Tutorial
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 correspondingfigures in this tutorial
By, Deborah [email protected]
-
8/3/2019 Multirate Tutorial
2/24
I. Signal processing
background
-
8/3/2019 Multirate Tutorial
3/24
0 5 10 15 20 250
100
200
300
400
500
600
Frequency (Hz)
SignalStrength
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 iscalled the signals bandwidth, BW, since in the examples
in this presentation, the minimum frequency componentis 0Hz.
This signal can be represented in two ways:
time representation (sec) frequency representation (Hz)
Peak signalstrength at 5 Hz
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
BW
-
8/3/2019 Multirate Tutorial
4/24
-
8/3/2019 Multirate Tutorial
5/24
0 5 10 15 20 25 30 350
100
200
300
400
500
600
Frequency (Hz)
Sig
nalStrength
In order to sample the signal without losinginformation, use a sampling rate (SR) of at least theNyquist Rate (NR), which is 2 x BW of the receivedanalog signal.
SignalbandwidthBW = 15 Hz
Nyquist Rate NR= 2 x 15Hz= 30 Hz
RULE: Sampling Rate SR Nyquist Rate NR
Sampling the signal: Nyquist Rate
-
8/3/2019 Multirate Tutorial
6/24
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
Si
gnalStrength
Since Bandwidth BW = 15 Hz,
the Nyquist Rate NR = 2 x 15Hz = 30Hz.
RULE #1: Sampling Rate SR Nyquist Rate NR
Signal
bandwidthBW = 15 Hz
Nyquist RateNR = 30 Hz
Sample RateSR = 40 Hz
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
Let Sample Rate SR = 40 Hz,
so sample signal every 0.025 sec (25 milliseconds).
Sampling the signal: Nyquist Rate
-
8/3/2019 Multirate Tutorial
7/24
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
SignalStrength
Sampling the signal: Nyquist Freq The Nyquist Frequency (NF) is equal to half of the sampling rate
(SR). The NF must be equal to or greater than the bandwidthBW of the desired signal to reconstruct.
SignalbandwidthBW = 15 Hz
Nyquist Freq NF= 40/2= 20 Hz
Rule #2: Nyquist Frequency NF
Bandwidth BW
Sample RateSR = 40 Hz
-
8/3/2019 Multirate Tutorial
8/24
II. Downsample Example
-
8/3/2019 Multirate Tutorial
9/24
Recall, our original signal at 5Hz
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
2. We added10 & 15 Hzcomponents!
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
1. Original5 Hz signal
0 5 10 15 20 250
100
200
300
400
500
600
Frequency (Hz)
SignalStrength
0 5 10 15 20 25
0
100
200
300
400
500
600
Frequency (Hz)
SignalStrength
BW = 5 Hz
BW = 15 Hz
3. Then wesampled atSR1 = 40Hz
BW =15
Hz 0 0.2 0.4 0.6 0.8 1-1
0
1
2
3
Time (sec)
SignalValue
0 5 10 15 20 250
50
100
150
200
Frequency (Hz)
SignalStrength
-
8/3/2019 Multirate Tutorial
10/24
Resample the sampled signal:
downsampling
4
Downsample by 4 means to retain only every 4th sample
Sample Rate 1SR1 = 40Hz Sample Rate 2 SR2 = 10 Hz
NF1 = 20Hz > 15Hz = BW NF2 = 5Hz < 15Hz = BWGOOD! BAD!
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
-
8/3/2019 Multirate Tutorial
11/24
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
S
ignalStrength
Nyquist Freq < Bandwidth
SignalbandwidthBW = 15 Hz
Nyquist Freq 2NF2 = 10/2= 5 Hz
Cannot recover original signal bandwidth, since new NyquistFrequency (5Hz) is less than the desired signal bandwdidthBW (15Hz).
Is the original 5Hz signal recoverable? It should be, since NF2 BW 5 Hz
Nyquist Freq 1NF1 = 40/2= 20 Hz
NF2 < BW means we cannot recover 15Hz BW signal
-
8/3/2019 Multirate Tutorial
12/24
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
SignalStrength
Why 5Hz signal not recoverable:High Frequency band causes aliasing when
downsampled
SignalbandwidthBW = 15 Hz
Nyquist Freq 2NF2 = 10/2= 5 Hz
Nyquist Freq 1NF1 = 40/2= 20 Hz
NF2 NF1
Highfrequencyband
Will wrap down to 0Hz
High frequency band will wrap down to 0Hz when downsampled
-
8/3/2019 Multirate Tutorial
13/24
Why 5Hz signal not recoverable:Aliasing Effects
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
0 5 10 15 20 25 30 35 400
20
40
60
80
100
120
140
160
180
Frequency (Hz)
SignalStrength
Aliasing effects: high
frequency componentswrapped around to 0Hz!
Recovered 5Hzcomponent
SR2 = 10 Hz
Due to the high frequency components at 10Hz and 15Hz that show upat 0Hz when the signal is downsampled, the 5Hz component is notrecoverable.
unless we remove the high frequency components before downsampling.
-
8/3/2019 Multirate Tutorial
14/24
How to Remove the High Frequencycomponents before downsampling using a
low-pass filter A low-pass filter (LPF) removes high frequency
components by only letting low frequency componentspass through.
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
SignalStrength
ItIt removes the jagged edgesremoves the jagged edges that were due tothat were due tohigh frequencies.high frequencies.
0 0.2 0.4 0.6 0.8 1
-1
0
1
2
3
Time (sec)
SignalValue
LPF
LPF
4 4.2 4.4 4.6 4.8 5
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
0 5 10 15 20 25 30 35 400
20
40
60
80
100
Frequency (Hz)
SignalStrength
-
8/3/2019 Multirate Tutorial
15/24
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
SignalStrength
Proof in the pudding: No more aliasingeffects when using low pass filter!
0 5 10 15 20 25 30 35 400
1
2
3
4
5
Frequency (Hz)
SignalStrength
LPF 4
SR1 = 40 Hz SR2 = 10 Hz
The original 5Hz signal is successfully recovered!
-
8/3/2019 Multirate Tutorial
16/24
Proof in the pudding: LPF+downsampling multirate polyphase filter resampling
LPF 4
MATLABS*Polyphase-filter
ImplementedResample (by 1/4)
Function
Sample Rate 1SR1 = 40 Hz
Sample Rate 2
SR2 =10
Hz
Sample Rate 2SR2 = 10 Hz
* MATLAB is an industry standard software which performed allcomputations and corresponding figures in this presentation
0 5 10 15 20 25 30 35 400
50
100
150
200
Frequency (Hz)
SignalStrength
0 5 10 15 20 25 30 35 400
1
2
3
4
5
Frequency (Hz)
Sign
alStrength
-
8/3/2019 Multirate Tutorial
17/24
III. Upsampling example
-
8/3/2019 Multirate Tutorial
18/24
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)
SignalValue
1. Original5 Hz signal
0 5 10 15 20 250
100
200
300
400
500
600
Frequency (Hz)
SignalStrength
BW = 5 Hz
2. We sampleat SR1 = 15Hz
BW = 5Hz
Nyquist Rate NR = 2 x BW 5Hz = 10Hz, so sampleat sampling rate SR = 15Hz
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
0 5 10 15 20 250
50
100
150
200
250
Frequency (Hz)
SignalStrength
-
8/3/2019 Multirate Tutorial
19/24
Resample the sampled signal:upsampling
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
If you need to increase the number of samples in a given time by afactor of 5, you upsampleby 5 (insert 5-1=4zeros between eachsample).
5
Sample Rate 1SR1 = 15 Hz
Sample Rate 2SR2 = 75 Hz
0 0.05 0.1 0.15 0.2
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
0.2 sec 0.2 sec
-
8/3/2019 Multirate Tutorial
20/24
Upsampled signal in frequencyrepresentation
0 0.2 0.4 0.6 0.8 1
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
5Sample Rate 1SR1 = 15 HzSample Rate 2SR2 = 75 Hz
0 0.05 0.1 0.15 0.2
-1
-0.5
0
0.5
1
Time (sec)
SignalValue
0 5 10 15 20 25 30 35 400
20
40
60
80
100
120
Frequency (Hz)
SignalStrength
0.2 sec0.2 sec
0 5 10 15 20 25 30 35 400
50
100
150
200
250
Frequency (Hz)
SignalStrength
Oops!
-
8/3/2019 Multirate Tutorial
21/24
0 5 10 15 20 25 30 35 400
50
100
150
200
250
Frequency (Hz)
Sign
alStrength
Upsampling causes aliasing in
higher frequencies
5
0 5 10 15 20 25 30 35 400
20
40
60
80
100
120
Frequency (Hz)
S
ignalStrength
SignalbandwidthBW = 5 Hz
SignalbandwidthBW = 5 Hz
Mirror Images at:
15 5 = 10 Hz
15 + 5 = 20 Hz2*15- 5 = 25 Hz
2*15 + 15 = 35 Hz
Sample Rate 1SR1 = 15 Hz
Upsampling causes copies of the original 5Hz component at multiplesof original sampling rate, 15Hz, plus/minus 5Hz
How do we remove these extra high frequency components?
-
8/3/2019 Multirate Tutorial
22/24
How to remove the extra high frequencycomponents caused by upsampling
using a low-pass filter
0 5 10 15 20 25 30 35 400
20
40
60
80
100
120
Frequency (Hz)
SignalStrength
LPF
0 5 10 15 20 25 30 35 400
2
4
6
8
Frequency (Hz)
SignalStrengt
h
Low pass filter removes these extra high frequency components
-
8/3/2019 Multirate Tutorial
23/24
0 5 10 15 20 25 30 35 400
50
100
150
200
250
Frequency (Hz)
SignalStrength
Proof in the pudding: No more aliasingeffects when using low pass filter!
SR1 = 40 Hz SR2 = 10 Hz
All high frequency copies of the5
Hz signal are removed!
LPF5
0 5 10 15 20 25 30 35 400
2
4
6
8
Frequency (Hz)
SignalStrength
-
8/3/2019 Multirate Tutorial
24/24
0 5 10 15 20 25 30 35 400
50
100
150
200
250
Frequency (Hz)
SignalStrength
0 5 10 15 20 25 30 35 400
2
4
6
8
Frequency (Hz)
SignalStrength
Proof in the pudding: upsampling andlowpass filter multirate polyphase
filter resampling
LPF5
MATLABS*Polyphase-filter
ImplementedResample (by 5)
Function
0 5 10 15 20 25 30 35 400
100
200
300
400
500
Frequency (Hz)
SignalStrength
Sample Rate 1SR1 = 15 Hz
Sample Rate 2SR2 = 75 Hz
Sample Rate 2SR2 = 75 Hz
* MATLAB is an industry standard software which performed allcomputations and corresponding figures in this presentation