Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use MATLAB please (30 pts.) Interpolation and downsampling. We often have to add and remove samples of discrete time-signals. There are several reasons we might

image text in transcribed

Use MATLAB please

(30 pts.) Interpolation and downsampling. We often have to add and remove samples of discrete time-signals. There are several reasons we might do this. We may want to change the sampling rate of a signal. For example, if we sample an ECG signal at 2 kHz but we need the signal at 4 kHz for some of our fancy automatic ECG analysis methods then we need to double the number of signal data points using interpolation, but then later for storing the signal we may not want to save data we don't need, so we go back and downsample the signal back to 2 kHz by removing every other sample. In other cases, perhaps, in very precise measurements of heart beat, we may want to shift a signal by a fractional number of samples. In this case, we need to interpolate new data points between our original data points. a.) (5 pts.) Create a signal that resembles respiratory volume over time. Start with a sine wave and let fo=0.18 Hz and fs=1 Hz. Set the amplitude to 700 ml, and then add a 1900 ml offset because we don't breathe out all of our lung volume and we certainly don't generate a negative volume! Assume this first signal starts at t=0s and no phase offset. Include a plot of your mock-respiration signal starting at time t=0s, and extending for exactly 3 complete cycles. b.) (15 pts.) i.) Create a Matlab routine that increases the sampling frequency by an integer multiple. For example, it interpolates the data from part a from 1 Hz to 7 Hz, etc. Use your own implementation of linear interpolation. Do not use any of Matlab's built in functions. ii.) Interpolate your signal from 1 Hz up to 4 Hz. Plot this signal on the same axes as a signal using the parameters from a) except make the signal using a 4 Hz sampling frequency iii.) Compute the error between the interpolated and actual signals in b. This is computed by subtracting the two signals, squaring, then summing and finally normalizing by the number of samples. This is your error power, which should seem similar to what you learned about regression error in QM I. Report this error power value, and then convert it to dB relative to the power in the signal sampled at 4 Hz iv.) In part iii.) above, what represents a better match between the two signals, 0 dB or -30 dB? c.) i.) (10 pts.) Create an identical sinusoid to the above signal from a new subject. Use the same parameters, but assume we started acquiring data 1.3 seconds later than with the "subject" that generated the signal in part a. In this case, our first sample is at t=0 seconds, but we have some kind of time shift related to our 1.3 second delay. Plot this second signal on top of the first signal and label the signals from part a and c. ii.) (TK pts.) Based on the time shift between the signal from parts (ci) and parts (a) time shift the signal from (ci) so that it lines up with the signal from a. You may need to shift by pixels AND shift using interpolation. *Note: The interpolation function from part b may not be directly useful depending on how you set it up. Plot the signal a and the time shifted version of the signal from ci. iii.) (TK pts.) Compute the error between signal a and the signal in ci just as you did in part iii. (30 pts.) Interpolation and downsampling. We often have to add and remove samples of discrete time-signals. There are several reasons we might do this. We may want to change the sampling rate of a signal. For example, if we sample an ECG signal at 2 kHz but we need the signal at 4 kHz for some of our fancy automatic ECG analysis methods then we need to double the number of signal data points using interpolation, but then later for storing the signal we may not want to save data we don't need, so we go back and downsample the signal back to 2 kHz by removing every other sample. In other cases, perhaps, in very precise measurements of heart beat, we may want to shift a signal by a fractional number of samples. In this case, we need to interpolate new data points between our original data points. a.) (5 pts.) Create a signal that resembles respiratory volume over time. Start with a sine wave and let fo=0.18 Hz and fs=1 Hz. Set the amplitude to 700 ml, and then add a 1900 ml offset because we don't breathe out all of our lung volume and we certainly don't generate a negative volume! Assume this first signal starts at t=0s and no phase offset. Include a plot of your mock-respiration signal starting at time t=0s, and extending for exactly 3 complete cycles. b.) (15 pts.) i.) Create a Matlab routine that increases the sampling frequency by an integer multiple. For example, it interpolates the data from part a from 1 Hz to 7 Hz, etc. Use your own implementation of linear interpolation. Do not use any of Matlab's built in functions. ii.) Interpolate your signal from 1 Hz up to 4 Hz. Plot this signal on the same axes as a signal using the parameters from a) except make the signal using a 4 Hz sampling frequency iii.) Compute the error between the interpolated and actual signals in b. This is computed by subtracting the two signals, squaring, then summing and finally normalizing by the number of samples. This is your error power, which should seem similar to what you learned about regression error in QM I. Report this error power value, and then convert it to dB relative to the power in the signal sampled at 4 Hz iv.) In part iii.) above, what represents a better match between the two signals, 0 dB or -30 dB? c.) i.) (10 pts.) Create an identical sinusoid to the above signal from a new subject. Use the same parameters, but assume we started acquiring data 1.3 seconds later than with the "subject" that generated the signal in part a. In this case, our first sample is at t=0 seconds, but we have some kind of time shift related to our 1.3 second delay. Plot this second signal on top of the first signal and label the signals from part a and c. ii.) (TK pts.) Based on the time shift between the signal from parts (ci) and parts (a) time shift the signal from (ci) so that it lines up with the signal from a. You may need to shift by pixels AND shift using interpolation. *Note: The interpolation function from part b may not be directly useful depending on how you set it up. Plot the signal a and the time shifted version of the signal from ci. iii.) (TK pts.) Compute the error between signal a and the signal in ci just as you did in part

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions