Page 1 of 1

Muscle Analysis through the GUI vs through Matlab

Posted: Mon Oct 07, 2019 8:38 am
by rkbaker1216
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 440 times
Figure 2
GUI_MuscleAnalysis.png
GUI_MuscleAnalysis.png (186.74 KiB) Viewed 440 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;

Re: Muscle Analysis through the GUI vs through Matlab

Posted: Mon Oct 07, 2019 12:51 pm
by mitkof6
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.

Re: Muscle Analysis through the GUI vs through Matlab

Posted: Wed Oct 09, 2019 7:06 am
by rkbaker1216
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