How to get Moment Arm of a Body on Matlab ?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: How to get Moment Arm of a Body on Matlab ?

Post by Dimitar Stanev » Tue May 05, 2020 10:54 am

Hi Sepehr,

You can try using the MuscleAnalysis in the AnalyzeTool of OpenSim. With this you can calculate the moment arm of each muscle as a function of time (or of your movement). If you are interested in extracting the moment arm using the API, you can look at the following repository where I sample the moment arm at different poses and approximate it using polynomial fitting. There you can understand how to extract this information from OpenSim.

https://github.com/mitkof6/symbolic_moment_arm

User avatar
Sepehr Ramezani
Posts: 35
Joined: Tue Nov 05, 2019 2:02 pm

Re: How to get Moment Arm of a Body on Matlab ?

Post by Sepehr Ramezani » Wed May 06, 2020 7:49 am

Hi Dimitar,
Thank you so much,
I added following code to my "setup.xml" and got momentum arm:

Code: Select all

<AnalysisSet name="Analyses">
			<objects>
				<MuscleAnalysis name="MuscleAnalysis">
					<on>true</on>
					<start_time>0</start_time>
					<end_time>10.619999999999999</end_time>
					<step_interval>1</step_interval>
					<in_degrees>true</in_degrees>
					<muscle_list> all</muscle_list>
					<moment_arm_coordinate_list> knee_angle_l</moment_arm_coordinate_list>
					<compute_moments>true</compute_moments>
				</MuscleAnalysis>
			</objects>
			<groups />
		</AnalysisSet>
Also I read your code at mentioned repository , it was brilliant idea to have momentum arm base on more than 1 coordinate.

User avatar
Kristy Godoy
Posts: 21
Joined: Thu Feb 05, 2015 12:53 pm

Re: How to get Moment Arm of a Body on Matlab ?

Post by Kristy Godoy » Mon Sep 07, 2020 11:52 am

Hello Sepehr,
Can you mention what files did you use as input for the moment arm calculation, please?

Thank you so much in advance.

User avatar
Michael Asmussen
Posts: 67
Joined: Mon Jul 11, 2016 7:46 am

Re: How to get Moment Arm of a Body on Matlab ?

Post by Michael Asmussen » Mon Sep 07, 2020 12:29 pm

s.ramezani wrote:
Mon May 04, 2020 10:18 am
tkuchida wrote:
Mon May 04, 2020 6:32 am
Perhaps look at the moment arm of each muscle separately? The best approach may depend on your research question.
Yes, I want to calculate the moment arm of each desired muscle during movement. I mean after this calculation I should have a time-table with the first column of time, plus columns that represent momentum arm of each muscle. Also, I am trying to use a time step similar to the motion (IK.mot) time step.
Thank you.
If you wanted to complete this process in Matlab, an alternative method would be to:

1. extract each coordinate as a function time from the .mot file and define it as a matrix
2. get each coordinate from the model using "model.getCoordinateSet().get('INSERT COORDINATE NAME')"
3. Use a loop to cycle through each coordinate and each time point and set each coordinate to the value from your matrix you defined using "setValue"
4. Use the MomentArmSolver for each muscle, for each coordinate and for each point in time.

All the best,

Mike

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

Re: How to get Moment Arm of a Body on Matlab ?

Post by Ayman Habib » Mon Sep 07, 2020 3:32 pm

Thanks Michael,

I also want to mention that the GUI provides this functionality without any programming inside the plotter (if that fits your workflow or to verify your output).
- Load the model and motion.
- Open Plotter window
- Select Moment Arm for coordinate of choice in Y-Quantity
- Select Muscles
- Select the motion in X-Quantity
- Select "Add" to generate the plots
- Export data from plot to sto files.

Hope this helps,
-Ayman

User avatar
Jana Egli
Posts: 4
Joined: Wed Sep 16, 2020 5:00 am

Re: How to get Moment Arm of a Body on Matlab ?

Post by Jana Egli » Thu Mar 04, 2021 3:18 am

Hi there,

I have the same goal to extract the moment arms over the time. But I don't get how to read them out after doint the MuscleAnalysis, i.e. how are these files then called? I see many fiber lengths and forces but no moment arms.

Thank you best in advance for the help.

POST REPLY