Main Content


Class: simscape.multibody.CompiledMultibody
Namespace: simscape.multibody

Plot kinematic graph of compiled multibody system

Since R2022a


h = plotKinematicGraph(cmb) plots the kinematic graph of a simscape.multibody.CompiledMultibody object, cmb, in a tree layout graph. The dots in the plot indicate the component objects, such as simscape.multibody.Multibody, simscape.multibody.RigidBody, simscape.multibody.Solid, and simscape.multibody.WorldFrame, in the cmb object. The lines between the dots indicate joint objects between component objects, and the arrow on each line points toward the follower frame of each joint object. For example, the image shows the kinematic graph of a four bar system.

kinematic graph of a four bar system

The blue dots indicate the Solid objects that represent the four bars, the green lines indicate the simscape.multibody.RevoluteJoint objects that represent the joints between each pair of bars, and the arrow on each line points toward the follower frame of each RevoluteJoint object. See the Creating a Four Bar Multibody Mechanism in MATLAB example for more information about the four bar system.

h = plotKinematicGraph(cmb,Name=Value) plots the kinematic graph using Name,Value arguments to specify the layout of the graph.

Input Arguments

expand all

Compiled multibody system, specified as a simscape.multibody.CompiledMultibody object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: layout="tree"

Layout of the kinematic graph, specified as "tree", "circle", "snake", or "layered".

  • tree — A layout that emphasizes the spanning tree of the graph. The distinguished inertial body attached to the world frame is the root of the tree, and other bodies are in rows below the world frame:

  • circle — A layout that arranges the distinguished inertial body at the center and other bodies in concentric circles. This is a good option for mechanisms with radial symmetry, such as a Stewart platform.

  • snake — A layout that arranges the bodies in a snake-like pattern that tends to use all of the available 2-D area of the plot. This layout is a good choice for kinematic trees that are long and chain-like, such as a hanging chain with many links.

  • layered — A layout that arranges the bodies into a set of layers, which emphasizes hierarchical structures. By default, the layers progress downwards.

The best layout option depends on the details of a CompiledMultibody object. Different layout options may preferable for different CompiledMultibody objects.

Example: layout="circle"

Output Arguments

expand all

Handle of the plot, returned as a object. For more information about the GraphPlot object, see GraphPlot.



To learn about attributes of methods, see Method Attributes.

Version History

Introduced in R2022a