Skip to main content

calcPassiveMuscleMoments.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the passive muscle moments for a given set of
% experimental data, maximum isometric force, and normalized fiber length.
%
% Inputs:
% experimentalData: struct containing the following fields
% momentArms: 3d matrix of moment arms
% pennationAngle: 3d array of (1, numMuscles, 1)
% maxIsometricForce: 3d array of (1, numMuscles, 1)
% normalizedFiberLength: 3d array of (1, numMuscles, 1)
%
% Outputs:
% passiveModelMoments: 3d array of moments
%
% (struct, 3d mat, 3d mat) -> 3d mat
% returns passive model moment


function passiveModelMoments = calcPassiveMuscleMoments(experimentalData, ...
maxIsometricForce, normalizedFiberLength)

expandedMaxIsometricForce = ones(1, 1, length(maxIsometricForce), 1);
expandedMaxIsometricForce(1, 1, :, 1) = maxIsometricForce;

passiveForce = passiveForceLengthCurve(normalizedFiberLength);
expandedPassiveForce = ones(size(passiveForce, 1), 1, ...
size(passiveForce, 2), size(passiveForce, 3));
expandedPassiveForce(:, 1, :, :) = passiveForce;

parallelComponentOfPennationAngle = cos(experimentalData.pennationAngle);
expandedParallelComponentOfPennationAngle = ones(1, 1, length( ...
parallelComponentOfPennationAngle), 1);
expandedParallelComponentOfPennationAngle(1, 1, :, 1) = ...
parallelComponentOfPennationAngle;

passiveModelMoments = experimentalData.momentArms .* ...
expandedMaxIsometricForce .* expandedPassiveForce .* ...
expandedParallelComponentOfPennationAngle;

passiveModelMoments = permute(sum(passiveModelMoments, 3), [1 2 4 3]);
end