Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in C. Comments would be very helpful int hrdata[]= {518, 516, 515, 514, 514, 514, 516, 518, 520, 524, 528, 532, 537, 541, 544,

image text in transcribed

image text in transcribed

Code in C. Comments would be very helpful

int hrdata[]= {518, 516, 515, 514, 514, 514, 516, 518, 520, 524, 528, 532, 537, 541, 544, 546, 547, 545, 541, 536, 530, 522, 514, 507, 500, 495, 492, 490, 491, 494, 498, 502, 508, 512, 515, 517, 517, 516, 514, 512, 510, 509, 509, 509, 511, 513, 516, 519, 523, 526, 529, 531, 533, 534, 534, 534, 532, 529, 526, 522, 518, 515, 512, 510, 508, 507, 507, 508, 510, 512, 515, 518, 520, 522, 523, 523, 522, 520, 516, 513, 508, 504, 501, 497, 494, 491, 489, 488, 487, 488, 490, 493, 498, 503, 509, 514, 519, 522, 524, 526, 528, 529, 530, 532, 534, 537, 541, 545, 549, 552, 555, 557, 558, 557, 554, 550, 544, 537, 530, 522, 516, 510, 506, 502, 500, 499, 499, 500, 501, 503, 505, 507, 508, 508, 507, 505, 503, 500, 497, 495, 493, 492, 492, 490, 492, 493, 494, 495, 496, 497, 498, 500, 501, 503, 504, 506, 507, 508, 508, 508, 507, 506, 504, 502, 499, 496, 494, 493, 493, 494, 496, 499, 503, 507, 510, 512, 513, 513, 513, 512, 510, 508, 507, 505, 504, 503, 503, 504, 505, 507, 509, 510, 511, 512, 512, 511, 509, 508, 506, 504, 502, 524, 525, 524, 523, 521, 518, 515, 512, 509, 507, 505, 504, 503, 504, 505, 506, 509, 512, 515, 517, 519, 520, 519, 518, 515, 512, 510, 508, 507, 508, 509, 510, 510, 510, 509, 507, 506, 504, 502, 502, 502, 504, 506, 509, 512, 515, 517, 519, 522, 524, 525, 526, 527, 528, 528, 526, 523, 519, 514, 509, 505, 500, 497, 495, 494, 494, 496, 498, 501, 505, 508, 511, 513, 515, 516, 516, 515, 513, 510, 506, 502, 498, 494, 491, 489, 488, 489, 491, 495, 499, 504, 510, 515, 520, 524, 527, 529, 530, 531, 531, 532, 533, 534, 537, 540, 543, 547, 551, 554, 557, 559, 558, 557, 553, 548, 542, 535, 528, 522, 517, 513, 510, 509, 508, 507, 507, 507, 507, 508, 508, 509, 510, 510, 511, 511, 511, 510, 508, 506, 504, 501, 499, 496, 494, 491, 489, 487, 485, 482, 480, 479, 477, 476, 475, 476, 476, 477, 478, 480, 481, 483, 485, 486, 488, 490, 491, 493, 494, 496, 497, 498, 499, 499, 499, 499, 499, 499, 500, 501, 502, 505, 507, 510, 513, 516, 519, 520, 522, 523, 525, 526, 527, 527, 527, 527, 526, 524, 521, 517, 513, 508, 504, 501, 498, 496, 496, 496, 498, 500, 504, 508, 512, 515, 518, 520, 520, 519, 517, 514, 511, 508, 506, 505, 505, 506, 508, 510, 513, 515, 517, 519, 519, 519, 518, 515, 512, 508, 504, 500, 497, 494, 493, 492, 493, 494, 496, 499, 502, 506, 510, 514, 517, 519, 520, 519, 517, 514, 511, 508, 505, 503, 503, 503, 503, 505, 508, 511, 514, 517, 520, 522, 522, 522, 520, 517, 513, 508, 503, 499, 496, 494, 493, 493, 494, 496, 499, 503, 507, 510, 514, 517, 520, 522, 523, 522, 520, 516, 512, 508, 505, 502, 500, 499, 499, 500, 503, 506, 509, 513, 517, 519, 521, 521, 519, 517, 513, 510, 506, 503, 501, 500, 501, 503, 505, 507, 510, 513, 516, 519, 524, 529, 534, 539, 544, 548, 551, 552, 550, 547, 542, 536, 530, 524, 520, 516, 514, 512, 512, 513, 514, 516, 518, 520, 522, 523, 524, 523, 522, 520, 516, 512, 508, 505, 502, 500, 499, 499, 501, 502, 505, 507, 508, 510, 510, 510, 508, 506, 503, 499, 496, 492, 488, 485, 481, 479, 477, 476, 478, 480, 483, 487, 491, 494, 497, 499, 500, 500, 499, 498, 498, 499, 501, 503, 505, 508, 510, 513, 515, 517, 519, 521, 523, 525, 526, 527, 527, 526, 524, 521, 518, 514, 509, 504, 498, 494, 490, 488, 488, 489, 491, 493, 496, 499, 501, 502, 502, 501, 500, 499, 499, 499, 499, 500, 502, 505, 508, 511, 514, 517, 519, 520, 520, 519, 517, 514, 510, 507, 503, 501, 499, 498, 499, 500, 501, 504, 507, 511, 514, 517, 519, 520, 521, 521, 520, 518, 515, 512, 509, 505, 503, 500, 499, 498, 497, 498, 499, 501, 504, 508, 512, 516, 520, 522, 523, 522, 520, 516, 512, 508, 504, 501, 499, 499, 500, 502, 505, 508, 511, 515, 518, 521, 522, 523, 522, 519, 516, 512, 507, 502, 498, 495, 493, 492, 492, 493, 495, 499, 502, 507, 511, 514, 518, 521, 522, 521, 519, 516, 513, 509, 505, 503, 501, 500, 500, 501, 503, 506, 508, 510, 512, 514, 514, 514, 512, 510, 508, 506, 503, 500, 498, 496, 494, 494, 495, 497, 502, 508, 515, 523, 532, 540, 548, 555, 560, 564, 566, 567, 564, 560, 555, 550, 544, 538, 531, 524, 517, 511, 506, 502, 500, 499, 501, 503, 505, 507, 508, 507, 505, 500, 495, 488, 482, 476, 472, 470, 469, 470, 472, 476, 480, 485, 490, 496, 501, 505, 509, 512, 514, 514, 514, 513, 512, 509, 506, 503, 500, 497, 496, 495, 496, 498, 501, 504, 508, 512, 515, 516, 517, 516, 514, 512, 510, 508, 507, 506, 506, 506, 508, 510, 513, 515, 518, 521, 522, 523, 523, 522, 520, 518, 514, 511, 507, 504, 500, 497, 495, 493, 492, 491, 490, 489, 489, 489, 490, 490, 491, 492, 494, 495, 496, 497, 498, 499, 500, 501, 501, 501, 502, 502, 502, 502, 502, 502, 501, 501, 501, 501, 501, 502, 503, 505, 507, 510, 512, 516, 519, 523, 526, 528, 530, 531, 531, 530, 527, 523, 519, 515, 511, 508, 506, 505, 506, 507, 508, 511, 514, 517, 520, 523, 525, 526, 527, 526, 524, 521, 518, 514, 510, 506, 502, 499, 497, 495, 494, 494, 495, 497, 500, 504, 509, 513, 517, 520, 523, 524, 523, 522, 519, 516, 512, 509, 506, 504, 501, 499, 498, 496, 495, 493, 492, 491, 491, 490, 490, 490, 490, 491, 491, 491, 492, 493, 493, 494, 495, 495, 495, 495, 495, 496, 498, 501, 504, 509, 513, 517, 521, 524, 525, 526, 0};
hrdata includes data taken from a watch to measure heart rate and is stored in an array of integers. Samples are taken at 240 Hz. All data values are greater than 0, except the last one. When you find a 0, you know you have hit the end of the array. heartrate data 580 560 540 g 520 500 480 460 0 100 200 300 400 500 600 700 800 900 1000 sample # (Graph of hrdata) You are to estimate the person's heart rate based on the data in hrdata. To do this, you should: 1) Decide what you will call a peak and display a message indicating which value you selected. 2) Locate the indices of the peaks in the hrdata array and store them in an array. If two adjacent points could be the peak, choose the first of the two samples as the peak. Do NOT assume you know the number of peaks, let the code determine that. When declaring the array, you can use the number 10 to make sure you have enough memory 3) Once you have finished creating the array, loop through the array passing the index of each peak and the peak after it to a function. (You will call the function once for each peak.) 4) The function should: a) Display the indices passed to it b) Calculate and display the number of samples between the two peaks c) Calculate and display the time between the two peaks in seconds d) Return the time between the two peaks 5) After you have completed the loop, calculate and display the average time between peaks. 6) Calculate and display the estimated beats per minute. You also want to know how much of a time difference there is between a peak and its corresponding low point (A/D value less than 480) 7) Create another loop that goes through the array of indices, passing each index and the hrdata array to a function. Your loop should start with the second peak instead of the first. 8) The function should: a) Display the index of the peak b) Identify and display the index of the low point after the peak c) Identify and display the A/D values associated with the peak and the low point d) Calculate and display a message indicating the time difference between the peak and the low point e) Return the time difference between the peak and the low point 9) After you have completed the loop, calculate and display the average time difference between the peaks and their associated low points. hrdata includes data taken from a watch to measure heart rate and is stored in an array of integers. Samples are taken at 240 Hz. All data values are greater than 0, except the last one. When you find a 0, you know you have hit the end of the array. heartrate data 580 560 540 g 520 500 480 460 0 100 200 300 400 500 600 700 800 900 1000 sample # (Graph of hrdata) You are to estimate the person's heart rate based on the data in hrdata. To do this, you should: 1) Decide what you will call a peak and display a message indicating which value you selected. 2) Locate the indices of the peaks in the hrdata array and store them in an array. If two adjacent points could be the peak, choose the first of the two samples as the peak. Do NOT assume you know the number of peaks, let the code determine that. When declaring the array, you can use the number 10 to make sure you have enough memory 3) Once you have finished creating the array, loop through the array passing the index of each peak and the peak after it to a function. (You will call the function once for each peak.) 4) The function should: a) Display the indices passed to it b) Calculate and display the number of samples between the two peaks c) Calculate and display the time between the two peaks in seconds d) Return the time between the two peaks 5) After you have completed the loop, calculate and display the average time between peaks. 6) Calculate and display the estimated beats per minute. You also want to know how much of a time difference there is between a peak and its corresponding low point (A/D value less than 480) 7) Create another loop that goes through the array of indices, passing each index and the hrdata array to a function. Your loop should start with the second peak instead of the first. 8) The function should: a) Display the index of the peak b) Identify and display the index of the low point after the peak c) Identify and display the A/D values associated with the peak and the low point d) Calculate and display a message indicating the time difference between the peak and the low point e) Return the time difference between the peak and the low point 9) After you have completed the loop, calculate and display the average time difference between the peaks and their associated low points

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

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

What are Mr. Davies ethical obligations in this situation? (D10)

Answered: 1 week ago

Question

Is SHRD compatible with individual career aspirations

Answered: 1 week ago