Skip to main content

calcMuscleTendonNonLinearConstraints.m



% This function is part of the NMSM Pipeline, see file for full license.
%
% This function calculates the nonlinear constraints


function [c,ceq] = calcMuscleTendonNonLinearConstraints(values, ...
primaryValues, isIncluded, experimentalData, params)

ceq = [];
values = makeMtpValuesAsStruct(values, primaryValues, isIncluded);
modeledValues = calcMtpModeledValues(values, experimentalData, struct());
softmaxlmtildaCon = log(sum(exp(500 * ...
(modeledValues.normalizedFiberLength - 1.3)), [1 3])) / 500; % max lmtilda less than 1.5
softminlmtildaCon = log(sum(exp(500 * (0.3 - ...
modeledValues.normalizedFiberLength)), [1 3])) / 500; % min lmtilda bigger than 0.3
% assign values to c matrix
c = [softmaxlmtildaCon, softminlmtildaCon];
c(c<-1000) = -1;
c(c>1000) = 1;
end