Question: Before starting any coding, you should produce a structured design for your program, using structure charts and / or pseudocode. You should then apply an
Before starting any coding, you should produce a structured design for your program, using structure charts andor pseudocode. You should then apply an incremental development approach to develop your code.
There are many ways that this exercise can be tackled and a good approach is to break the tasks that you need to do down so that they can be implemented in multiple functions that are called by a single main function or script. Read the data: First ask the user for the name of the file. If the file does not exist, the program should flag an error and stop. Otherwise, the program should read in the entire list of dimensional signals from the file and store them in a variable.
Calculate the shift ie breathing motion between the first dimensional signal which we call the reference signal and all subsequent ones. To calculate the shift between any dimensional signal and the reference signal, you should perform an exhaustive search of all possible shifts from to in steps of and return the shift that results in the best match between the reference signal and the shifted signal. The best match will be defined as the
Figure : dimensional signal acquired at two different phases of the breathing cycle endinspiration and endexpiration
one with the smallest mean squared error MSE The MSE between two signals s and s is defined as follows:
M S Efracmax min sumnmin max s ns n
where min and max represent an area of interest in the dimensional signal which contains the liverlung interface. In our case, min and max should be set to and This enables the beginning and end of the signal which may contain signal from other organs to be ignored.
Hint: Read the documentation of the builtin MATLAB function circshift which can be used to apply a known shift to a dimensional signal.
Determine the average shift during the endexpiration position. This should be calculated as the average shift of the most extreme positions towards the feet of the patient.
Calculate the number of measurements that were performed during the endexpiration phase, defined as a shift within pm mathrm~mm of the endexpiration average shift. We refer to this range as the endexpiration window.
Save all the results into a text file which has the following format: rows corresponding to each of the measurements. Each row should contain numbers: the calculated shift and a Boolean indicating whether the measurement was acquired within the endexpiration window or outside These two numbers should be separated by a semicolon.
Plot the evolution of the shift as a function of time during the s of acquisition A blue square should be added to the plot for all measurements performed in the endexpiration window. The window should also be displayed using green dotted lines. The plot should be suitably annotated.
Display the following information: the average shift during the endexpiration window, and the number of measurements acquired within the endexpiration window. Expected output
The expected output plot for your program when run on the provided data file is shown in Fig.
Figure : Expected output of the program when run on the provided data file.
The expected output at the command window for your program when run on the provided data file is as follows:
Average shift in endexperiatory position:
percentage of measurements within gating window:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
