Matlab
Matlab
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 here.
to fixed-step to get
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)
(t)=ki(t)-f()
J
where f(w) is coulomb and viscous friction.
i(t)
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.