Create an xy plot of ecg vs. time

Assignment Help Database Management System
Reference no: EM13969506

I. Background

In this project we will use Excel to analyze some simulated electrocardiogram (ECG) data for premature beats.

II. Procedure

As you work on your solution, save the file often so that you will not lose work previously done if there is a system failure.

Start a new Excel workbook, and save it immediately under the name uuuuuP4.xls, where uuuu is the first five characters of your cougarnet account username. You must format your spreadsheet to look professional.

You should create two worksheets for use as described below. Label the sheets "Data" and "Plots," and follow the steps below to set up the worksheets.

Step 1: Set up areas in the Data sheet for the TITLE (including your name and email)

Step 2: Set up DESCRIPTION of the task.

Step 3: Set up an area labeled PARAMETERS. In this area, place any parameters (perhaps in named cells) that your calculations will be using.

Step 4: Finally, follow all of this with the CALCULATIONS area where you begin computations for each task.

Save your work often so that you do not accidentally lose hours of work!


You will import a data file of ECG data and process it looking for premature beats. You will do this by first detecting the times of occurrence of the large R-wave peaks in the data. Then you will measure the time duration between consecutive R-wave peaks. Any R-wave peak that occurs after a duration that is unusually short will be considered premature. You will detect the first such premature beat and report its time of occurrence and duration.

Data File: The initial data set you will work with is named p1inputdata.txt and is located in the assignment directory on the course website. The file contains a simulated ECG sample. (These sample values are not particularly close to true ECG values. For one thing, there are only about 40 samples per "heart beat", representing a sample rate approximately 1/3 of what it should be. But an accurate ECG data set would have been larger than we would want to work with; and you must admit, the simulated data doesn't look too bad!) Copy the file to your MyProj1 directory. You will import that data into your worksheet; however, your worksheet must be kept sufficiently general so that when we import a different file when grading your project, it will still execute correctly--without anybody making additional changes. We will execute your workbook with a different set of values! Both columns of data will be different.

The format of the data file is : Each line of the file has two values, separated by a tab. The first value is a time in milliseconds (ms); the second value is the ECG value in millivolts (mV).

Important: In each of the tasks below, when you are asked to create a column of data:

- Label the column appropriately at the top.

- Color the column as requested in the task.

- Consistency: Please be consistent with using BLANK or 0. If you start with BLANK, use that till the end.

- You may wish to insert additional columns with intermediate results that help you compute the requested column. For any such intermediate columns, color them the same as the requested column and group them side-by-side. Place the label over the requested column.

Task 1: (Import the data) On the Data worksheet in the Calculations area, import the data from p1inputdata.txt. Label the first column "Time (ms)" and the second column "ECG (mV)". Color both of them light gray. They will be the first two columns in a series of columns, so make them columns A and B. As stated above, when we grade your project, we will use a similarly organized, but different file. However, you may assume that the file will always have the same number of rows as p1inputdata.txt, so you can structure your spreadsheet accordingly.

Task 2: (Plot the ECG data) Create an XY plot of ECG vs. time, and place the plot on the Plots worksheet. Give the plot an appropriate title and labels for axes, and adjust various parameters of the plot to make it look pleasing and professional. Resize it to approximately the width of the screen.

Task 3: (Filter the ECG) As you can see from the plot, the ECG has a wandering baseline. You will first need to filter the ECG to remove that low frequency component. A simple (though imperfect) algorithm to use is to subtract from each value the mean of the values in a "window" around it. This works if the undesired baseline component is fairly constant over the window, but the ECG itself varies positive and negative and does not contribute much to the mean. For example, for a window of 2M+1 values, the filtered value of yn (the value of output y at data index n) would be:

A reasonable window width for this exercise would be 7, and thus a value of M=3. To the right of the ECG column add a yellow column that produces the filtered ECG. You will have to take care of the endpoints. The first and last three values cannot use the formula above exactly. Instead, you will have to adjust the window so that it is not centered over the data point being filtered. If you make the correct adjustments, you should be able to filter the entire ECG column in a reasonable way.

Task 4: (Plot the filtered ECG data) On the Plots worksheet, place a second plot showing the filtered ECG directly under the first plot. Make it look professional in the same way as the first plot.
Pause for Problem Solving: Now study the data carefully. Reread the Objective above. Can you figure out an algorithm for meeting the objective before reading the steps outlined below?

Task 5: (Find local peaks) The next step is to find peaks, or local maxima, of the data. (We do this so that we can find from among these the tall peaks in the next task.) In a light purple (lilac) column to the right of the filtered data, enter a formula that will display one result (perhaps 1, or the filtered value itself) if the current filtered value is a local maximum, or another result (perhaps 0, or BLANK) if the current filtered value is not a local maximum. Again, you will have to take care of the end points; it is reasonable in this case to skip the first and last values in the column, since it is not possible to determine if they are local maxima.

Task 6: (Find R-wave peaks) We will say that a local peak is an R-wave peak if it is at least 5 times larger than the median value of all of the local peaks. Compute the median value of the local peaks and store it in a named labeled cell called "MedianPeak" in the Parameters area. Next, in a light blue column to the right of the local peaks, enter a formula that will display one result (perhaps 1) if the current filtered value is an R-wave peak, or another result (perhaps 0, or BLANK) if the current filtered value is not an R-wave peak.

Task 7: (Compute durations) We now need to compute the durations between consecutive R-wave peaks. Do this by creating two pink columns to the right of the R-wave peaks. In the first column, create a counter that starts at 1 in the row following each R-wave peak and increments for each row (i.e., for each time index), reaching a maximum at the next R-wave peak. There is one exception: Since the ECG data begins somewhere in the middle of a duration, the first duration will appear to be artificially short; therefore, start the first counter at a high value, say, 1000, so that the computed first duration cannot possibly be detected as premature.

In the second column, enter a formula that will display one result ( the duration value itself) on each row corresponding to an R-wave peak, or another result (perhaps 0,BLANK) if the current row does not correspond to an R-wave peak.

Note: The description above refers to counting by ones, so that duration would be in units of "number of samples." However, in Task 9 below you must report the final premature duration in units of milliseconds. You can choose either to convert to milliseconds in Task 9 if you wish, or in this task you can do the counting in milliseconds. Therefore, either in this task or in Task 9, create a named labeled cell called "Interval" in the parameters area that stores the sample time interval in milliseconds. Since the time intervals in the first column of data are assumed to be uniform, simply take the difference between the first two time values to obtain the sample time interval.

Task 8: (Find premature beats) We will say that an R-wave peak is premature if its duration since the previous R-wave peak is less than 85% of the median value of all the durations (why median, and not mean?). First, compute the median value of the durations and store in a named labeled cell called "MedianDuration" in the Parameters area. Next, in a green column to the right of the durations, enter a formula that will display "premature" for each row with a premature R-wave peak, "normal" for each non-premature R-wave, and BLANK for the other rows.

Task 9: (Detect first premature beat) The previous task should have produced a column indicating which beats were premature and which were normal. In a few labeled cells to the right of that column, with a heavy red border around these cells, compute and report the following:

- The time value (from the first column) of the R-wave peak corresponding to the first premature beat.

- The actual duration in milliseconds of the first premature beat.

III. Turn in Your Project

Submit your final Excel file to Project 1 on Blackboard Learn. Projects delivered by email will not be accepted. You should always verify files have uploaded properly after submission.

Remember that projects turned in after the due date will not be accepted.

Reference no: EM13969506

Apply the validation rules in table design properties

Validation rules in the table design properties are known as column level as you can only reference one field, such as Amount > 100. (you did this with the Units Field - rem

List and discuss the five transaction properties

List and discuss the five transaction properties. What is a transaction log, and what is its function? What is a deadlock, and how can it be avoided? Discuss several strategie

Design a star schema to organize the sales information

Design a star schema to organize the sales information to meet the marketing department needs. Identify the dimensions first, and then identify the attributes of those dimen

Create an action query that makes a table called westcoast

Create an action query that makes a table called WestCoast, with the following records. CA, WA, OR Create an action query to add the NV records to the newly created WestCoas

Number of filenames as command-line arguments

Write the script called checking that will take any number of filenames as command-line arguments and will print the names of those files that are readable and writeable tex

Technical paper on database

This Final Project Paper must be a technical paper on Database topics that have been pre-approved in earlier weeks by your instructor, using knowledge gained in the course.

Provide data for a management report

In this assignment, the software is used to provide data for a management report. The focus is not learning a software package, but the report and the data required to make

Determine which response format would be the most effective

CIS375- Online questionnaires enable companies to gather data from a large number of possible responders. For a web-based questionnaire, determine which response format woul


Write a Review

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd