Skip to main content

calcGroundReactionMomentAndSlopeError.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% Calculate error between experimental and modeled ground reaction moments.
% 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 moments.


function [valueErrors, slopeErrors] = ...
calcGroundReactionMomentAndSlopeError(task, modeledValues)
valueErrors(1, :) = task.experimentalGroundReactionMoments(1, :) -...
modeledValues.xGrfMoment;
slopeErrors(1, :) = task.experimentalGroundReactionMomentsSlope(...
1, :) - calcBSplineDerivative(task.time, ...
modeledValues.xGrfMoment, 2, 25);
valueErrors(2, :) = task.experimentalGroundReactionMoments(2, :) -...
modeledValues.yGrfMoment;
slopeErrors(2, :) = task.experimentalGroundReactionMomentsSlope(...
2, :) - calcBSplineDerivative(task.time, ...
modeledValues.yGrfMoment, 2, 25);
valueErrors(3, :) = task.experimentalGroundReactionMoments(3, :) -...
modeledValues.zGrfMoment;
slopeErrors(3, :) = task.experimentalGroundReactionMomentsSlope(...
3, :) - calcBSplineDerivative(task.time, ...
modeledValues.zGrfMoment, 2, 25);
end