Escolar Documentos
Profissional Documentos
Cultura Documentos
Luis Snchez
INTRODUCTION
Simulink, developed by The MathWorks, is a commercial tool
for modeling, simulating and analyzing dynamic systems. Its
primary interface is a graphical block diagramming tool and a
customizable set of block libraries. It offers tight integration with
the rest of the MATLAB environment. Simulink is widely used
in control theory and digital signal processing for simulation and
design.
A block diagram is simply a graphical representation of a
process (which is composed of an input, the system, and an
output).
Capabilities of Simulink
It Simulates Linear and nonlinear systems.
It Simulates continuous, discrete and hybrid
systems.
It has a powerful What if exploration
capability.
or
Click here
SOURCES
SINKS
Sinks library contains
blocks where the signal
terminates. You may
store data in a file,
display it. Use the
terminator
block
to
terminate unused signals.
STOP block is used to
stop the simulation if the
input to the block is nonzero.
Configuration
There are lots of parameters you may want to configure regarding
your simulation. Select Configuration Parameters in the
Simulation menu.
SIMPLE EXAMPLE
x 3sin2t
Initial condition x(0) 1.
First, sketch a simulation diagram of this
mathematical model (equation)
(3 min.)
Diagrama de la Simulacin
Input is the forcing function 3sin(2t)
Output is the solution of the differential
equation x(t)
x(0) 1
3sin(2t)
(input)
1
s
x(t)
(output)
integrator
Simulation results
To verify that this plot
represents the solution
to the problem, solve
the
equation
analytically.
The analytical result,
x(t ) 12 32 cos2t
matches the plot (the
simulation
result)
exactly.
mx cx kx f (t )
mx cx kx f (t )
(continue)
First, solve for the term with highest-order
derivative
mx f (t ) cx kx
Make the left-hand side of this equation the
output of a summing block
mx
summing
block
(continue)
Add a gain (multiplier) block to eliminate
the coefficient and produce the highestderivative alone
mx
summing
block
1
m
(continue)
Add integrators to obtain the desired output
variable
mx
summing
block
1
m
1
s
1
s
(continue)
Connect to the integrated signals with gain blocks
to create the terms on the right-hand side of the
EOM
mx
summing
block
1
m
cx
1
s
c
kx
1
s
c=0.5
k=1.0
+
-
mx 1
m
cx
kx
1
s
1
s
x(t)
output
Results
Using Newton's 2nd law, the governing equation for this system
.
becomes:
m v u bv
(1)
where u is the force applied. For this example, let's assume that
m = 1000 kg; b = 50 N.sec/m; u = 500 N
V (s)
1
P(s)
U ( s ) ms b
We enter the transfer function model into MATLAB using the
following commands:
dv
dt dt v
Insert an Integrator Block (from the Continuous library) and draw lines to and from its input
and output terminals.
Label the input line "vdot" and the output line "v" as shown below. To add such a label,
double click in the empty space just above the line.
Since the acceleration (dv/dt) is equal to the sum of the forces divided by mass, we
will divide the incoming signal by the mass.
Insert a Gain block (from the Math Operations library) connected to the Integrator
block input line and draw a line leading to the input of the Gain block.
Edit the Gain block by double-clicking on it and change its value to "1/m".
Change the label of the Gain block to "inertia" by clicking on the word "Gain"
underneath the block.
Attach a Sum block (from the Math Operations library) to the line leading to the inertia Gain
block.
Change the signs of the Sum block to "+-".
Insert a Gain block below the Inertia block, select it by single-clicking on it, and select Flip
from the Format menu (or type Ctrl-F) to flip it left-to-right.
Set the block's value to "b" and rename this block to "damping".
Tap a line (hold Ctrl while drawing) off the Integrator block's output and connect it to the
input of the damping Gain block.
Draw a line from the damping Gain block output to the negative input of the Sum Block.
The second force acting on the mass is the control input, u. We will apply a step input.
Insert a Step block (from the Sources library) and connect it with a line to the positive input
of the Sum Block.
To view the output velocity, insert a Scope block (from the Sinks library) connected to the
output of the Integrator.
To provide an appropriate step input of 500 at time equal zero, double-click the Step block and
set the Step Time to "0" and the Final Value to "u".