EECS 598 W10 : Wireless Sensor Networks Homework # 1 : EKG Signal Analysis Homework Due : Thursday, Mar 11, 2010 For many emerging wireless sensor network applications, it will not be possible to wirelessly transmit all of the sensed data from the sensor to a server for storage and processing. There may be many reasons for this, including node mobility, communications disruption, poor channel capacity, or high data rates. In many such cases, sensors will need to locally process data and communicate only interesting results to a server. To be able to construct such applications, designers will need to collect and analyze sensor traces, and develop new signal processing algorithms that are well-matched to limited computation, memory, and communications of these sensors. This assignment will allow you to experience the process first hand. The goal of this assignment is to familiarize you with EKG signals, and simple algorithms for extracting heart rate and other statistics. This assignment uses two EKG data sets (about 10 MB each). The EKG signals are sampled at 360 Hz and each sample is recorded on one line, in scientific notation (e.g. 9.9300000e+002). The files are available online: http://www.eecs.umich.edu/~prabal/teaching/eecs598-w10/traces/ekg1.txt and http://www.eecs.umich.edu/~prabal/teaching/eecs598-w10/traces/ekg2.txt Refer to the following page for details of a stylized heart beat: http://www.a-fib.com/EKGsignal.htm 1. Heart Rate. Design an algorithm to estimate the beat-by-beat heart rate from the data (this is the RR interval). Implement your algorithm in C or Matlab and run it on the two data files. Describe your algorithm and include any figures that might help (e.g. a signal processing chain, data flow diagram, or state machine). Document any assumptions that your algorithm makes (e.g. minimum or maximum expected heart rate) and what would happen if the assumptions were violated. (a) Fastest and slowest RR intervals. What are the *three fastest* single cycle heart rates, in beats per minute, observed in each data set (these values are the reciprocals of the shortest and longest R-R intervals)? At what which points in time, in seconds, do these beats occur (provide the two RR timestamps for each of the fastest beats)? What are the *three slowest* heartbeats and when do they occur? (b) RR Timeline. Estimate the beat-by-beat heart rate using the algorithm you developed and plot the heart rate (BPM) vs time (min). Label your axes and units. For ekg2.txt, does the heart rate algorithm you developed work correctly over the entire data set or just the first quarter? (c) RR Histogram. Plot a histogram of the beat-by-beat heart rate estimates (each bin should represent 1 BPM). Were your assumptions about minimum and maximum heart rates correct? What's the mean and standard deviation of the samples? Visually, does the distribution look Gaussian, uniform, or multi-modal? (d) RR Change. From your beat-by-beat R-R interval estimates, compute the observed change from one beat to the next. For example, if four consecutive R-R intervals (in seconds) are: [0.9, 1.0, 0.95, 0.9], then the beat-by-beat R-R change is [0.9, 0.1, -0.05, -0.05]. Plot a histogram of these RR changes. How quickly does heart rate change in these data sets? 2. QRS Interval. Design an algorithm to estimate the beat-by-beat QRS interval. The QRS interval spans the beginning of the Q wave (downward) to the end of the S wave (upward). Run your algorithm over the data and plot a histogram of the QRS intervals (using 25 equally-spaced bins). Are there any outliers that skew the histogram? If so, eliminate the outliers (at most 5% of the samples) and plot another histogram. Compute the mean and standard deviation of the QRS interval data and report these values. 3. PR Interval. Design an algorithm to estimate the beat-by-beat PR interval and describe how your algorithm works. The PR interval spans the beginning of the P wave (upward) to the peak of the R wave. Run your algorithm over the data and plot a histogram of the PR intervals (using 25 equally-spaced bins). Are there any outliers that skew the histogram? If so, eliminate the outliers (at most 5% of the samples) and plot another histogram. Compute the mean and standard deviation of the PR interval data and report these values. This problem will be more challenging than the other two. Do the best you can and report whe 4. Submission. Your write-up should include: (1) your responses to the three questions above as a PDF or DOC file, (2) a copy of your code that implements your algorithms and generates the figures, and (3) a description of how to run your code to reproduce the results. E-mail these to me at least two hours prior to class on the due date. Late assignments will not be accepted. Assistance Given or Received. Each student needs to write up and submit his or her own work but you may discuss the problems and your approach to solving them with other students in the class (or outside of class). However, if you do discuss the homework with others, please note with whom you discussed this assignment. The goal is to strike a balance between individual contribution, group collaboration, and fair credit. WARNING: Do not wait until the last minute to start this assignment. This is an open-ended but creative problem that will enable you to explore many different ideas, but you need to ensure that you allocate enough time to think about various approaches and try them out. In many cases, there is no "right" answer; you just need to pick something. If you get stuck, talk with other students, but do your own work. In some cases, you may find that there is no single solution that works, but that you may be able to fuse the output of two or more algorithms for better results than either could achieve on its own.