Skip to main content

updateNcpInitialGuess.m


function ncpInputs = updateNcpInitialGuess(ncpInputs, ...
precalInputs, optimizedInitialGuess)
values = makeMuscleTendonLengthInitializationValuesAsStruct( ...
optimizedInitialGuess, precalInputs);
if isfield(ncpInputs, 'mtpActivationsColumnNames')
nonMtpEntries = ~ismember(ncpInputs.muscleTendonColumnNames, ...
ncpInputs.mtpActivationsColumnNames);
else
nonMtpEntries = ones(1, length(ncpInputs.muscleTendonColumnNames));
end
ncpInputs.optimalFiberLength(nonMtpEntries) = ...
precalInputs.optimalFiberLength(nonMtpEntries) ...
.* values.optimalFiberLengthScaleFactors(nonMtpEntries);
ncpInputs.tendonSlackLength(nonMtpEntries) = ...
precalInputs.tendonSlackLength(nonMtpEntries) .* ...
values.tendonSlackLengthScaleFactors(nonMtpEntries);
newMaxIsometricForce = getMaxIsometricForce(precalInputs, values);
ncpInputs.maxIsometricForce(nonMtpEntries) = ...
newMaxIsometricForce(nonMtpEntries);
end