Simulation and Analysis

Run a simulation, visualize a model, and run a kinematic analysis

Update the block diagram to assemble the model and visualize its initial configuration. The visualization opens in Mechanics Explorer. Simulate the model to play an interactive animation. Be sure to pick a solver suited for physical models, such as Ode15s, and to specify a maximum time step small enough to capture the fastest meaningful change expected during simulation.

Open Camera Manager to add a moving, dynamic camera with which to capture the animation. Dynamic cameras can be of two types: keyframed or tracking. Keyframed cameras move between view points created interactively in Mechanics Explorer. Tracking cameras attach to and aim at frames in the model. Use Video Creator or the smwritevideo function to record an animation in a video format.

Use the KinematicsSolver class to create a kinematic representation of a model and formulate a kinematic problem to solve. KinematicsSolver objects contain all the joint variables available in a model. Complement them with frame variables and assign both joint and frame variables as targets, guesses, and outputs for analysis.

Visualization Utilities

Mechanics ExplorerVisualize and explore multibody models
Camera ManagerCreate, edit, and delete dynamic cameras
Video CreatorConfigure and create multibody animation videos

Functions

expand all

smwritevideoConfigure and create multibody animation videos

Representing the Assembly

KinematicsSolverKinematic representation of multibody model to analyze

Configuring Options

setVariableUnitChange physical unit of kinematic variable

Listing Variables

frameVariablesList all kinematic variables associated with frame pairs
initialGuessVariablesList all kinematic variables assigned as initial guesses
jointVariablesList all kinematic variables associated with joints
outputVariablesList all kinematic variables assigned as outputs
targetVariablesList kinematic variables assigned as targets

Adding Variables

addFrameVariablesCreate kinematic variables from select frame pair in KinematicsSolver object
addInitialGuessVariablesAssign kinematic variables from the KinematicsSolver object as guesses
addOutputVariablesAssign kinematic variables from the KinematicsSolver object as outputs
addTargetVariablesAssign kinematic variables from the KinematicsSolver object as targets

Clearing Variables

clearFrameVariablesDrop all frame variables from the KinematicsSolver object
clearInitialGuessVariablesDrop all guess variables from the KinematicsSolver object
clearOutputVariablesDrop all output variables from the KinematicsSolver object
clearTargetVariablesDrop all target variables from the KinematicsSolver object

Removing Variables

removeFrameVariablesDrop select frame variables from the KinematicsSolver object
removeInitialGuessVariablesDrop select guess variables from the KinematicsSolver object
removeOutputVariablesDrop select output variables from the KinematicsSolver object
removeTargetVariablesDrop select target variables from the KinematicsSolver object

Running the Analysis

solveRun kinematic analysis for KinematicsSolver object
generateCodeGenerate C code to run kinematic analysis on KinematicsSolver object

Topics

Basic Visualization

Update and Simulate a Model

Workflow steps for updating and simulating a Simscape™ Multibody™ model.

Visualize a Model and Its Components

Visualization is not only a central part of a multibody simulation, it is an essential tool in modeling bodies and verifying their shapes, sizes, frame placements, and colors. Here is an overview of the visualization utilities available in the Simscape Multibody environment and the roles they play in your modeling workflow.

Enable Mechanics Explorer

Set the model configuration parameters to ensure that Mechanics Explorer opens automatically on model update or simulation.

Manipulate the Visualization Viewpoint

Select a standard view, set the up-axis convention, and use mouse shortcuts to rotate, roll, pan, or zoom a model.

Visualize Simscape Multibody Frames

Use Mechanics Explorer frame highlights and Graphic blocks to visualize frames.

Advanced Visualization

Selective Model Visualization

Visualization filtering as a means to selectively show and hide solids, bodies, and multibody subsystems in Mechanics Explorer.

Selectively Show and Hide Model Components

Use selective model visualization to show only those model components that are relevant to you.

Go to a Block from Mechanics Explorer

Use Mechanics Explorer to go to the block corresponding to a tree view pane node.

Cameras and Video Creation

Create a Dynamic Camera

Use Camera Manager to create or edit a model visualization camera with a moving viewpoint.

Visualization Cameras

Distinction between dynamic cameras and the global camera. Camera Manager as a tool for creating dynamic cameras. Dynamic camera keyframe and tracking modes.

Create a Model Animation Video

Save an animation in video format using Video Creator or the smwritevideo function.

Working with Animation

Review how model animations work and explore the basic controls available for animations.

Kinematic Analysis

Run a Kinematic Analysis on a Model

Formulate and solve a kinematic analysis for a multibody model

Troubleshooting

Multibody Simulation Issues

Overview of Simscape Multibody simulation issues

Featured Examples