Muscle Analysis through the GUI vs through Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Rachel Baker
Posts: 5
Joined: Wed Aug 20, 2014 2:22 pm

Muscle Analysis through the GUI vs through Matlab

Post by Rachel Baker » Mon Oct 07, 2019 8:38 am

Hello,

I'm using OpenSim 4.0 to simulate a chair-rise task in OpenSim 4.0 using a modified LaiArnold 2017 model (https://simtk.org/frs/?group_id=1302). I'm having some issues with high activations during the task, and I was looking into the model's muscle fiber lengths and tendon lengths during the tasks. I was trying to run a Muscle Analysis through Matlab (using code from https://simtk.org/projects/optcntrlmuscle), but I'm getting very large optimal fiber lengths (Figure 1). When I run a Muscle Analysis through the GUI (Figure 2), I get entirely different muscle fiber lengths.


Any help figuring this out will be much appreciated!

Rachel

Figure 1
MATLAB_MuscleAnalysis.png
MATLAB_MuscleAnalysis.png (64.54 KiB) Viewed 436 times
Figure 2
GUI_MuscleAnalysis.png
GUI_MuscleAnalysis.png (186.74 KiB) Viewed 436 times
The Matlab code is shown below:

Code: Select all

import org.opensim.modeling.*

% get the analysis tool and change variables
[FunctionPath,~]=fileparts(mfilename('fullpath'));
path_generic_file=fullfile(FunctionPath,'settings_Muscle_analysis.xml');
tool=AnalyzeTool(path_generic_file,false);
tool.setLoadModelAndInput(true)
osimModel=Model(model_sel);
tool.setModel(osimModel);
tool.setResultsDir(output_path);
tool.setInitialTime(event(1));
tool.setFinalTime(event(2));
[~, name, ~]=fileparts(motion_file);
tool.setName(name);

% run the analysis
tool.setModelFilename(model_sel);
tool.setCoordinatesFileName(motion_file);
out_path_xml=fullfile(output_path,['muscle_analysis_' name '.xml']);
tool.print(out_path_xml);
tool.run;

Tags:

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Muscle Analysis through the GUI vs through Matlab

Post by Dimitar Stanev » Mon Oct 07, 2019 12:51 pm

The results from the GUI seem more reasonable. Can you share the steup.xml of the muscle analysis.

Also, you might try changing:

tool=AnalyzeTool(path_generic_file, true);

and make sure that the equilibrate muscles is set to true.

User avatar
Rachel Baker
Posts: 5
Joined: Wed Aug 20, 2014 2:22 pm

Re: Muscle Analysis through the GUI vs through Matlab

Post by Rachel Baker » Wed Oct 09, 2019 7:06 am

Hi Dimitar,

Thanks for the reply; I was thinking the same thing about the results. I've uploaded my muscle analysis setup file. I'll try changing the Matlab code like you suggested to see how that will change the results.

Thanks,

Rachel
settings_Muscle_analysis.xml
(4.55 KiB) Downloaded 55 times

POST REPLY