Tutorial using MATLAB** By, Deborah Goshorn dgoshorn@cs.ucsd.edu - - PowerPoint PPT Presentation

tutorial using matlab
SMART_READER_LITE
LIVE PREVIEW

Tutorial using MATLAB** By, Deborah Goshorn dgoshorn@cs.ucsd.edu - - PowerPoint PPT Presentation

Multirate Signal Processing* Tutorial using MATLAB** By, Deborah Goshorn dgoshorn@cs.ucsd.edu I. Signal processing background II. Downsample Example III. Upsample Example * Multrate signal processing is used for the practical applications in


slide-1
SLIDE 1

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 dgoshorn@cs.ucsd.edu

slide-2
SLIDE 2
  • I. Signal processing

background

slide-3
SLIDE 3

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

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 signal’s 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.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

BW

slide-4
SLIDE 4

Add high frequency components

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1 1.5 2

Time (sec) Signal Value

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

  • 2. Add a

10 Hz component

  • 3. Then add

a 15 Hz component!

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

  • 1. Original

5 Hz signal

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

Adding high frequency components creates jagged edges in the original 5 Hz signal. BW = 5 Hz BW = 10 Hz BW = 15 Hz

slide-5
SLIDE 5

5 10 15 20 25 30 35 100 200 300 400 500 600

Frequency (Hz) Signal Strength

  • In order to sample the signal without losing

information, use a sampling rate (SR) of at least the Nyquist Rate (NR), which is 2 x BW of the received analog signal.

Signal bandwidth BW = 15 Hz Nyquist Rate NR = 2 x 15Hz = 30 Hz

RULE: Sampling Rate SR ≥ Nyquist Rate NR

Sampling the signal: Nyquist Rate

slide-6
SLIDE 6

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

Since Bandwidth BW = 15 Hz, the Nyquist Rate NR = 2 x 15Hz = 30Hz.

RULE #1: Sampling Rate SR ≥ Nyquist Rate NR

Signal bandwidth BW = 15 Hz Nyquist Rate NR = 30 Hz Sample Rate SR = 40 Hz

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

Let Sample Rate SR = 40 Hz, so sample signal every 0.025 sec (25 milliseconds).

Sampling the signal: Nyquist Rate

slide-7
SLIDE 7

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

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 bandwidth BW of the desired signal to reconstruct.

Signal bandwidth BW = 15 Hz Nyquist Freq NF = 40/2 = 20 Hz

Rule #2: Nyquist Frequency NF ≥ Bandwidth BW

Sample Rate SR = 40 Hz

slide-8
SLIDE 8
  • II. Downsample Example
slide-9
SLIDE 9

Recall, our original signal at 5Hz…

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

  • 2. We added

10 & 15 Hz components!

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

  • 1. Original

5 Hz signal

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

BW = 5 Hz BW = 15 Hz

  • 3. Then we

sampled at SR1 = 40Hz BW = 15 Hz

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

5 10 15 20 25 50 100 150 200

Frequency (Hz) Signal Strength

slide-10
SLIDE 10

Resample the sampled signal: downsampling 4

Downsample by 4 means to retain only every 4th sample

Sample Rate 1 SR1 = 40Hz Sample Rate 2 SR2 = 10 Hz NF1 = 20Hz > 15Hz = BW NF2 = 5Hz < 15Hz = BW GOOD! BAD!

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

slide-11
SLIDE 11

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

Nyquist Freq < Bandwidth 

Signal bandwidth BW = 15 Hz Nyquist Freq 2 NF2 = 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 NF2 ≥ BW 5 Hz

Nyquist Freq 1 NF1 = 40/2 = 20 Hz

NF2 < BW means we cannot recover 15Hz BW signal

slide-12
SLIDE 12

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

Why 5Hz signal not recoverable:

High Frequency band causes aliasing when downsampled

Signal bandwidth BW = 15 Hz Nyquist Freq 2 NF2 = 10/2 = 5 Hz Nyquist Freq 1 NF1 = 40/2 = 20 Hz

NF2 NF1

High frequency band

Will wrap down to 0Hz High frequency band will wrap down to 0Hz when downsampled

slide-13
SLIDE 13

Why 5Hz signal not recoverable:

Aliasing Effects

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

5 10 15 20 25 30 35 40 20 40 60 80 100 120 140 160 180

Frequency (Hz) Signal Strength

Aliasing effects: high frequency components wrapped around to 0Hz!

Recovered 5Hz component

SR2 = 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.

slide-14
SLIDE 14

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.

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

It removes the jagged edges that were due to

high frequencies.

0.2 0.4 0.6 0.8 1

  • 1

1 2 3

Time (sec) Signal Value

LPF LPF

4 4.2 4.4 4.6 4.8 5

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

5 10 15 20 25 30 35 40 20 40 60 80 100

Frequency (Hz) Signal Strength

slide-15
SLIDE 15

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength

Proof in the pudding: No more aliasing

effects when using low pass filter!

5 10 15 20 25 30 35 40 1 2 3 4 5

Frequency (Hz) Signal Strength

LPF

4

SR1 = 40 Hz SR2 = 10 Hz

The original 5Hz signal is successfully recovered!

slide-16
SLIDE 16

Proof in the pudding: LPF+downsampling <==> multirate polyphase filter resampling

LPF

4

MATLAB’S* Polyphase-filter Implemented Resample (by 1/4) Function

Sample Rate 1 SR1 = 40 Hz Sample Rate 2 SR2 = 10 Hz Sample Rate 2 SR2 = 10 Hz

* MATLAB is an industry standard software which performed all computations and corresponding figures in this presentation

5 10 15 20 25 30 35 40 50 100 150 200

Frequency (Hz) Signal Strength 5 10 15 20 25 30 35 40 1 2 3 4 5

Frequency (Hz) Signal Strength

slide-17
SLIDE 17
  • III. Upsampling example
slide-18
SLIDE 18

Assume our original signal at 5Hz…

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

  • 1. Original

5 Hz signal

5 10 15 20 25 100 200 300 400 500 600

Frequency (Hz) Signal Strength

BW = 5 Hz

  • 2. We sample

at SR1 = 15Hz BW = 5Hz

Nyquist Rate NR = 2 x BW 5Hz = 10Hz, so sample at sampling rate SR = 15Hz

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

5 10 15 20 25 50 100 150 200 250

Frequency (Hz) Signal Strength

slide-19
SLIDE 19

Resample the sampled signal: upsampling

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

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 SR1 = 15 Hz Sample Rate 2 SR2 = 75 Hz

0.05 0.1 0.15 0.2

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

0.2 sec 0.2 sec

slide-20
SLIDE 20

Upsampled signal in frequency representation

0.2 0.4 0.6 0.8 1

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

5

Sample Rate 1 SR1 = 15 Hz Sample Rate 2 SR2 = 75 Hz

0.05 0.1 0.15 0.2

  • 1
  • 0.5

0.5 1

Time (sec) Signal Value

5 10 15 20 25 30 35 40 20 40 60 80 100 120

Frequency (Hz) Signal Strength

0.2 sec 0.2 sec

5 10 15 20 25 30 35 40 50 100 150 200 250

Frequency (Hz) Signal Strength

Oops!

slide-21
SLIDE 21

5 10 15 20 25 30 35 40 50 100 150 200 250

Frequency (Hz) Signal Strength

Upsampling causes aliasing in higher frequencies 5

5 10 15 20 25 30 35 40 20 40 60 80 100 120

Frequency (Hz) Signal Strength

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 SR1 = 15 Hz

Upsampling causes copies of the original 5Hz component at multiples

  • f original sampling rate, 15Hz, plus/minus 5Hz

How do we remove these extra high frequency components?

slide-22
SLIDE 22

How to remove the extra high frequency components caused by upsampling using a low-pass filter

5 10 15 20 25 30 35 40 20 40 60 80 100 120

Frequency (Hz) Signal Strength

LPF

5 10 15 20 25 30 35 40 2 4 6 8

Frequency (Hz) Signal Strength

Low pass filter removes these extra high frequency components

slide-23
SLIDE 23

5 10 15 20 25 30 35 40 50 100 150 200 250

Frequency (Hz) Signal Strength

Proof in the pudding: No more aliasing

effects when using low pass filter!

SR1 = 40 Hz SR2 = 10 Hz

All high frequency copies of the 5Hz signal are removed!

LPF

5

5 10 15 20 25 30 35 40 2 4 6 8

Frequency (Hz) Signal Strength

slide-24
SLIDE 24

5 10 15 20 25 30 35 40 50 100 150 200 250

Frequency (Hz) Signal Strength

5 10 15 20 25 30 35 40 2 4 6 8

Frequency (Hz) Signal Strength

Proof in the pudding: upsampling and lowpass filter <==> multirate polyphase filter resampling

LPF

5

MATLAB’S* Polyphase-filter Implemented Resample (by 5) Function

5 10 15 20 25 30 35 40 100 200 300 400 500

Frequency (Hz) Signal Strength

Sample Rate 1 SR1 = 15 Hz Sample Rate 2 SR2 = 75 Hz Sample Rate 2 SR2 = 75 Hz

* MATLAB is an industry standard software which performed all computations and corresponding figures in this presentation