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
댓글 수: 0
답변 (1개)
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
.
참고 항목
카테고리
Help Center 및 File Exchange에서 Bounding Regions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!