Question
A. Using C++ language, implement the QRS detection algorithm FS1 (picture below) with the following modification: - Divide the ECG signal (mV) by the sampling
A. Using C++ language, implement the QRS detection algorithm FS1 (picture below)
with the following modification: - Divide the ECG signal (mV) by the sampling frequency (fs = 250 Hz). - Since the first and second derivatives of a signal are sensitive to high frequency noise, smooth the ECG signal, X[n], using the following 3-point moving average filter (Hanning filter) prior to differentiation. - Include a blanking period of 0.1 second. - Hence, for the protocol:
-i. Divide the original ECG signal by the sampling frequency, fs = 250 Hz.
-ii. Smooth the scaled ECG signal X[n] using the above Hanning filter.
-iii. Obtain the absolute values of the first and second derivatives of the smoothed ECG signal using the FS1 algorithm, where X in the two equations is the smoothed ECG signal.
-iv. Obtain Y2[n], the scaled sum of the absolute values of the first and second derivatives, as described in the FS1 algorithm
-v. QRS peak is detected at time ti if:
1. Y2[i] threshold = 1.0, and
2. at least 6 of the next 8 points meet or exceed this threshold.
-vi. Once a QRS is detected, apply a blanking period of 0.1 second (i.e., skip searching for QRS for the next 0.1 second).
B. The main program should: - Prompt the user to enter the file name, check if file exists, and if so read in data from the file.
- the file is a .txt file and has two columns separated by spaces
- the first column is time in scientific notation
- the second column is the ECG signal in scientific notation
-here is a screenshot of what the file looks like:
- Make use of the EXIT statement to terminate the program if the file does not exist, and EOF statement to test for an end-of-file condition and to automatically determine the number of data points in each column. - Make use of dynamic memory allocation. - For a given data file, write to an output file (with appropriate messages and units) the number and locations (times in sec) of QRS detected, and the average heart rate (in beats per minute)
I) FSI: This algorithm is a simplification of the QRS detection scheme presented by Balda [9]. The absolute values of the first and second derivative are calculated from the ECG: YO(n) = ABS(x(n + 1)-X(n-1)] 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started