Skip to main content

getHeelStrikeEvent.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function identifies the heel strike event by detecting changes in
% slope of the normal force. To avoid erroneous detection of a heel strike
% event, the slope of the normal force must be positive for at least 10% of
% the time. Detects only one heel strike (use for only one gait cycle).
%
% (Array of number) -> (Number)
%


function heelStrikeEvent = getHeelStrikeEvent(slope)

timePadding = round(length(slope) * 0.10);
heelStrikeEvent = [];
for i = 2 : length(slope) - timePadding
if slope(i - 1) == 0 && all(slope(i : i + timePadding) > 0)
heelStrikeEvent = i;
end
end
end