Skip to main content

calcFinalMuscleActivations.m


% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the resulting muscle activations following the
% completion of the muscle tendon personalization.
%
% (struct, struct) -> (Array of number)
% Outputs final muscle activations


function results = calcFinalMuscleActivations(optimizedParams, inputs)

muscleExcitations = calcMuscleExcitations(inputs.emgTime, ...
inputs.emgSplines, optimizedParams(1,:), optimizedParams(4, :));
neuralActivations = calcNeuralActivations(muscleExcitations, ...
optimizedParams(2, :), inputs.emgTime, inputs.numPaddingFrames);
results.muscleActivations = calcMuscleActivations(...
neuralActivations, optimizedParams(3, :));
results.time = inputs.emgTime(:, inputs.numPaddingFrames + 1 : end - ...
inputs.numPaddingFrames);
results.optimizedParams = optimizedParams;
end