MatLab toolboxΒΆ

The MatLab Muscle Parameter Optimization Toolbox can be downloaded as part of the Muscle Optimizer repository on GitHub, under the matlab directory. A version of this Matlab toolbox, designed to reproduce the results and figures of the paper associated with the Muscle Optimizer toolbox [1], is available from our project page on SimTK.org.

To use the toolbox, you should add the folder MuscleParOptTool (located in the matlab directory of the repository) to the MatLab path (see Matlab documentation).

The toolbox provides the optimMuscleParams function, that can be called as in the following example:

% importing OpenSim libraries
import org.opensim.modeling.*

%========= USERS SETTINGS =======
% model files with paths
osimModel_ref_filepath   = 'MSK_Models/Reference_Hamner_L.osim';
osimModel_targ_filepath  = 'MSK_Models/Target_Hamner_scaled_L.osim';
OptimizedModel_folder   = 'Optim_Models'; % folder for storing optimized model
% evaluations
N_eval = 10;
%================================

% initializing folders and log file
log_folder              = OptimizedModel_folder;
% checking if results folder exists. If not, create it.
if ~isdir(OptimizedModel_folder)
    warning(['Folder ', OptimizedModel_folder, ' does not exist. It will be created.'])
    mkdir(OptimizedModel_folder);
end

% optimizing target model based on reference model fro N_eval points per
% degree of freedom
[osimModel_opt, SimsInfo{N_eval}] = optimMuscleParams(osimModel_ref_filepath, ...
                                                      osimModel_targ_filepath, ...
                                                      N_eval, ...
                                                      log_folder);

% printing the optimized model
osimModel_opt.print(fullfile(OptimizedModel_folder, char(osimModel_opt.getName())));