How to calculate force in Matlab?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Maria Cristina Panettieri
Posts: 8
Joined: Sat Nov 09, 2019 1:42 am

How to calculate force in Matlab?

Post by Maria Cristina Panettieri » Fri Oct 02, 2020 11:47 am

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

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: How to calculate force in Matlab?

Post by Thomas Uchida » Sat Oct 03, 2020 8:44 am

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.

User avatar
Maria Cristina Panettieri
Posts: 8
Joined: Sat Nov 09, 2019 1:42 am

Re: How to calculate force in Matlab?

Post by Maria Cristina Panettieri » Sun Oct 04, 2020 10:27 am

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

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: How to calculate force in Matlab?

Post by Thomas Uchida » Sun Oct 04, 2020 2:13 pm

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).

User avatar
Maria Cristina Panettieri
Posts: 8
Joined: Sat Nov 09, 2019 1:42 am

Re: How to calculate force in Matlab?

Post by Maria Cristina Panettieri » Mon Oct 05, 2020 3:42 am

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

POST REPLY