Graphics Programs Reference
In-Depth Information
multiplication by a constant, and one Sum block, used for addition. These
are all chosen from the “Math” library (fourth from the right in Figure 8-1, or
fourth from the top in Figure 8-2). Hooking them up the same way we did with
the Integrator blocks gives a model window that looks something like this:
1
s
u '
1
s
u
1
1
Gain
Gain1
1
Gain2
We need to go back and edit the properties of the Gain blocks, to change
the constants by which they multiply from the default of 1 to 5 (in “Gain”),
1 (in “Gain1”), and 2 (in “Gain2”). To do this, double-click on each Gain
block in turn. A Block Parameters box will open in which you can change the
Gain parameter to whatever you need. Next, we need to send u , the output
of the first Integrator block, to the input port of block “Gain2”. This presents
a problem, since an Integrator block only has one output port and it's already
connected to the next Integrator block. So we need to introduce a branch line .
Position the mouse in the middle of the arrow connecting the two Integrators,
hold down the CTRL key withone hand, simultaneously pushdown the left
mouse button with the other hand, and drag the mouse around to the input
port of the block entitled “Gain2”. At this point we're almost done; we just
need a block for viewing the output. Open up the “Sinks” library and drag a
copy of the Scope block into the model window. Hook this up with a branch
line (again using the CTRL key) to the line connecting the second Integrator
and the Gain block. At this point you might want to relabel some more of the
blocks (by editing the text under each block), and also label some of the arrows
(by double-clicking on the arrow shaft to open a little box in which you can
type a label). We end up with the model shown in Figure 8-4.
Now we're ready to run our simulation. First, it might be a good idea to save
the model, using Save as... from the File menu. One might choose to give it
the name li e OD . (MATLAB automatically adds the file extension . .)
To see what is happening during the simulation, double-click on the Scope
block to open an “oscilloscope” that will plot u as a function of t . Of course
one needs to set initial conditions also; this can be done by double-clicking on
Search WWH ::




Custom Search