Determining heel strike using only kinematic data

6 次查看(过去 30 天)
I am trying to create gait events to split my data in gait cycles using only kinematic data. To do this i am using the foot velocity algorithm. Whilst toe off is simple enough, findings the peaks, the algorithm involves determining heel strike by measuring the second trough in the foot velocity graph (please see attached). I seem to have created a code that works when the second lowest trough is clear and apparent, however my code completely falls apart when the second trough is minimal and/or doesnt exist, leading it missing heel strike events and not splitting the cycles effectively.
Here is my code so far
heel_marker = tTrajectories{:,47}; %heel marker trajectories
heel_marker_ascend = sortrows(heel_marker); %ascends the heel markers
heel_marker_threshold_pos = round(length(heel_marker_ascend)*0.35); %find the 35% position location
heel_marker_threshold = heel_marker_ascend(heel_marker_threshold_pos,1); %finds the value of the threshold
tr_locs = [];
trough = [];
for i = 1:8:length(R_Foot_vert_vel_midpoint) %iterates between every 8 data points
try
minimum = min(R_Foot_vert_vel_midpoint(i:i+7)); %finds minimum within the 8 points
e = find(R_Foot_vert_vel_midpoint==minimum); %finds location of the minimum within the foot velocity data
heel_marker_pos = heel_marker(e);
if (heel_marker_pos < heel_marker_threshold) && (minimum < -50) %if the marker in the position is lower than the heel marker threshold
if minimum < R_Foot_vert_vel_midpoint(e-1) %gradient is before the trough so its not catching it on the accend of the main trough
trough = [trough;minimum]; %add minimum to the trough matrix
tr_locs = [tr_locs;e]; %find location of the minimums in the dataset
end
end
end
end
numtrough = length(trough);
start_point = fix(1);
R_Heel_Strike = [trough tr_locs];
for i = 1:length(R_Heel_Strike)
try
while (R_Heel_Strike(i+1,2) - R_Heel_Strike(i,2)) < 100; %finds any trough that is less than n frames from the previous peak. Helps remove two peaks/troughs that may be caused by unsmooth data
if R_Heel_Strike(i+1,2) < R_Heel_Strike(i,2)
R_Heel_Strike(i,:) = [];
else
R_Heel_Strike(i+1,:) = []; %removes the highest of the two frames
end %removes the values that are less than n frames apart
end
end
end
Hopefully using the example data you can see what I mean, in that it is not picking up every secondary trough per cycle. I would like to add an element to my code that if a trough is not found within the confines here (the heel marker position is lower than the heel marker threshold, the minimum value found is less than 50, and the gradient before the minimum is negative) that a minimum is instead found within the cycle whereby the first two criteria are met.
I hope I have explain this sufficiently, thanks

回答(1 个)

Star Strider
Star Strider 2021-6-29
I am not certain that I understand the problem. In these plots, it appears that the heel strike (orange lines) correspond to the correct foot position in the gait cycle.
What result do you want?
RFoot = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/665215/R_Foot_vert_vel_mipoint.xlsx', 'VariableNamingRule','preserve');
RHeel = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/665220/R_Heel_marker.xlsx', 'VariableNamingRule','preserve');
tF = linspace(0, size(RFoot,1)-1, size(RFoot,1));
tH = linspace(0, size(RHeel,1)-1, size(RHeel,1));
figure
plot(tF, RFoot{:,1})
hold on
plot(tH, RHeel{:,1})
hold off
grid
xlabel('Time Index')
ylabel('Amplitude')
legend('RFoot','RHeel')
figure
for k = 1:10
subplot(5,2,k)
plot(tF, RFoot{:,1})
hold on
plot(tH, RHeel{:,1})
hold off
grid on
% xlabel('Time Index')
% ylabel('Amplitude')
% legend('RFoot','RHeel')
xlim([0 1000]+(k-1)*1000)
end
.
  1 个评论
Jak
Jak 2021-6-29
Thank you for your reply.
I am looking to extract the location of all the second troughs in the midfoot vertical velocity as that point corresponds to heel strike in the gait cycle. My code extracts some of them, but does not find all of them (especially if the trough is not clear) meaning that when I split my data into gait cycles, sometimes they are not split correctly.
I want to add a caveat to my code that if a trough is not found, then the lowest vertical velocity point whilst the heel marker is below the threshold is extracted instead.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Bounding Regions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by