%% Calculate The Mass Matrix For A Robot Configuration
% Load a predefined KUKA LBR robot model, which is specified as a  RigidBodyTree object.

load exampleRobots.mat lbr

%
% Set the data format to 'row'. For all dynamics calculations, the data format must be either 'row' or 'column'.

lbr.DataFormat = 'row';

%
% Generate a random configuration for lbr.

q = randomConfiguration(lbr);

%
% Get the mass matrix at configuration q.

H = massMatrix(lbr,q);

% Copyright 2012 The MathWorks, Inc.