Documentation

Model Double Pendulum

Model Overview

The double pendulum is a simple multibody system. It contains two links and a pivot mount that connect with joints. This system is nonlinear and does under certain conditions exhibit chaos. In this example, you assemble a double pendulum using custom blocks for the links and the pivot mount. You can later use this model to study the chaotic motion of a double pendulum.

To model the double pendulum, you represent each physical component and constraint using a Simscape™ Multibody™ block. The double pendulum system contains three rigid bodies—one pivot mount and two binary links— that connect in series through a pair of revolute joints. You represent the pivot mount and the binary links using the custom library blocks that you created in previous examples. You represent the two joints using two Revolute Joint blocks from the Joints library.

You can guide model assembly. By specifying joint state targets, you can instruct Simscape Multibody to assemble a joint in the configuration you want. State targets that you can specify include position and velocity. At times, a state target may conflict with other state targets, or even with other kinematic constraints in the model. In these cases, you can prioritize the most important state targets by assigning them a high priority level. During assembly, if two targets conflict with each other, Simscape Multibody assembles the high priority target first. To specify both state target values and priority levels, you use the State Targets menu of the joint block dialog boxes.

Build Model

  1. Start a new model.

  2. Drag these blocks into the model. The two Revolute Joint blocks provide the double pendulum two rotational degrees of freedom.

    LibraryBlockQuantity
    Simscape > UtilitiesSolver Configuration1
    Simscape > Multibody > UtilitiesMechanism Configuration1
    Simscape > Multibody > Frames and TransformsWorld Frame1
    Simscape > Multibody > JointsRevolute Joint2

  3. At the MATLAB® command prompt, enter smdoc_compound_rigid_bodies. A custom block library with the same name opens up.

  4. Drag these custom blocks into the model. Each block represents a rigid body in the double pendulum. See the tutorials in the table for detailed instructions on how to create the blocks.

    BlockQuantity
    Pivot Mount1
    Binary Link A2

  5. Connect the blocks as shown in the figure.

Guide Model Assembly

  1. In the Revolute Joint block dialog boxes, select State Targets > Specify Position Target. You can now specify the desired starting positions of the two joints.

  2. In Value, enter these joint angles.

    Block NameValue (degrees)
    Revolute Joint30
    Revolute Joint1-75

Visualize Model and Check Assembly Status

To visualize the model, update the block diagram. You can do this from the menu bar by selecting Simulation > Update Diagram. Mechanics Explorer opens with a 3-D view of the double pendulum assembly. Click the isometric view button to obtain the perspective in the figure.

To check the assembly status of the revolute joints, use the Model Report utility. You can open this utility from the Mechanics Explorer menu bar by selecting Tools > Model Report. The figure shows the assembly information for the double pendulum.

Simulate Model

Run the simulation, e.g., by selecting Simulation > Run. Mechanics Explorer shows a 3-D animation of the double pendulum assembly. The assembly moves due to gravity, specified in the Mechanism Configuration block.

Open Reference Model

To see a complete model of the double pendulum assembly, at the MATLAB command prompt enter:

  • smdoc_double_pendulum

Was this topic helpful?