Products & Services Solutions Academia Support User Community Company

Learn more about Control System Toolbox   

connect - Arbitrary interconnection of LTI models

Syntax

Description

connect constructs the aggregate model for a given block diagram interconnection of LTI models. 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 LTI 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 cell arrays of strings.

Example of Name-Based Interconnection

Given LTI models C and G in the following block diagram,

construct the closed-loop model T from r to 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')

Index-Based Interconnection

In this approach, first combine all LTI 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 of Index-Based Interconnection

Construct the closed-loop model T for the previous block diagram.

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)

Verify that you entered all of the model information correctly by checking the following items:

Delays

The connect function supports I/O and internal delays. See Time Delays for more information and examples.

Example

Construct the model shown in the following block diagram.

.

Use the matrices of the following state-space model sys2:

A = [ -9.0201  17.7791 
      -1.6943  3.2138 ];
B = [ -.5112  .5362
      -.002  -1.8470];
C = [ -3.2897  2.4544
      -13.5009  18.0745];
D = [-.5476  -.1410
    -.6459  .2958 ];
  1. Define the three blocks in the block diagram as individual LTI models by typing the following commands:

    sys1 = tf(10,[1 5],'inputname','uc')
    sys2 = ss(A,B,C,D,'inputname',{'u1' 'u2'},...
                        'outputname',{'y1' 'y2'})
    sys3 = zpk(-1,-2,2)
    
  2. Append the blocks to form the unconnected model sys by typing the following command:

    sys = append(sys1,sys2,sys3)
    

    This command returns the following block-diagonal model:

    sys
     
    a = 
               x1      x2      x3      x4
       x1      -5       0       0       0
       x2       0   -9.02   17.78       0
       x3       0  -1.694   3.214       0
       x4       0       0       0      -2
     
    b = 
                uc       u1       u2        ?
       x1        4        0        0        0
       x2        0  -0.5112   0.5362        0
       x3        0   -0.002   -1.847        0
       x4        0        0        0        2
     
    c = 
              x1     x2     x3     x4
       ?     2.5      0      0      0
       y1      0  -3.29  2.454      0
       y2      0  -13.5  18.07      0
       ?       0      0      0     -1
     
    d = 
                uc       u1       u2        ?
       ?         0        0        0        0
       y1        0  -0.5476   -0.141        0
       y2        0  -0.6459   0.2958        0
       ?         0        0        0        2
     
    Continuous-time model.

    Note that the ordering of the inputs and outputs matches the block ordering you chose. A question mark (?) denotes an unnamed input or output.

  3. Specify the matrix Q for connections of outputs 1 and 4 into input 3 (u2), and output 3 (y2) into input 4 by typing the following syntax:

    Q = [3 1 -4
         4 3  0];
    

    Note that the second row of Q is padded with a trailing zero.

  4. Specify the two external inputs, uc and u1 (inputs 1 and 2 of sys), and the two external outputs, y1 and y2 (outputs 2 and 3 of sys), by typing the following syntax:

    inputs = [1 2];
    outputs = [2 3];
    
  5. Create a state-space model for the overall interconnection by typing the following syntax:

    sysc = connect(sys,Q,inputs,outputs)
    
    a = 
                x1       x2       x3       x4
       x1       -5        0        0        0
       x2   0.8422  0.07664    5.601   0.3369
       x3   -2.901   -33.03    45.16    -1.16
       x4   0.9293   -16.97    22.71   -1.628
     
    b = 
                uc       u1
       x1        4        0
       x2        0   -0.076
       x3        0   -1.501
       x4        0  -0.8116
     
    c = 
                 x1        x2        x3        x4
       y1   -0.2215    -5.682     5.657  -0.08859
       y2    0.4646    -8.483     11.36    0.1859
     
    d = 
                uc       u1
       y1        0   -0.662
       y2        0  -0.4058
     
    Continuous-time model.

References

[1] Edwards, J.W., "A Fortran Program for the Analysis of Linear Continuous and Sampled-Data Systems," NASA Report TM X56038, Dryden Research Center, 1976.

See Also

sumblk, strseq, append, feedback, minreal, parallel, series, lft

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS