You are on page 1of 7


CPE642/Simulation Lab/Sept2014

SIMULINK is an extension to MATLAB that allows engineers to rapidly and accurately build
computer models of dynamical systems using block diagram notations. SIMULINK model can
occupy for both continuous and discrete-time system.
The MATLAB and Simulink environments are integrated into one entity, and thus we can analyze,
simulate, and revise our models in either environment at any point. We invoke Simulink from
within MATLAB


Open a Matlab browser prior starting Simulink

Click the
icon to start

type simulink
and enter to start

Figure 1.1: Starting Simulink


CPE642/Simulation Lab/Sept2014

Window icon

Simulink library

Figure 1.2: Simulink library browser window

The Simulink library browser, shown in Figure 1.2, will open. Click the new window
icon, opening an empty model window, named untitled, in which you will build the
Simulink model.

Figure 1.3: Empty model window

Click the simulink parameters, to change the simulation time. Simulink give default
time start from 0.0 to 10.0. This is in seconds.


CPE642/Simulation Lab/Sept2014

Figure 1.3: Simulation/configuration parameters

Figure 1.4: Changing the simulation time.


Save & open model

To save the model, just click Save or Save as and save the model using appropriate
name and make sure the save as type Simulink model, which has an extension of .mdl

The unsaved model has an * symbol at the end of the name, as indicated in figure 2.1,
and the * symbol will disappeared if the model has been saved.


CPE642/Simulation Lab/Sept2014

Figure 2.1: Unsaved model, denoted by * at the title.

To open a model, use File: Open. Prior to open, note that the default directory in the
MATLAB is work directory (Figure 2.2), and change the directory according the
previous directory that has been used. Then only you can open the model either from
MATLAB browser or Simulink browser.

Figure 2.2: Directory



CPE642/Simulation Lab/Sept2014

Building a model
A Simulink model consists of three types of element: sources, thesystem being modeled
and sinks. Figure 3.1 shows the relationship among the three elements. The central
element, i.e. the system, is the Simulink representation of a block diagram of the
dynamical system being modeled. The sources are the inputs to the dynamical system, and
the sinks acts as the output of the system.



Figure 3.1: Elements of a Simulink model

To build a model, drag the icon required from the library to the model window.

To connect the blocks, place a cursor on the output port, symbolized as > on the right
edge of the block, and drag to the input port (< on the left edge of block).

The signal line has an arrowhead indicating the direction of signal flow and the blocks
are connected to each other.

Black line connected

Red dotted
line - not


CPE642/Simulation Lab/Sept2014


Additional info: Sinks input, Sources Output, Continuous processes, Math Operation

mathematical tools. Alternative for looking the block is by typing the required block in here and
click Find. Browse through the libraries to know more about the contents.

To see the output, double click the Scope block, and then clicking on the Autoscale icon.


CPE642/Simulation Lab/Sept2014

Lets try PID 1