Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write the code as if the heart.txt was loaded into matlab. I just need an idea of how to write the code Exercise 3.8
please write the code as if the heart.txt was loaded into matlab. I just need an idea of how to write the code
Exercise 3.8 A company is trialling a portable personal device that monitors a range of clinical indicators. One of these is heart rate, and the company would like to embed some software in the device to raise an alert if a sudden change occurs in the heart rate. The file heart.txt contains sample heart rate data, acquired once per minute from a patient who was wearing the new device. Your task is to write a MAT- LAB script m-file that reads this data into an array, and searches for any sudden changes in heart rate. A sudden change is defined as a heart rate that is more than 20% different (i.e. larger or smaller) than the average of the previous five heart rate values. Therefore, you should only start to look for sudden changes from the 6th measurement onward. When your program identifies a sudden change it should display a warning such as: Warning - abnormal increase in heart rate at 123 minutes As the heart rate measurements are made once per minute you can simply use the array index of the abnormal value as the time of the sudden change. Note that the program should indicate whether the heart rate change was an increase or a decrease. All sudden changes within the array should be reported. If no sudden changes are detected the following message should be displayed: No abnormal changes detected As part of your solution you should define a function m-file that takes an array of heart rate values as its only input argument and returns as its output an array of the indices of all sudden changes and also values indicating whether each change was an increase or decrease. If the function is provided with an empty array it should exit with an appropriate error message. A separate script should call your function and should also take responsi- bility for reading the data (see Section 1.6) and printing the output mes- sage(s)Step by Step Solution
There are 3 Steps involved in it
Step: 1
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