You are on page 1of 5

Intro to Computer 2016/09/29

Simulink Exercise - Create a Simple Model


Start the Simulink software. In the MATLAB Command Window, enter:
Simulink

The Simulink Library Browser opens.


From the Simulink Library Browser menu, select File > New > Model.
A Simulink Editor window opens with an empty canvas in the right-hand pane (the model
window).

Select File > Save as. The Save As dialog box opens.
In the File name box, enter a name for your model. For example, enter simple_model.
Then click Save.
Your model is saved with the file name simple_model.

Add Blocks to a Model


To create a model, begin by copying blocks from the Simulink Library Browser to the
Simulink Editor model window. For a description of the blocks in this example, see Overview
of the Simple Model.

1. In the Simulink Library Browser, select the Sources library.


The Simulink Library Browser displays blocks from the Sources library in the righthand pane.
2. Select the Sine Wave block.

Drag the Sine Wave block to the model window.


A copy of the Sine Wave block appears in your model.

3. Add the following blocks to your model, using the same approach that you
used to add the Sine Wave block.

Your model now has the blocks you need for the simple model.

Move Blocks in the Model


Before you connect the blocks in your model, you should arrange them logically to make the
signal connections as straightforward as possible.
1. Move the Scope block after the Mux block output. To move a block in a model, use
one of these approaches:

Click and drag the block.

Select the block, and then press the arrow keys on the keyboard.

2. Move the Sine Wave and Integrator blocks before the Mux block.
Your model should look similar to the following figure.

Connect the blocks by drawing lines between output ports and input ports
Simulink connects the blocks with an arrow indicating the direction of signal flow.

After you finish building a model, you can simulate the dynamic
behavior of the model. See Simulate the Simple Model.
In the Simulink Editor, select Simulation > Model Configuration Parameters. The
Configuration Parameters dialog box opens to the Solver pane.
In the Stop time field, enter 20. In the Max step size field, enter 0.2.

Click OK.
The Simulink software updates the parameter values with your changes and
closes the Configuration Parameters dialog box.
After you enter your configuration parameter changes, you are ready to simulate
the simple model and visualize the simulation results.

In the Simulink Editor, select Simulation > Run.

The simulation runs. The simulation stops when it reaches the stop time specified in the
Configuration Parameters dialog box.

Double-click the Scope block.


The Scope window opens and displays the simulation results. The plot shows a
sine wave signal with the resulting cosine wave signal from the Integrator block.

You might also like