Skip to main content

getToeOffEvent.m


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


function toeOffEvent = getToeOffEvent(slope)

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