Lec 5
Lec 5
Lec 5
http://www.mathworks.com
What is Simulink good for?
-Modeling/designing dynamic systems
(including nonlinear dynamics)
-Modeling/designing control systems
(including nonlinear controllers and
plants)
-Signal processing design/simulation
Simulink runs under Matlab. First
start Matlab, then type “simulink” at
the Matlab prompt.
The first window that
pops up is the Library
Browser.
This is a library of
blocks that are
available for putting
into the Simulink block
diagram.
Simulink Help
Select “Simulink
Help” from the
help menu in the
library browser.
Here you can
find tutorials,
demos,
information on
available blocks,
and so on.
A Simulink model is a block diagram. Click “File|
New|Model” in the Library Browser. An empty
block diagram will pop up. You can drag blocks into
the diagram from the library.
Sources: Produce Signals
Note: numerical
solution using
ode45!
Set start and
I often change
stop time for the
from variable-step
simulation
to fixed-step to get
here.
a smoother-looking
solution.
Running the Simulation
U(s) = 1/s
X(s)=1/(s(s+1))=1/s-1/(s+1)
So x(t)=1-exp(-t)
Do In-Class Problem
#2.
Closed Loop Control System:
(t)=ki(t)-f()
J
where f(w) is coulomb and viscous friction.
i(t)
Do in-class
problem #3.
Subsystems
You can group a set of blocks together into a subsystem, by selecting them
and right clicking and saying “Create Subsystem”. They will all go under a
single block. If you double click the subsystem, you can see what is under
the “mask”.
User Defined Functions
You can embed user-defined m-files
using the “Embedded MATLAB
Function” block under the “user-
defined functions” library.
Running Simulink Models from M-files
[T,X,Y] = SIM('model',TIMESPAN,OPTIONS,UT)
Constants in the
simulink model
can be defined in
the workspace.