Select an input blockDrag a Sine Wave block from the Sources library to the model window... Select an operator blockDrag an Integrator block from the Continuous library to the model wind
Trang 1Getting started with Simulink
An introductory tutorial
ES205 Analysis and Design of Engineering Systems
Rose-Hulman Institute of Technology
© R Layton 2001
Trang 2 Dial 6000 and say "Help Desk"
Visit the TSC in Crapo Hall, Room G-139
E-mail to helpdesk@rose-hulman.edu
Trang 3Launch Matlab
Application explorer (ZENworks)
[All] Matlab 5.3
Trang 4Launch Simulink
In the MATLAB command window,
at the >> prompt, type simulink
and press Enter
Trang 5Create a new model
Click the new-model
icon in the upper left
corner to start a new
Trang 6Your workspace
Library of elements Model is created in this window
Trang 7Save your model
You might create a new folder, like the one shown below, called simulink_files
Use the mdl suffix when saving
Trang 8Example 1: a simple model
Build a Simulink model that solves the differential equation
0 ( = −
x
Trang 9Simulation diagram
Input is the forcing function 3sin(2t)
Output is the solution of the differential
0 ( = −
x
integrator
Trang 10Select an input block
Drag a Sine Wave block from the Sources library
to the model window
Trang 11Select an operator block
Drag an Integrator block from the Continuous library
to the model window
Trang 12Select an output block
Drag a Scope block from the
Sinks library to the model window
Trang 13Connect blocks with signals
Place your cursor on
the output port (>) of
the Sine Wave block
Drag from the Sine
Wave output to the
Integrator input
Drag from the
Integrator output to
the Scope input Arrows indicate the
direction of the signal flow.
Trang 14Select simulation parameters
Trang 15Select simulation parameters
Trang 16Select simulation parameters
Double-click on
the Scope to view
the simulation
results
Trang 17Run the simulation
Trang 18Simulation results
To verify that this
plot represents the
solution to the
problem, solve the
equation analytically
The analytical result,
matches the plot
( )t t
x( ) 23 cos 2
2
=
Trang 19x c x
m + + =
Trang 20Create the simulation diagram
On the following slides:
The simulation diagram for solving the ODE
is created step by step
After each step, elements are added to the Simulink model
Optional exercise: first, sketch the
complete diagram (5 min.)
= +
+
Trang 21c t
f x
m = ( ) − −
x
m
Trang 22Drag a Sum block from the Math library
Double-click to change the
block parameters to
Trang 23 Add a gain (multiplier) block to
eliminate the coefficient and produce the highest-derivative alone
Trang 24Drag a Gain block from the Math library
Double-click to change the
block parameters.
The gain is 4 since 1/m=4.
Trang 26Drag Integrator blocks from the Continuous library
Add a scope from the Sinks library.
Connect output ports to input ports.
ICs on the integrators are zero.
Trang 27 Connect to the integrated signals with gain blocks to create the terms on the right-hand side of the EOM
kx
Trang 28Drag new Gain blocks from the Math library
Double-click on gain blocks to
set parameters
Connect from the gain block
input backwards up to the
Trang 29Complete the model
Bring all the signals and inputs to the
Trang 30Double-click on Step block
to set parameters For a step input of magnitude 3, set Final value to 3
Trang 31Final Simulink model
Trang 32Run the simulation
Trang 33Underdamped response Overshoot of 0.5.
Final value of 3.
Is this expected?
Trang 34t
f k
x
x k
c m
k
x
= +
5 0
Trang 35Check simulation results
Damping ratio of 0.5 is less than 1
Expect the system to be underdamped.
Expect to see overshoot.
Static gain is 1
Expect output magnitude to equal input
magnitude.
Input has magnitude 3, so does output.
Simulation results conform to expectations
Trang 36End of tutorial