子衿沉夜
connect Block-diagram interconnections of dynamic systems.connect computes an aggregate model for a block diagram interconnectionof dynamic systems. You can specify the block diagram connectivity intwo ways:Name-based interconnectionIn this approach, you name the input and output signals of all blocksSYS1, SYS2,... in the block diagram, including the summation blocks.The aggregate model SYS is then built bySYS = connect(SYS1,SYS2,...,INPUTS,OUTPUTS)where INPUTS and OUTPUTS are the names of the block diagram externalI/Os (specified as strings or string vectors).Example 1: Given SISO models C and G, you can construct the closed-looptransfer T from r to y usinge ur --->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 usingC.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, youcan 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 interconnectionIn this approach, first combine all system blocks into an aggregate,unconnected model BLKSYS using APPEND. Then construct a matrix Qwhere each row specifies one of the connections or summing junctionsin terms of the input vector U and output vector Y of BLKSYS. Forexample, the row [3 2 0 0] indicates that Y(2) feeds into U(3), whilethe row [7 2 -15 6] indicates that Y(2) - Y(15) + Y(6) feeds into U(7).The aggregate model SYS is then obtained bySYS = connect(BLKSYS,Q,INPUTS,OUTPUTS)where INPUTS and OUTPUTS are index vectors into U and Y selecting theblock diagram external I/Os.Example: You can construct the closed-loop model T for the blockdiagram 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 toOUTPUTS are automatically discarded. To prevent this, set the"Simplify" option to FALSE:OPT = connectOptions('Simplify',false);SYS = connect(...,OPT)