Page 1 of 1

How to calculate force in Matlab?

Posted: Fri Oct 02, 2020 11:47 am
by mariacristina
Hi,

I'm trying to compute muscle forces of the MoBL-ARMS model, using Matlab, but I don't understand how to do this.

I active a muscle, using FD Tool and, inside a for loop, I need to compute force for every muscle activated, supposed that this force is applied in the hand mass center.

I write this fragment of script:
for j = 1:length(muscle_label)
muscle_name = muscle_label(j);
[...] % implentation of FD Tool for the selected muscle
FDinamicsTool.run();
forces = myModel.getForceSet();
muscleSet = myModel.getMuscles();
MUSCLE = muscleSet.get(muscle_name);
f = MUSCLE.computeActuation(myState);
end

Using computeActuation, I find a single value of force, while I need the force in 3 dimensions for every time instants. If I use getFiberForce or getActivationFiberForce or getActuation, the result is the same ( I obtain a single value of force).

Is there a way to obtain these values of muscle Force?

Thanks in advance.

Maria Cristina Panettieri

Re: How to calculate force in Matlab?

Posted: Sat Oct 03, 2020 8:44 am
by tkuchida
The application of muscle forces to the skeleton is determined by the muscle's path. You can find the path points in the PathPointSet and PathWrapSet in the muscle's GeometryPath (https://simtk.org/api_docs/opensim/api_ ... yPath.html). This is a common question. If you search the Forum, you should be able to find more information (and possibly Matlab code) to help you get started.

Re: How to calculate force in Matlab?

Posted: Sun Oct 04, 2020 10:27 am
by mariacristina
Thanks, Thomas for the reply.

I've already read all the most relevant posts in this forum, but I haven't resolved my problem.
I mustn't add a force to a model, but I need to compute the 3D force generated by a single muscle, to compare it with the force calculated by MATLAB, using the EMG signals for activated the muscles.
I'm working with a static pose and I activated the muscles using Forward Dynamics Tool in the OpenSim - MATLAB API.

if someone has ideas, it would be appreciated.

Thanks in advance,

Maria Cristina

Re: How to calculate force in Matlab?

Posted: Sun Oct 04, 2020 2:13 pm
by tkuchida
The code available in the "OpenSim plugin to extract the muscle lines of action" SimTK project may be helpful (https://simtk.org/projects/force_direction/): "The OpenSim plugin made available with this project extends the functionality of OpenSim and allows the user to extract the directionality of the muscle lines of action for a given kinematics." There is additional information in topic 10201 (viewtopicPhpbb.php?f=91&t=10201).

Re: How to calculate force in Matlab?

Posted: Mon Oct 05, 2020 3:42 am
by mariacristina
Thanks, Thomas.
I have followed the instructions to load this OpenSim plugin, but the error "Error trying to load library MuscleForceDirection. Library not loaded " appears.
Does someone know why?

Also, does someone know if another way to compute 3D force in a specific marker of model exist?

Thanks in advance,

Maria Cristina