Matlab Training - SIMULINK
Matlab Training - SIMULINK
Matlab Training - SIMULINK
SIMULINK
SIMULINKTM is a program for simulating dynamic systems.As an extension to MATLAB,
SIMULINK adds many features specific to dynamic systems while retaining all of MATLAB’s
general purpose functionality. SIMULINK has two phases of use: model definition and model
analysis. A typical session starts by either defining a model or retrieving a previously defined
model, and then proceeds to analysis of that model. These two steps are often performed itera-
tively until the model achieves the desired behavior.
To facilitate model definition, SIMULINK adds a new class of windows called block diagram
windows. In these windows, models are created and edited principally by mouse driven com-
mands. Part of mastering SIMULINK is to become familiar with the manipulation of model com-
ponents within these windows. After you define a model, you can analyze it either by choosing
options from the SIMULINK menus or by entering commands in MATLAB’s command window.
Built-in analysis tools include various simulation algorithms, linmod, a tool for extracting linear
models of systems, and trim, a tool for finding equilibrium points.
Open Sources, Sinks, Linear, and Connections by double-clicking on the icon with the
left mouse button. Move the windows to a comfortable position. Blocks can be copied from one
window to another by dragging them from the original location to the new location by holding
down the left mouse button. Assemble the following diagram in your working window (page 3).
[ Step Input -> Sources; Sum & Transfer Fcn -> Linear; Auto-Scale Graph -> Sinks ]
1 of 8
SimuLink
2 of 8
SimuLink
(1) Enlarge the blocks, arrange into order, and wire them together as shown. Blocks are
expandeded by dragging the corner indicators outward with the mouse; To wire a block,
drag the block’s output arrow to the input arrow of the next icon using the left mouse button.
(2) Double click on the Transfer Fcn block and change the coefficients
(3) Click on File, then Save and name your model trysimu1
(4) Click on Simulation, then Parameters and set Stop Time to 6 and Max Step Size to 0.1.
(5) Click on Simulation, then Start and observe the trace on the Auto-Scale Graph.
*Notice the exponential response with maximum value at 0.25 (is this what we expect?).
3 of 8
SimuLink
4 of 8
SimuLink
(1) Now modify the model to the closed-loop feedback control system shown below.
(2) Double click on the Sum block and set the second symbol to - (minus sign).
(3) Wire the feedback:
Get a tap off the Transfer Fcn wire with a right-click-hold-drag and pull it down below the
icon. Point left-click-hold-drag to add a new wire to the head of the feedback arrow and move
left under the Sum block. Repeat this procedure to go up then right into the - input of the sum.
(4) Click on Simulation, then Start and observe the trace on the Graph window.
*Notice that with feedback we have increased the speed of the response
(5) Save the model.
5 of 8
SimuLink
6 of 8
SimuLink
A Nonlinear Model:
2
Consider ẋ˙ + ( x – 1 )ẋ + x = 0
Let x 1 = ẋ x2 = x
2
Then ẋ 1 = x 1 ( 1 – x 2 ) – x 2 and ẋ 2 = x 1
7 of 8
SimuLink
A graphics file of the block diagram model can be created using the same print command used
with graphs.
1. The model name should be the current model window you want to print.
The print command creates a graphics file specified with the default format being PostScript
2. The user sends the graphics file to the printer from the operating system prompt
Printing Example:
(1) In MATLAB type
>>print -svdpol vdpol
(2) In Unix type
SunOS/boswell 3% lp -deb119_ps1 vdpol.ps
8 of 8