Exp. No.
2
Introduction to MATLAB
Simulink
By:
Dr. Ahmed Jameel Abdulqader
Second Stage / 2nd semester 2022-2023
The Systems and Control Dept.
Nineveh University
Objective:
This experiment aims to understand the basic features of Simulink in Matlab.
Introduction
Simulink (Simulation and Link) is an extension of MATLAB by Math works Inc. It works
with MATLAB to offer modeling, simulating, and analyzing of dynamical systems under a
graphical user interface (GUI) environment. The construction of a model is simplified with
click-and-drag mouse operations. Simulink includes a comprehensive block library of
toolboxes for both linear and nonlinear analyses. Models are hierarchical, which allow using
both top-down and bottom-up approaches. As Simulink is an integral part of MATLAB, it
is easy to switch back and forth during the analysis process and thus, the user may take full
advantage of features offered in both environments.
Getting Started:
To start a Simulink session, you'd need to bring up the Matlab program first. From Matlab
command window, enter:
>> Simulink
Alternately, you may click on the Simulink icon located on the toolbar as shown:
Simulink's library browser window like the one shown below will pop up presenting the
block set for model construction.
To see the content of the block set, click on the "+" sign at the beginning of each toolbox.
To start a model, click on the “NEW FILE” icon as shown in the screenshot above.
Alternately, you may use keystrokes CTRL+N. A new window will appear on the screen.
You will be constructing your model in this window. Also in this window, the constructed
model is simulated. A screenshot of a typical working (model) window is shown below:
To become familiarized with the structure and the environment of Simulink, you are
encouraged to explore the toolboxes and scan their contents. You may not know what they
are all about at first, but perhaps you could catch on to the organization of these toolboxes
according to the category. For instant, you may see that the Control System toolbox consists
of the Linear Time-Invariant (LTI) system library and the MATLAB functions can be found
under Function and Tables of the Simulink main toolbox. A good way to learn Simulink (or
any computer program in general) is to practice and explore. Making mistakes is part of the
learning curve. So, fear not you should be!
A simple model is used here to introduce some basic features of Simulink. Please follow the
steps below to construct a simple model.
CREATING BLOCKS
From the BLOCK SET CATEGORIES section of the SIMULINK LIBRARY BROWSER
window, click on the "+" sign next to the Simulink group to expand the tree and select (click
on) Sources.
A set of blocks will appear in the BLOCKSET group. Click on the Sine Wave block and
drag it to the workspace window (also known as a model window).
Creating New Models
Create some models as shown below
The Constant and Product Blocks
The Constant block is used to define a real or complex constant value. This block accepts
scalar (1x1 2 − D array), vector (1−D array), or matrix (2− D array) output, depending on
the dimensionality of the Constant value parameter that we specify, and the setting of the
Interpret vector parameters as 1−D parameter.
The Product block performs multiplication or division of its inputs. This block produces
outputs using either element−wise or matrix multiplication, depending on the value of the
Multiplication parameter. We specify the operations with the Number of inputs parameter.
Multiply (*) and divide (/) characters indicate the operations to be performed on the inputs.
Example:-
The model is shown in Figure below performs the multiplication where in the Function Block
Parameters dialog box for the Product block we have entered: Number of inputs: 3 After the
Start simulation command is executed, it may be necessary to stretch the Display block
horizontally to read the result.
Discussion
1- Design the models shown below using Simulink blocks.