tutorial using matlab
play

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


  1. 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 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

  2. I. Signal processing background

  3. 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: 600 1 500 0.5 Signal Strength Signal Value 400 Peak signal 0 strength at 5 Hz 300 200 -0.5 100 -1 BW 0 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 Time (sec) Frequency (Hz) time representation (sec) frequency representation (Hz)

  4. Add high frequency components 600 1 500 Signal Strength 0.5 400 1. Original Signal Value 300 5 Hz signal 0 200 -0.5 Adding high BW = 5 Hz 100 -1 0 frequency 0 5 10 15 20 25 0 0.2 0.4 0.6 0.8 1 Frequency (Hz) Time (sec) components 600 creates 2. Add a 2 500 jagged 1.5 Signal Strength 400 10 Hz edges in Signal Value 1 300 component the original 0.5 200 0 BW = 10 Hz 5 Hz signal. 100 -0.5 0 -1 0 5 10 15 20 25 Frequency (Hz) 0 0.2 0.4 0.6 0.8 1 Time (sec) 600 3 3. Then add 500 2 a 15 Hz Signal Strength 400 Signal Value 1 component! 300 200 0 BW = 15 Hz 100 -1 0 0 5 10 15 20 25 0 0.2 0.4 0.6 0.8 1 Frequency (Hz) Time (sec)

  5. Sampling the signal: N yquist Rate • 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. 600 500 400 Signal Strength 300 200 Signal Nyquist Rate N R bandwidth = 2 x 15Hz BW = 15 Hz = 30 Hz 100 0 0 5 10 15 20 25 30 35 Frequency (Hz) RULE: Sampling Rate S R ≥ Nyquist Rate N R

  6. Sampling the signal: N yquist Rate Since Bandwidth BW = 15 Hz, the Nyquist Rate N R = 2 x 15Hz = 30Hz. RULE #1: Sampling Rate S R ≥ Nyquist Rate N R 200 3 2 150 Signal Strength Signal Value 1 100 Signal 0 bandwidth 50 Sample Rate BW = 15 Hz S R = 40 Hz -1 0 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 30 35 40 Time (sec) Frequency (Hz) Let Sample Rate S R = 40 Hz, Nyquist Rate N R = 30 Hz so sample signal every 0.025 sec (25 milliseconds).

  7. 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. Rule #2: Nyquist Frequency N F ≥ Bandwidth BW 200 150 Signal Strength 100 Nyquist Freq N F Signal = 40/2 50 bandwidth = 20 Hz BW = 15 Hz Sample Rate 0 S R = 40 Hz 0 5 10 15 20 25 30 35 40 Frequency (Hz)

  8. II. Downsample Example

  9. Recall, our original signal at 5Hz… 600 1 1. Original 500 0.5 Signal Strength 400 Signal Value 5 Hz signal 0 300 BW = 5 Hz 200 -0.5 100 -1 0 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 Time (sec) Frequency (Hz) 2. We added 3 600 10 & 15 Hz 500 2 Signal Value Signal Strength 400 components! 1 300 0 BW = 15 Hz 200 -1 100 0 0.2 0.4 0.6 0.8 1 0 Time (sec) 0 5 10 15 20 25 Frequency (Hz) 200 3 3. Then we 2 150 sampled at Signal Strength Signal Value 1 S R1 = 40Hz 100 0 50 BW = 15 Hz -1 0 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 Time (sec) Frequency (Hz)

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

  11. Nyquist Freq < Bandwidth  Cannot recover original signal bandwidth, since new Nyquist Frequency (5Hz) is less than the desired signal bandwdidth BW (15Hz). N F2 < BW means we cannot recover 15Hz BW signal 200 150 Signal Strength 100 Signal Nyquist Freq 1 Nyquist Freq 2 50 bandwidth N F1 = 40/2 N F2 = 10/2 BW = 15 Hz = 20 Hz = 5 Hz 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) Is the original 5Hz signal recoverable? It should be, since N F2 ≥ BW 5 Hz

  12. Why 5Hz signal not recoverable: High Frequency band causes aliasing when downsampled Will wrap down to 0Hz 200 150 Signal Strength 100 Nyquist Freq 1 N F1 = 40/2 Signal = 20 Hz Nyquist Freq 2 50 bandwidth N F2 = 10/2 BW = 15 Hz = 5 Hz 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) High frequency band N F2 N F1 High frequency band will wrap down to 0Hz when downsampled

  13. Why 5Hz signal not recoverable: Aliasing Effects 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 . 180 3 160 Recovered 5Hz 140 2 component 120 Signal Value Signal Strength 1 100 80 0 Aliasing effects: high 60 frequency components 40 -1 wrapped around to 0Hz! 20 0 0.2 0.4 0.6 0.8 1 Time (sec) 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) S R2 = 10 Hz … unless we remove the high frequency components before downsampling .

  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. 200 100 150 80 Signal Strength Signal Strength LPF 60 100 40 50 20 0 0 5 10 15 20 25 30 35 40 0 Frequency (Hz) 0 5 10 15 20 25 30 35 40  It removes the jagged edges that were due to Frequency (Hz) high frequencies. 3 1 2 0.5 Signal Value Signal Value LPF 1 0 0 -0.5 -1 -1 0 0.2 0.4 0.6 0.8 1 4 4.2 4.4 4.6 4.8 5 Time (sec) Time (sec)

  15. Proof in the pudding : No more aliasing effects when using low pass filter! 200 5 150 4 Signal Strength 4 Signal Strength 3 LPF 100 2 50 1 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) S R1 = 40 Hz S R2 = 10 Hz The original 5Hz signal is successfully recovered!

  16. Proof in the pudding : LPF+downsampling <==> multirate polyphase filter resampling Sample Rate 2 S R2 = 10 Hz 5 4 Signal Strength 4 3 LPF 200 2 150 Signal Strength 1 100 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) 50 Sample Rate 2 MATLAB’S * 0 0 5 10 15 20 25 30 35 40 S R2 = 10 Hz Frequency (Hz) Polyphase-filter Implemented Resample (by 1/4) Sample Rate 1 S R1 = 40 Hz Function * MATLAB is an industry standard software which performed all computations and corresponding figures in this presentation

  17. III. Upsampling example

  18. Assume our original signal at 5Hz… 600 1 1. Original 500 0.5 5 Hz signal Signal Strength 400 Signal Value 0 300 200 BW = 5 Hz -0.5 100 -1 0 0 0.2 0.4 0.6 0.8 1 0 5 10 15 20 25 Time (sec) Frequency (Hz) Nyquist Rate N R = 2 x BW 5Hz = 10Hz, so sample at sampling rate S R = 15Hz 250 1 200 2. We sample Signal Strength 0.5 150 at S R1 = 15Hz Signal Value 0 100 -0.5 50 BW = 5Hz 0 -1 0 5 10 15 20 25 0 0.2 0.4 0.6 0.8 1 Frequency (Hz) Time (sec)

  19. Resample the sampled signal: upsampling 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 ). 0.2 sec 0.2 sec 1 1 0.5 0.5 Signal Value Signal Value 5 0 0 -0.5 -0.5 -1 -1 0 0.2 0.4 0.6 0.8 1 0 0.05 0.1 0.15 0.2 Time (sec) Time (sec) Sample Rate 1 Sample Rate 2 S R1 = 15 Hz S R2 = 75 Hz

  20. Upsampled signal in frequency representation 0.2 sec 0.2 sec 1 1 0.5 0.5 Signal Value Signal Value 0 0 -0.5 -0.5 -1 -1 0 0.2 0.4 0.6 0.8 1 0 0.05 0.1 0.15 0.2 5 Time (sec) Time (sec) Sample Rate 2 Sample Rate 1 S R2 = 75 Hz S R1 = 15 Hz Oops! 120 250 100 200 80 Signal Strength Signal Strength 150 60 100 40 50 20 0 0 0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40 Frequency (Hz) Frequency (Hz)

  21. Upsampling causes aliasing in higher frequencies Upsampling causes copies of the original 5Hz component at multiples of original sampling rate, 15Hz, plus/minus 5Hz Mirror Images at: 15 – 5 = 10 Hz 15 + 5 = 20 Hz 120 2*15 - 5 = 25 Hz 250 100 2*15 + 15 = 35 Hz 5 200 … 80 Signal Strength Signal Strength 150 60 100 40 Signal bandwidth 50 BW = 5 Hz 20 0 0 0 5 10 15 20 25 30 35 40 0 5 10 15 20 25 30 35 40 Signal Frequency (Hz) Frequency (Hz) Sample Rate 1 bandwidth S R1 = 15 Hz BW = 5 Hz How do we remove these extra high frequency components?

  22. How to remove the extra high frequency components caused by upsampling using a low-pass filter 8 120 100 6 Signal Strength 80 Signal Strength 4 60 LPF 40 2 20 0 0 5 10 15 20 25 30 35 40 0 0 5 10 15 20 25 30 35 40 Frequency (Hz) Frequency (Hz) Low pass filter removes these extra high frequency components

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend