Session 4: vector input outputs
We have already seen that blocks can have more than one input. They
can also have more than one output and, moreover, each input and output
can be vectorized. Thus to each port, it is associated a size. When connecting
an output port to an input port, port sizes must be equal.
Construct the following diagram
by copying blocks from the palettes
Scicos diagram with multiplexer
The Mux (multiplexer)
is in the Branching palette. This block can
have any number of inputs (each can be vectorized); the output is a vector
obtained as concatenation of the inputs. The only parameter of this block
is the number of inputs; there is no need to specify the size of each input.
Scicos figures the size by examining the blocks to which each input port
is connected. In the above example, the inputs are of size one and consequently
the output is a vector of size 2. Similarly for the Scope
(here is no need to specify the size of the input vector, it is adjusted
automatically.
Simulate
The simulation
result is given below.
The Scope display
Note that the Scope, when it receives a vector input, superimposes the
corresponding signals.
Modify the diagram as follows
The Demux
block does exactly the opposite of Mux,
i.e., it cuts the input vector into smaller size vectors.
Demux block undo what Mux has done
To avoid that the outputs of Scope
and MScope be
displayed on the graphics, make sure to set MScope
parameters such that it uses a different graphics window.
Modify the diagram as follows
The new block
realizes the linear dynamical system:
dx/dt = Ax + Bu
u is the input vector, x the internal state |
y = Cx + Du
y is the output |
The new block is a linear dynamical system
Modify block parameters of the new
block as follows
Note that the
block parameters are: A, B, C and D matrices. They define the sizes
of input and output vectors.
Parameters can be defined using Scilab syntax
Complete the diagram as follows
The dimensions of input output vectors are compatible
Ready to go on?
For more information about Scicos, send an e-mail to Doctor Scilab:
Scilab@inria.fr
For suggestions about this Web server, send an e-mail
to Scilab@inria.fr