Control Systems MEC709
INTRODUCTION TO SIMULINK
• Simulink is an extension to MATLAB, used for
modeling, simulation and analysis of
multidomain dynamic systems.
– block-diagram notation;
– build model of systems;
– visual simulation for understanding of systems
behavior;
• Program codes -> arrange blocks in Simulink
• Includes continuous, discrete, non-linear components.
• It is suitable for industrial applications.
• General representation of a system:
Input System Output
• Simulink blocks:
Sources System Sinks
• Simulink is started from MATLAB, by clicking on the Simulink
icon, or by writing Simulink in the MATLAB command prompt.
Simulink library browser Model window
Input and output blocks:
• Sources: step, sine, from workspace, from file, constant, ramp.
• Sinks: scope, display, graph, floating scope, to workspace, to file.
• Other libraries of blocks: continuous, discrete, math operations,
signal routing, logic and bit operations etc.
The blocks are connected by lines, which transfer the signals.
• The following operations are easy and intuitive in Simulink:
blocks: select, delete, resize, flip, rotate, copy, move, naming;
lines: move, branch, naming, move a vertex
annotations
• Example: plot the output of a step function
with amplitude of 12, which start at 3 seconds.
• Example: generate a
pulse input signal
• start time: 2 seconds
• amplitude: 50
• duration: 0.2
= +
• Block diagram model for the pulse function.
• Basic blocks for linear continuous systems:
1. Gain block
output input
ykx
e.g. linear spring
2. Sum block
output input input
c a b
3. Derivative block
dx
y Y ( s) s X ( s)
dt
4. Integrator block
t
y (t ) x( ) d y (t0 ) 1
Y ( s) X ( s)
t0 s
2
• Example: d x
m 2 B
dx
Kx 0
dt dt
mx Bx Kx 0
B K
x x x
m m
• m = 3 kg - mass
• B = 1 Ns/m - damping coefficient 1 2
• K = 2 N/m – spring constant x x x
• Initial condition x(0) = 4 m. 3 3
1 2
x x x
3 3
Don’t forget to include the initial condition for the second integrator: x(0) = 4 m.
• Example: system with the same parameters as
in the previous example, and with an external
force added.
2
d x dx
m 2 B Kx F
dt dt
mx Bx Kx F
B K 1
x x x F
m m m
• F=2N
1 2 1
x x x F
3 3 3
1 2 1
x x x F
3 3 3
• Example: The previous problem can be solved
by using the transfer function block (initial
conditions are zeros).
ms X (s) BsX ( s) KX ( s) F ( s)
2
Bs K X (s) F (s)
ms 2
1 1
X ( s) m 3
G( s)
F ( s) s 2 B s K 1
s s
2 2
m m 3 3
Thank you.
Questions?