Skip to main content

calcGoalWalkingSpeedIntegrand.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the difference between the walking speed and the
% error center specified by the user. On average, normal walking speed is
% around 1.2 to 1.4 meters per second.
%
% (struct, struct, struct, struct) -> (Array of number)
%


function cost = calcGoalWalkingSpeedIntegrand(modeledValues,...
params, costTerm)

errorCenter = valueOrAlternate(costTerm, "errorCenter", 1.3);
strideLength = calcStrideLength(values, modeledValues,...
params);
speed = strideLength / values.time(end);
cost = calcTrackingCostArrayTerm(speed * ones(length(values.time), 1), ...
errorCenter * ones(length(values.time), 1), 1);
end