Main Content


Joint-space mass matrix


H = massMatrix(robot) returns the joint-space mass matrix of the home configuration of a robot.


H = massMatrix(robot,configuration) returns the mass matrix for a specified robot configuration.


collapse all

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);

Input Arguments

collapse all

Robot model, specified as a rigidBodyTree object. To use the massMatrix function, set the DataFormat property to either 'row' or 'column'.

Robot configuration, specified as a vector with positions for all nonfixed joints in the robot model. You can generate a configuration using homeConfiguration(robot), randomConfiguration(robot), or by specifying your own joint positions. To use the vector form of configuration, set the DataFormat property for the robot to either 'row' or 'column' .

Output Arguments

collapse all

Mass matrix of the robot, returned as a positive-definite symmetric matrix with size n-by-n, where n is the velocity degrees of freedom of the robot.

Extended Capabilities

Introduced in R2017a