## The goal of this question is to refresh some of your Matlab skills. You will need to remember how to use variable names, and how to index the rows and columns of vectors and arrays in Matlab.

### engineering

##### Description

The goal of this question is to refresh some of your Matlab skills. You will need to remember how to use variable names, and how to index the rows and columns of vectors and arrays in Matlab. You will also need to use the functions: load, size, plot, subplot, xlabel, ylabel, hold on, find, diff, mean.

Since 1975, MIT and the Beth Israel Deaconess medical center in Boston have developed a database of ECG recordings from patients at the hospital. Researchers can access and use this data for their own projects, such as developing new instrumentation for detection of arrhythmia, or developing new algorithms to analyze ECG signals.

There is a data file in the Canvas > Files > Homework folder (ECG_data_file.mat) which contains ECG measurements (in millivolts, mV) from 4 patients at the Beth Israel Deaconess medical center. Copy this file into your Matlab current folder

a) Load this data into your Matlab workspace. You will have a variable named “ECG_data” which contains the data points. What is the size of this variable (i.e. how many rows and columns are there)?

b) Each ECG recording was made at 90 samples per second. (I.e. each individual data point was measured 1/90 sec apart). Create a vector of time points matching the length of the ECG data. Plot this vector against the ECG recording for the first patient only. (Check that the size of the vectors match in the Matlab Workspace). Don’t forget to label the axes.

c) Use Matlab’s subplot function to create a figure containing the ECG recordings for all four patients, each in their own separate axes. Use a different color for each recording.

d) Extract the ECG signal for the third patient from the “ECG_data” variable into a new variable and plot the signal versus time in a new figure window. Use Matlab to plot red circles on top of each of the six peaks in this ECG signal. (Hint: Look at the plot and determine a threshold voltage level that identifies the peaks. Then use Matlab’s find function to identify the time points where the peaks occur. Then use this information to add red circles to the plot).

e) Using the information you generated in (d), determine patient 3’s heart rate (in beats per minute). (Hint: Use Matlab’s diff function).