Extracting and Modifying Subsystems

What is a Subsystem?

Subsystems relate subsets of the inputs and outputs of a system. The transfer matrix of a subsystem is a submatrix of the system transfer matrix.

Basic Subsystem Concepts

For example, if sys is a system with two inputs, three outputs, and I/O relation

then gives the relation between the first input and third output.

Accordingly, use matrix-like subindexing to extract this subsystem.

SubSys = sys(3,1)

The resulting subsystem SubSys is an LTI model of the same type as sys, with its sample time, time delay, I/O name, and I/O group property values inherited from sys.

For example, if sys has an input group named controls consisting of channels one, two, and three, then SubSys also has an input group named controls with the first channel of SubSys assigned to it.

If sys is a state-space model with matrices a, b, c, d, the subsystem sys(3,1) is a state-space model with data a, b(:,1), c(3,:), d(3,1). Note the following rules when extracting subystems:

You can use similar syntax to modify the LTI model sys. For example,

sys(3,1) = NewSubSys

redefines the I/O relation between the first input and third output, provided NewSubSys is a SISO LTI model.

Rules for Modifying LTI Model Subsystems

The following rules apply when modifying LTI model subsystems:

Other standard matrix subindexing extends to LTI objects as well. For example,

sys(3,1:2)

extracts the subsystem mapping the first two inputs to the third output.

sys(:,1)

selects the first input and all outputs, and

sys([1 3],:)

extracts a subsystem with the same inputs, but only the first and third outputs.

For example, consider the two-input/two-output transfer function

To extract the transfer function from the first input to the first output, type

T(1,1) 

Transfer function:
   1
-------
s + 0.1

Next reassign to and modify the second input channel of T by typing

T(1,1) = tf(1,[1 0.5]);
T(:,2) = [ 1 ; tf(0.4,[1 0]) ]

Transfer function from input 1 to output...
         1
 #1:  -------
      s + 0.5
 
          s - 1
 #2:  -------------
      s^2 + 2 s + 2
 
Transfer function from input 2 to output...
 #1:  1
 
      0.4
 #2:  ---
       s

Referencing FRD Models Through Frequencies

You can extract subsystems from FRD models, as you do with other LTI model types, by indexing into input and output (I/O) dimensions. You can also extract subsystems by indexing into the frequencies of an FRD model.

To index into the frequencies of an FRD model, use the string 'Frequency' (or any abbreviation, such as, 'freq', as long as it does not conflict with existing I/O channel or group names) as a keyword. There are two ways you can specify FRD models using frequencies:

For example, if sys is an FRD model with five frequencies, (e.g., sys.Frequency=[1 1.1 1.2 1.3 1.4]), then you can create a new FRD model sys2 by indexing into the frequencies of sys as follows.

sys2 = sys('frequency', 2:3);
sys2.Frequency

ans =
    1.1000
    1.2000

displays the second and third entries in the frequency vector.

Similarly, you can use logical indexing into the frequencies.

sys2 = sys('frequency',sys.Frequency >1.0 & sys.Frequency <1.15);
sys2.freq

ans =
    1.1000

You can also combine model extraction through frequencies with indexing into the I/O dimensions. For example, if sys is an FRD model with two inputs, two outputs, and frequency vector [2.1 4.2 5.3], with sys.Units specified in rad/s, then

sys2 = sys(1,2,'freq',1)

specifies sys2 as a SISO FRD model, with one frequency data point, 2.1 rad/s.

Referencing Channels by Name

You can also extract subsystems using I/O group or channel names. For example, if sys has an input group named noise, consisting of channels two, four, and five, then

sys(1,'noise')

is equivalent to

sys(1,[2 4 5])

Similarly, if pressure is the name assigned to an output channel of the LTI model sys, then

sys('pressure',1) = tf(1, [1 1])

reassigns the subsystem from the first input of sys to the output labeled pressure.

You can reference a set of channels by input or output name by using a cell array of strings for the names. For example, if sys has one output channel named pressure and one named temperature, then these two output channels can be referenced using

sys({'pressure','temperature'})

Resizing LTI Systems

Resizing a system consists of adding or deleting inputs and/or outputs. To delete the first two inputs, simply type

sys(:,1:2) = []

In deletions, at least one of the row/column indexes should be the colon (:) selector.

To perform input/output augmentation, you can proceed by concatenation or subassignment. Given a system sys with a single input, you can add a second input using

sys = [sys,h];

or, equivalently, using

sys(:,2) = h;

where h is any LTI model with one input, and the same number of outputs as sys. There is an important difference between these two options: while concatenation obeys the Precedence Rules, subsystem assignment does not alter the model type. So, if sys and h are TF and SS objects, respectively, the first statement produces a state-space model, and the second statement produces a transfer function.

For state-space models, both concatenation and subsystem assignment increase the model order because they assume that sys and h have independent states. If you intend to keep the same state matrix and only update the input-to-state or state-to-output relations, use set instead and modify the corresponding state-space data directly. For example,

sys = ss(a,b1,c,d1)
set(sys,'b',[b1 b2],'d',[d1 d2])

adds a second input to the state-space model sys by appending the B and D matrices. You should simultaneously modify both matrices with a single set command. Indeed, the statements

sys.b = [b1 b2]

and

set(sys,'b',[b1 b2])

cause an error because they create invalid intermediate models in which the B and D matrices have inconsistent column dimensions.

  


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