As far as i know muscles are defined by two points in space, like a spring element. i am not a user of opensim, but what would i say may help you on this issue. There must be already defined the positions of each points which defines muscles in the software. You may extract this data somehow and then import into matlab. Then, you can represent each muscle as a vector and calculate moment arms wrt a chosent point in the matlab environment.
Thank you Riza for your answer. In opensim, the muscles path may not be a straight line because the tendons and muscle can wrap around skeletal structures. The calculation of the muscles moment arm takes this point into account and i am not sure that reducing the muscle to a straight line between two points is sufficient especially for bi-articular muscles.
Are you wanting to generate a look-up table of moment arms in MATLAB, or are you wanting to re-create how OpenSim calculates moment arms (based on the musculoskeletal geometry)?
Here's a link to a document that explains how OpenSim calculates moment arms:
Thank you for your answer Jeremy. I would like to obtain the muscles moment arms matrix from any posture of the upper-limb musculoskeletal model. If this variable is strored in the opensim data structure i would like to know where it is and if not recreate how opensim calculates this parameter from the musculoskeletal geometry.
To my knowledge, the only way to do this would be to generate your own moment arm matrix based on values obtained from plotted values (e.g., moment arms for each of the muscles that cross the elbow vs. elbow flexion angle) -- which can then be saved in ASCII format. This would mean generating a number of plots and then compiling them into a matrix (or look-up table), or generating a motion file that run through every possible combination of postures and generating plots (1 per joint of interest, according to the moment arms you want to obtain). The latter requires a little more work on the front end, but requires fewer iterations when it comes to generating plots (and saving files).
Alternatively, there are a few articles that might be of interest, in which a couple of research groups have generated regression equations to calculate moment arms for the upper limb, based on the Holzbaur et al. (2005) SIMM model.
Rankin JW, Neptune RR. Musculotendon lengths and moment arms for a three-dimensional upper-extremity model. J Biomech. 2012 Jun 1;45(9):1739-44.
Hale R, Dorman D, Gonzalez RV. Individual muscle force parameters and fiber operating ranges for elbow flexion-extension and forearm pronation-supination. J Biomech. 2011 Feb 24;44(4):650-6.
Ramsay JW, Hunter BV, Gonzalez RV. Muscle moment arm and normalized moment contributions as reference data for musculoskeletal elbow and wrist joint models. J Biomech. 2009 Mar 11;42(4):463-73.
The Opensim team has developped a Matlab API with which it is possible to load an OpenSim model in Matlab and do moment arm calculations. An example file called "simpleOptimizerObjectiveFunction.m" in the sdk/Matlab folder of the opensim installation gives an example of moment-arm calculation. By browsing the simtk forum i also found valuable information with the following keywords : moment arm matlab (https://simtk.org/forums/viewforum.php?f=91).
A new interesting article on moment arm definition is published in "Computer methods in biomechanics and biomedical engineering" entitled "Muscle Moment-Arms: A Key Element in Muscle-Force Estimation". here is the link