Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help by showing me the entire code you would use by opening and writing to a new file with the FS1 algorithm and Hanning

Please help by showing me the entire code you would use by opening and writing to a new file with the FS1 algorithm and Hanning filter and the sampling frequency of 250 Hz and blanking period of 0.1 seconds!

Im very confused by the order of how to write this code!

A. Using C++ language, implement the QRS detection algorithm FS1 (picture below)

image text in transcribed

image text in transcribed

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.

image text in transcribed

- 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

-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)

-here is a screenshot of what the file looks like:

image text in transcribed

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)] 2<>

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions