Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

BME-514

LAB 1

Spring 2024

PART A: Aliasing as a result of undersampling

An analog signal of unknown composition was sampled at 100 Hz. 500 samples of the signal are contained in the datafile "signal.mat".

(1) Compute and plot the periodogram (ie. power spectrum), Pyy, of the signal (y) using the

following MATLAB commands:

Y = fft(y);

Pyy = Y.*conj(Y)/N;

f = fs*(0:N/2)/N;

plot(f,Pyy(1:N/2 + 1))

(note that "fs" stands for sampling frequency = 100 Hz, and N = total # data points). What frequency components make up the signal?

(2) Let's explore what would happen if the original signal was sampled at 50 Hz instead of 100 Hz. You can simulate this lower sampling rate by reading every other data value into your program. Compute and plot the power spectrum of this decimated data record. Compare this result with that in Question (1).

(3) If any aliasing has occurred, explain with the help of illustrations how each of the "aliases" was produced.

PART B: Designing a Digital Notch Filter to attenuate heart-beat artifacts

The goal in this section is to design a nonrecursive digital notch filter with center frequency f0  Hz and stopband 0.9f0  to 1.1f0  Hz.  If the two-sided filter impulse response is hn  (-N < n < N), the output, y, of the filter is determined by past, present and future values of the input x in the following way:

The two-sided impulse response of the ideal low-pass filter is:

hL(n)  =  (sin nωcT)/nπ    for  |n| > 0,1,..,N

where ωc  is the cut-off frequency (in rad/s) of the low-pass filter and T is the sampling interval. We can convert this low-pass filter into a band-stop filter with the transformation:

                                            hB(n) = 1 - 2hL(n)                              for n = 0

= - 2 cos(nωoT) hL(n)                        for |n| > 0

where ωo  is the center frequency (in rad/s) of the band-stop filter. The stopband of this latter filter covers the frequencies  ωo-ωc  to ωo+ωc, where ωc  is defined above.

Here, you are given a dataset, named “Pes.mat” containing esophageal pressure measurements, sampled at 15 Hz (=1/T).  Plot this signal vs time (in secs) – then compute and plot its periodogram using the code you used in Part A. From the periodogram, determine the primary   frequency of the heart-beat artifacts – and use this as the center frequency (f0  Hz) of your notch filter.  Also, assume two implementations of the filter: one with N=10 and the other with N=20.

(1) Present magnitude and phase plots of your final digital notch filters (one with N=10 and the other for N=20), with the frequency scale plotted in units of Hz.

(2) Apply both filters to the esophageal pressure signal. (In Matlab, use the “filter” function.) Present time-plots of the signals before and after filtering.

(3) Compute and plot the power spectra (periodograms) of the raw and filtered signals for both cases (N=10 and N=20).

(4) From your results, what can you conclude about the effect of changing N?

INSTRUCTIONS ON SUBMISSION OF LAB “REPORT” :

Please answer the questions in this lab concisely (there’s no need for long explanations or

derivations) and in the order in which they were asked. Please submit your “report” (solutions) in the form of a PDF file (again, please keep this as compact as possible!). Where applicable,

include also the Matlab/Python code that you have written to arrive at the solutions. Please put all your files in a zip-folder and upload the zip folder to Blackboard.

LAB 1 REPORT DUE ON: MONDAY, JANUARY 29 AT 11:59 pm