Add Sensor and Run Simulation
To measure the motion of the pendulum as it swings, you need to connect one or more Simulink® Scope blocks to your model. The SimMechanics library of Actuators and Sensor blocks gives you the means to input and output Simulink signals to and from SimMechanics models. Sensors allow you to watch the mechanical motion once you start the simulation, as the following explain:
Connect and Configure Sensor
In this example, you measure the angular motion of the revolute joint:
In the block library, open the Sensors & Actuators library. Drag and drop a Joint Sensor block into your model window.
Open the Revolute block. Change Number of sensor/actuator ports from 0 to 1 using the spinner menu. An open connector port appears on the side of Revolute. Close Revolute.
Connect this connector port to the connector port on the Joint Sensor block. The open connector port changes to solid .
Open Joint Sensor. Select the Angle and the Angular velocity check boxes. Unselect the Output selected parameters as one signal check box.
Leave the other defaults. Close the Joint Sensor block.
Open the Simulink Library Browser. From the Sinks library, drag and drop a Scope block and an XY Graph block into your model window. From the Signal Routing library, drag and drop a Mux block as well. Connect the Simulink outports > on the Joint Sensor block to the Scope and XY Graph blocks as shown.