2- Filtering of an ECG Signal Corrupted by Power Supply Hum
The signal in this part is a simulated heartbeats ECG (electrocardiogram) signal. A Matlab function to generate a "clean" ECG signal is included at the end of the documentation of the function 'filtfilt'. It's 500 samples long. The sampling rate is assumed to be 500 samples per second (Hz).
i) Concatenate 4 ECG pulses of length 500 samples each to create a 2000 samples long signal ecg1 = [ecg(500) ecg(500) ecg(500) ecg(500)]. Generate the same length cosine signal sn of frequency = 60 Hz, amplitude = 0.2, and phase = 0, sampled at the same rate Fs = 500 Hz as the ecg1 signal. Add these two signals to generate a simulated corrupted signal xn = ecg1 + sn.
ii) The corrupted signal xn = ecg1 + sn may be filtered to remove the 60 Hz interference using a second-order IIR notch filter similar to the one discussed in class (SD08). Here, however, we will use a bandstop filter of specifications similar to the one used in the Matlab example at the link below. The example invokes the high-level Matlab function 'designfilt' to design a bandstop filter of bandwidth = 2 Hz centered on 60 Hz to remove similar interference (type 'help designfilt' to know more about this powerful function). It returns a filter "object" that may be used as the input to many other functions to replace the a and b coefficients. Follow similar steps here and use 'designfilt' and use the output object in 'filtfilt' to filter xn and generate the output signal yn. Comment on your result.