匿名用户
1级
2012-09-15 回答
connect Block-diagram interconnections of dynamic systems.
connect computes an aggregate model for a block diagram interconnection
of dynamic systems. You can specify the block diagram connectivity in
two ways:
Name-based interconnection
In this approach, you name the input and output signals of all blocks
SYS1, SYS2,... in the block diagram, including the summation blocks.
The aggregate model SYS is then built by
SYS = connect(SYS1,SYS2,...,INPUTS,OUTPUTS)
where INPUTS and OUTPUTS are the names of the block diagram external
I/Os (specified as strings or string vectors).
Example 1: Given SISO models C and G, you can construct the closed-loop
transfer T from r to y using
e u
r --->O-->[ C ]---[ G ]-+---> y
- | |
+
C.InputName = 'e'; C.OutputName = 'u';
G.InputName = 'u'; G.OutputName = 'y';
Sum = sumblk('e = r-y');
T = connect(G,C,Sum,'r','y')
Example 2: If C and G above are two-input, two-output models instead,
you can form the MIMO transfer T from r to y using
C.u = 'e'; C.y = 'u';
G.u = 'u'; G.y = 'y';
Sum = sumblk('e = r-y',2);
T = connect(G,C,Sum,'r','y')
Note that C.u,C.y is shorthand for C.InputName,C.OutputName and that
'r','y' select all entries of the two-entry vector signals r and y.
Example 3: If you already have specified I/O names for C and G, you
can build the closed-loop model T using:
Sum = sumblk('%e = r - %y',C.u,G.y);
T = connect(G,C,Sum,'r',G.y)
See SUMBLK for more details on using aliases like %e and %y.
Index-based interconnection
In this approach, first combine all system blocks into an aggregate,
unconnected model BLKSYS using APPEND. Then construct a matrix Q
where each row specifies one of the connections or summing junctions
in terms of the input vector U and output vector Y of BLKSYS. For
example, the row [3 2 0 0] indicates that Y(2) feeds into U(3), while
the row [7 2 -15 6] indicates that Y(2) - Y(15) + Y(6) feeds into U(7).
The aggregate model SYS is then obtained by
SYS = connect(BLKSYS,Q,INPUTS,OUTPUTS)
where INPUTS and OUTPUTS are index vectors into U and Y selecting the
block diagram external I/Os.
Example: You can construct the closed-loop model T for the block
diagram above as follows:
BLKSYS = append(C,G);
% U = inputs to C,G. Y = outputs of C,G
% Here Y(1) feeds into U(2) and -Y(2) feeds into U(1)
Q = [2 1; 1 -2];
% External I/Os: r drives U(1) and y is Y(2)
T = connect(BLKSYS,Q,1,2)
Note:
* connect always returns a state-space or FRD model SYS
* States that do not contribute to the I/O transfer from INPUTS to
OUTPUTS are automatically discarded. To prevent this, set the
"Simplify" option to FALSE:
OPT = connectOptions('Simplify',false);
SYS = connect(...,OPT)