You are on page 1of 7

NHA0914/Simulink/Notes

CPE642/Simulation Lab/Sept2014

What is SIMULINK?
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

1.0

Open a Matlab browser prior starting Simulink

Click the
Simulink
icon to start
simulink

Alternatively
type simulink
and enter to start
simulink

Figure 1.1: Starting Simulink

NHA0914/Simulink/Notes

CPE642/Simulation Lab/Sept2014

New
Window icon

Simulink library
icon

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.

NHA0914/Simulink/Notes

CPE642/Simulation Lab/Sept2014

Figure 1.3: Simulation/configuration parameters

Figure 1.4: Changing the simulation time.

2.0

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.
3

NHA0914/Simulink/Notes

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

NHA0914/Simulink/Notes

3.0

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.
Inputs/
Sources

Process/System

Outputs/Sinks

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
connected

NHA0914/Simulink/Notes

CPE642/Simulation Lab/Sept2014

Exercise

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.

NHA0914/Simulink/Notes

CPE642/Simulation Lab/Sept2014

Lets try PID 1