Skip to main content

calcMuscleActuatedMomentsPathConstraints.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the difference between the inverse dynamic
% moments and the muscle produced moments for the specified coordinate.
% Applicable only if the model is synergy driven.
%
% (struct, struct, Array of string) -> (Array of number)
%


function pathTerm = calcMuscleActuatedMomentsPathConstraints(params, ...
modeledValues, loadName)
indx1 = find(strcmp(convertCharsToStrings(params.inverseDynamicMomentLabels), ...
loadName));
indx2 = find(strcmp(strcat(params.surrogateModelCoordinateNames, ...
'_moment'), loadName));
pathTerm = modeledValues.inverseDynamicMoments(:, indx1) - ...
modeledValues.muscleJointMoments(:, indx2);
end