| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink |
| Contents | Index |
| Learn more about Simulink |
| On this page… |
|---|
Moving Blocks in the Model Window |
This section describes how to model a simple dynamic system using Simulink software. After you create the model, you can simulate it as described in Simulating the Model.
Before you can begin building your model, you must start Simulink and create an empty model.
To create a new model:
If Simulink is not running, enter simulink in the MATLAB Command Window to open the Simulink Library Browser.
Select File > New > Model in the Simulink Library Browser to create a new model.
The software opens an empty model window.

To construct a model, you first copy blocks from the Simulink Library Browser to the model window. To create the simple model in this chapter, you need four blocks:
Sine Wave — To generate an input signal for the model
Integrator — To process the input signal
Scope — To visualize the signals in the model
Mux — To multiplex the input signal and processed signal into a single scope
To add blocks to your model:
Select the Sources library in the Simulink Library Browser.
The Simulink Library Browser displays the Sources library.

Select the Sine Wave block in the Simulink Library Browser, then drag it to the model window.
A copy of the Sine Wave block appears in the model window.

Select the Sinks library in the Simulink Library Browser.
Select the Scope block from the Sinks library, then drag it to the model window.
A Scope block appears in the model window.
Select the Continuous library in the Simulink Library Browser.
Select the Integrator block from the Continuous library, then drag it to the model window.
An Integrator block appears in the model window.
Select the Signal Routing library in the Simulink Library Browser.
Select the Mux block from the Sinks library, then drag it to the model window.
A Mux block appears in the model window.
Before you connect the blocks in your model, you should arrange them logically to make the signal connections as straightforward as possible.
To move a block in the model window, you can either:
Drag the block.
Select the block, then press the arrow keys on the keyboard.
Arrange the blocks in the model to look like the following figure.

After you add blocks to the model window, you must connect them to represent the signal connections within the model.
Notice that each block has angle brackets on one or both sides. These angle brackets represent input and output ports:
The > symbol pointing into a block is an input port.
The > symbol pointing out of a block is an output port.

The following sections describe how to connect blocks by drawing lines from output ports to input ports:
You connect the blocks in your model by drawing lines between output ports and input ports.
To draw a line between two blocks:
Position the mouse pointer over the output port on the right side of the Sine Wave block.
Note that the pointer changes to a cross hairs (+) shape while over the port.

Drag a line from the output port to the top input port of the Mux block.
Note that the line is dashed while you hold the mouse button down, and that the pointer changes to a double-lined cross hairs as it approaches the input port of the Mux block.

Release the mouse button over the output port.
The software connects the blocks with an arrow that indicates the direction of signal flow.

Drag a line from the output port of the Integrator block to the bottom input port on the Mux block.
The software connects the blocks.
Select the Mux block, then Ctrl+click the Scope block.
The software automatically draws the connection line between the blocks.
The model should now look similar to the following figure.

The model is almost complete, but one connection is missing. To finish the model, you must connect the Sine Wave block to the Integrator block.
This final connection is somewhat different from the other three, which all connect output ports to input ports. Because the output port of the Sine Wave block already has a connection, you must connect this existing line to the input port of the Integrator block. The new line, called a branch line, carries the same signal that passes from the Sine Wave block to the Mux block.
To weld a connection to an existing line:
Position the mouse pointer on the line between the Sine Wave and the Mux block.

Press and hold the Ctrl key, then drag a line to the Integrator block's input port.

The software draws a line between the starting point and the input port of the Integrator block.
The model is now complete. It should look similar to the following figure.

After you complete the model, you should save it for future use.
To save the model:
Select File > Save in the model window.
Specify the location in which you want to save the model.
Enter simple_model in the File name field.
Click Save.
The software saves the model with the file name simple_model.mdl.
![]() | Overview | Simulating the Model | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |