Skip to main content

calcGroundReactionForceAndSlopeError.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% Calculate error between experimental and modeled ground reaction force.
% This function returns the value errors and slope errors.
%
% (struct, struct) -> (Array of double, Array of double)
% Calculate error between experimental and modeled ground reaction force.


function [valueErrors, slopeErrors] = ...
calcGroundReactionForceAndSlopeError(task, modeledValues)
valueErrors(1, :) = task.experimentalGroundReactionForces(1, :) -...
modeledValues.anteriorGrf;
slopeErrors(1, :) = task.experimentalGroundReactionForcesSlope(...
1, :) - calcBSplineDerivative(task.time, ...
modeledValues.anteriorGrf, 2, 25);
valueErrors(2, :) = task.experimentalGroundReactionForces(2, :) -...
modeledValues.verticalGrf;
slopeErrors(2, :) = task.experimentalGroundReactionForcesSlope(...
2, :) - calcBSplineDerivative(task.time, ...
modeledValues.verticalGrf, 2, 25);
valueErrors(3, :) = task.experimentalGroundReactionForces(3, :) -...
modeledValues.lateralGrf;
slopeErrors(3, :) = task.experimentalGroundReactionForcesSlope(...
3, :) - calcBSplineDerivative(task.time, ...
modeledValues.lateralGrf, 2, 25);
end