I'm trying to compute the magnitude of an ExpressionBasedCoordinateForce in my model in Matlab, given the model's state. I can extract the force object of interest like this, for the case of the EBCF that defines the passive hip flexion moment:
Code: Select all
forceSet = model.getForceSet();
force = forceSet.get('PasMom_hip_flexion_r');
Code: Select all
current_force_mag = force.computeForce(state)
From the documentation, it also looks like ExpressionBasedCoordinateForce has a function "getForceMagnitude" with state as its only input, which sounds like what I want and makes sense for this type of force (its inputs are a generalized coordinate and the associated generalized speed), but when I run force.getForceMagnitude(state), I get an error "Unrecognized function or variable 'getForceMagnitude'." I think it's because my force object is of variable type "Force" and not "ExpressionBasedCoordinateForce".
Summary questions:
(1) What inputs is computeForce expecting for bodyForces and generalizedForces arguments?
(2) Can an ExpressionBasedCoordinateForce be extracted from the model with variable type "ExpressionBasedCoordinateForce" so that it knows about getForceMagnitude?
Thanks much,
Ross