SIMULINK
Dr. Samir Al-Amer
SIMULINK
SIMULINK is a power simulation program that
comes with MATLAB
Used to simulate wide range of dynamical
systems
To run SIMULINK
Run MATLAB
Click on the SIMULINK icon on tool bar
SIMULINK automatically open a work file and
the main libraries.
To be able to use SIMULINK
You need to learn to do the following
manipulate blocks
use blocks to build models
run simulation
modify simulation parameters
SIMULINK BASICS
A systems is represented by a block diagram
You select the block from a library of blocks
You need to know the library that contains the
block that you need
click on the library name and you will see a list of
blocks in that library
click on the block that you want and drag it to the
work file
click on the block to select its parameters
Connect it to other blocks
SIMULINK LIBRARIES
Sources
Sinks
Continuous
Discrete
Function & Tables
Math
Nonlinear
Signals & Systems
Subsystems
General Procedure
Open the library that contains the block of
interest
Click on the block that you need and drag it to
the work area
Click the left mouse button to see and modify
the block parameters.
You can do the above by clicking the right
button and select the block parameters.
Connect the input and outputs of the block
SIMULINK LIBRARIES
Sources Used to generate input signals
Sinks Used to display results/signals
Continuous To represent continuous systems
Discrete To represent discrete systems
Math Some mathematical functions
Source
to generate input signals
Step to generate step input
Ramp to generate ramp input
sine Wave to generate sine wave input
Clock
Constant
Pulse generator
Signal Generator
…
Constant (SOURCE LIBRARY)
The output of the constant block is a
constant number
Select the source library
click on the constant block
drag the block to the work file
Constant click on the block
update the parameters of the block
(change the constant)
Connect the block to other blocks
Step (SOURCE LIBRARY)
The output of the step block is step function.
User can select step time, initial value (value
before step time) and final value (the value after)
Select the source library
click on the step block
drag the block to the work file
click on the block
step
update the parameters of the block
(change the step time, Initial value and
final value )
Connect the block to other blocks
Linear
SUM
GAIN
Derivative
Integrator
State Space
Transfer function
…
Gain (Linear library)
Gain
select linear library
drag the GAIN to the work file
K click on GAIN to select the gain.
You can rotate gain block
gain
connect it to other blocks
Integrator (Linear library)
INTEGRATOR
select linear library
drag the INTEGRATOR to the
work file
You can adjust initial conditions if
needed.
integrator
connect it to other blocks
Sink
Display displays the numerical value of the signal
Scope plot the signal
To File save in a file
To Workspace store the signal in a MATLAB
variable in the MATLAB
workspace
Sink
To Workspace store the signal in a MATLAB
variable in the MATLAB
workspace.
workspace.
This is very useful when you want to do further
processing to the result of the simulation.
---click on the box to select the variable name---
Block diagrams for SIMULINK
Simulation
simulate the following system
x 2 x x sin(2t )
x(0) x (0) 0
define
x1 x x1 x2
x2 x x 2 sin(2t ) 2 x2 x1
Example
+
sin -
-
sum integrator integrator
gain
adjust gain , sum and sine blocks
Do the three exercises in the handout