is a matrix of gait analysis data with four columns The firs
is a matrix of gait analysis data with four columns. The first column is Code 2: The MAT file time in seconds, the next three columns represent x, y and z coordinates of an optical marker placed on patient\'s left ankle. The z data (inferior-superior motion of marker) is used to determine when a foot strike (or foot hitting ground occurs). The foot strike event can be determined by looking for troughs, or valleys, in the z data. Write a MATLAB script that does the following: 1. plots the z data with time. The y label is \"inferior-superior left ankle motion (mm), xlabel is time in seconds, and title is \"Inferior-superior left ankle motion over time\" 2. Finds the foot strike events and saves to a MAT file called StepEvent Hint: A valley in a set of data is when the current data point is less than the previous data point AND less than the next data point.
Solution
DATA=load(\'LAankle.mat\');
plot(DATA(:,1),DATA(:,4))
ylabel(\'Inferior-superior left ankle motion (mm)\')
xlabel(\'Inferior-superior left ankle motion over time\')
j=1;
for i=2:length(DATA)-1
T1=DATA(i-1,4);
T2=DATA(i,4);
T3=DATA(i+1,4);
if T2<T1&&T2<T3
Foot(j,1)=DATA(i,2);
Foot(j,2)=DATA(i,3);
j=j+1;
end
end
save(\'StepEvent.mat\',\'Foot\')
