Professional Documents
Culture Documents
Lab01 Get Start Simulink Old
Lab01 Get Start Simulink Old
1) SIMULINK is run from the MATLAB prompt, >>, so the first step is to get MATLAB
running.
-- Connect to the Network
-- Launch MATLAB. ( if you have not already installed MATLAB you will need to
do so at this time. Refer to the instructions handed out in Le 01.)
2) At the prompt, >>, in the MATLAB Command Window, type simulink and
press ! Enter.
4) After making the selections in Step 3, the SIMULINK Library Browser will show
folders that contain the most commonly used elements you will be using for
model creation.
Click on each of the following folders and quickly note the elements that are
contained in each.
-- Continuous
-- Discrete
-- Functions & Tables
-- Math
-- Nonlinear
-- Signals & Systems
-- Sinks
-- Sources
5) You have not yet created a model, but if you had, you would want to be able to
save the model.
1) The first model you are going to build will solve a simple 1st order differential
equation given by
dx
= 3 sin( 2 t )
dt
with an initial condition x(0) = -1.
I.C.: x(0) = -1
dx
input: dt 1 x output:
3sin(2t) x(t)
s
Locate the Sine Wave under the Sources folder and Click, Drag, and Drop it in
the model workspace window to create the Input Block
5) Locate the Scope under the Sinks folder and Click, Drag, and Drop it in the
model workspace window to create the Output Block
Blocks can be connected by dragging a line from the output of one block to the
input of another block.
Most blocks have different parameters that are associated with them. To access
the parameters, simply double-click on the block of interest. This will bring up a
dialog box which allows the parameters to be changed.
Amplitude = 3
Frequency = 2
x(0) = -1
8) Now that the model has been defined and created, the model simulation is
ready to run.
To Start a simulation,
pull down the Simulation
menu, and select Start.
Peak = ____________
Valley = ____________
Period = ____________
To verify that this plot represents the solution to the problem, let's solve the
equation another way. Either manually, or using Maple, obtain the solution x(t) of
the ODE with the initial condition
dx
= 3 sin( 2t ) with x(0) = -1
dt
x (t ) = 1
2 − 3
2 cos (2 t )
This is the function that was plotted in the SIMULINK Scope window.
2) In the space below attempt to draw the simulation diagram for this model:
For comparison, start by solving the model equation for the highest order
derivative term.
d 2x dx
m 2 = f (t ) − c −k x
dt dt
The first block you create should be a Sum block, where the output of the Sum
block is the left-hand term of the equation above.
d2x
m dt2
sum block
Now using SIMULINK, Create a new workspace..... File ..... New.....Model
Locate the Sum Block in the ____________ library and Click, Drag and Drop it
into your new workspace.
The Sum block is to have 3 inputs. Double click on the Block and set the
parameters to rectangular and + - - .
Add a gain (multiplier) block to normalize the coefficient, m, to modify the signal
so it is equal to the highest order derivative term alone.
d2x d2x
m
dt2 dt2
1
m
Click, Drag, and Drop a Gain Block from the _____________ library into the
SIMULINK workspace.
d2x d2x dx
m x
dt2
1
dt2 1 dt 1
m
s s
sum block gain Integrator Integrator
Click, Drop, and Drag two Integrator Blocks into your SIMULINK workspace from
the _______________ library.
Also:
Set the initial condition parameters to zero for both integrators.
Add a scope block to the output of the second integrator
Connect the output ports to the input port as shown
Label each of the signals by double clicking on the leader line.
In the Simulation Diagram, connect the integrated signals with gain blocks to
create the terms on the right-hand side of the model equation.
d2x d2x dx
m x
dt2
1
dt2 1 dt 1
m
s s
sum block dx
c
dt
c
kx
k
In SIMULINK, Drag in two additional Gain blocks from the Math library to the
workspace.
--Flip these blocks by selecting each block and using...... Format.......Flip Block
--Double click on each of the blocks and set the appropriate parameters
c = 0.5
k = 1.0
--Connect the signal lines:
Either Click the gain block input and drag to each of the branch points.
or
Ctrl-Click to select the branch point first and drag to the gain inputs.
--Add appropriate titles to the gain blocks
c = 0.5
k = 1.0
In the Simulation Diagram, connect all the input signals to the appropriate inputs
of the Sum Block.
Input:
+ d2x d2x dx
f(t) m x
-
dt2
1
dt2 1 dt 1 Output:
x(t)
m
- s s
dx
c
dt
c
kx
k
Steady State Value is the final value of the system settles at after transient
behavior has dissipated.
Rise time is time required for the system to rise from ten to ninety percent of the
steady state value.
Settling time is the amount of time the system takes to value settle close to the
steady state condition (to within approximately 2% of the step size).
Settling
Time
Overshoot
Steady State
Value
+/- 2% of step
Rise
Time
.
1) Mass-Spring-Damper Model:
Below you will explore how changing each of the three parameters, m, c, and k ,
affect the system response of the spring-mass-damper model created in Part C.
Now using your SIMULINK model, vary the value of the mass, m, using the
multipliers given below, while keeping k and c constant. Then on the graph
below sketch and label each response.
Now using your SIMULINK model, vary the value of the mass, c, using the
multipliers given below, while keeping k and m constant. Then on the graph
below sketch and label each response.
Now using your SIMULINK model, vary the value of the elastic coefficient, k, using
the multipliers given below, while keeping m and c constant. Then on the graph
below sketch and label each response.
Use Elastic Coef values: k/5 k/2 1.0*k 2.0*k and 5*k
16
14
12
10
0
0 1 2 3 4 5
A simple electrical circuit consists of a Resistor, Coil, and Capacitor in series with
a variable voltage source, E(t).
R
L
e
i
+ C
E(t)
The circuit may be modeled using two 1st order DE's given as
di R 1 1 de 1
+ i + e = E (t ) and − i=0
dt L L L dt C
with i(0) = 0 with e(0) = 0
where i is the current in the circuit and e is the electric potential at the node
between the coil and capacitor.
R=3
L=1 2
C =0.5 E(t)
and E(t), which is a pulse defined as t
1 5
Add Scope Blocks to display both outputs, i and e, as well as the input voltage,
E(t). Make sure you include appropriate labeling of the blocks, signals, and I/O.
i
e
t t
Now experiment with your model by varying each of the component parameters,
R, L, and C. Describe the effect each has on the system response.
Effect of Varying R:
Effect of Varying L:
Effect of Varying C:
1) This handout, Part D with all graphs, tables, and questions completed.
2) A printed copy of your spring-mass-damper system SIMULINK model.
3) A printed copy of your electrical system SIMULINK model.