Analyze Tool in Matlab: How to plot
Posted: Thu Nov 08, 2018 9:22 am
Dear all,
I'm using the model arm26.osim and I want to plot the passive fiber force versus the r_elbow_flex.
I was able to plot the function by using "Analyze Tool" available in the OpenSim GUI:
1)By Loading a motion file where time varies between 0 sec and 2 sec, r_shoulder_el is always 0 and r_elbow_flex varies between 0 and 90 2)By Setting "Muscle Analysis" in Analysis Set;
3) By generating a plot with X_QUANTITY=r_elbow_flex and Y_QUANTITY=passive_fiber_force
I want to obtain the same plot by exploiting the MATLAB API.
I used the same motion file and the same model but I'm not able to show the same plot. In particular I'm not able to plot any variable as function of r_elbow_flex.
Can you help me?
I'm using the model arm26.osim and I want to plot the passive fiber force versus the r_elbow_flex.
I was able to plot the function by using "Analyze Tool" available in the OpenSim GUI:
1)By Loading a motion file where time varies between 0 sec and 2 sec, r_shoulder_el is always 0 and r_elbow_flex varies between 0 and 90 2)By Setting "Muscle Analysis" in Analysis Set;
3) By generating a plot with X_QUANTITY=r_elbow_flex and Y_QUANTITY=passive_fiber_force
I want to obtain the same plot by exploiting the MATLAB API.
I used the same motion file and the same model but I'm not able to show the same plot. In particular I'm not able to plot any variable as function of r_elbow_flex.
Can you help me?
Code: Select all
clear
clc
%% ARM26 ANALYZE
% First, import the classes from the jar file so that these can be called
% directly
import org.opensim.modeling.*
% Generate a new model object by loading the tug of war model from file
osimModel = Model('Arm26_Optimize.osim');
% Set up the visualizer to show the model and simulation
osimModel.setUseVisualizer(false);
% Initializing the model
osimModel.initSystem();
tool = AnalyzeTool('Arm26_Optimize_Setup_Analyze_generic.xml');
tool.setModel(osimModel);
tool.setName('AfferentAnalysis');
tool.setCoordinatesFileName('Arm26_Optimize_qcost.sto');
tool.setInitialTime(0.0);
tool.setFinalTime(2.0);
tool.run();