Answered step by step
Verified Expert Solution
Question
1 Approved Answer
ECG (electrogardiogram) signals are signals taken from the human body in order to measure the activity and health of the human heart. An ECG
ECG (electrogardiogram) signals are signals taken from the human body in order to measure the activity and health of the human heart. An ECG signal shows whether a patient has heart disease (called abnormal signal) or does not have heart disease (normal signal). The figure below shows 3 ECG signals. The top 2 are normal and the third one is abnormal. These signals were taken from real data representing patients at a hospital. ** LEI An ECG signal is represented in the computer using a 1-D array of data. You are to write a program that measures the similarity between 2 ECG (heart) signals. You will measure the similarity of the top signal (Reference - Normal) compared to the bottom two signals. The similarity measure for this homework assignment is the "normalized correlation" which is shown, below, in Equation (1). As it may be expected, the 2 normal signals are similar and therefore should have a positive value of the computed correlation. The correlation value between the Reference signal and the Abnormal (3 signal) should be negative because the 2 signals are not similar to a good extent (see the output, below). ... Equation (1) such that ... Equation (2) x and y are the 2 input signals (1-D arrays), and n is their array size (all 3 arrays should have the same size). You are provided with 3 text data files. Each data file has the values of one 1-D array. You may assume a maximum array size 1000. All of the values are real numbers (double). The 3 files have an equal number of values (sizes). However, the number is not provided here in the statement. You should find the size of the data. You should read the files until the end of file is reached (EOF). The 3 file names are "ReferenceECG.txt", "NormalECG.txt", and "AbnormalECG.txt". There are no other experiments or files to read from. You are expected to write your code using Modular Programming. Your code should have at least the following 2 functions: normcorr() takes as input the 2 arrays x andy and their size, and returns the computed value of their normalized correlation, not provided here in the statement. You should find the size of the data. You should read the files until the end of file is reached (EOF). The 3 file names are "ReferenceECG.txt", "NormalECG.txt", and "AbnormalECG.txt". There are no other experiments or files to read from. You are expected to write your code using Modular Programming. Your code should have at least the following 2 functions: normcorr() takes as input the 2 arrays x and y and their size, and returns the computed value of their normalized correlation, using Equation (1). E() takes as input one 1-D array and returns the sum-squared of its elements, using Equation (2). How to interpret your correlation results: If normcorr() function returns a positive value, the 2 input signals have similarity. In this case normcorr() will return a value greater than zero but less than or equal to 1. For example, 0.71. In this case, the similarity between the 2 input signals (1-D arrays) is 71%. If normcorr() function returns a negative value, the 2 input signals have dissimilarity. In this case normcorr() will return a value greater than or equal to -1 but less than zero. For example, -0.33. In this case, the dissimilarity between the 2 input signals (1-D arrays) is 33%. A zero value that is returned by the normcorr() function means that the 2 input signal have no correlation between them, and therefore, no similarity. Expected output after running the code: The correlation between the Reference ECG and the Normal ECG is 0.964719 Therefore, the similarity between the Reference ECG and the Normal ECG is 96.5% The correlation between the Reference ECG and the Abnormal ECG is -0.195468 Therefore, the dissimilarity between the Reference ECG and the Abnormal ECG is 19.5%. Evaluation: Evaluation is based on the completeness of the implementation of the tasks assigned in this homework. For example, there will a substantial loss of points if the instructions are not followed: 1. If code is not modular. 2. If the functions listed, above, are not used. 3. If results are not correct or if code does not compile.
Step by Step Solution
★★★★★
3.37 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
Answer 1 The normalized correlation is a measure of the similarity of two ECG signals It is computed by taking the average of the product of the two signals and then dividing by the product of the sta...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