| Creating and Manipulating Models | ![]() |
Extracting and Modifying Subsystems
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. 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.
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:
sys(3,1), the first index selects the output channel while the second index selects the input channel.
sminreal to eliminate unnecessary states in the subsystem.
You can use similar syntax to modify the LTI model sys. For example,
redefines the I/O relation between the first input and third output, provided NewSubSys is a SISO LTI model.
The following rules apply when modifying LTI models:
sys, the LTI model that has had a portion reassigned, retains its original model type (TF, ZPK, SS, or FRD) regardless of the model type of NewSubSys.
NewSubSys that are already assigned to NewSubSys.
NewSubSys is an FRD model, then sys must also be an FRD model. Furthermore, their frequencies must match.
Other standard matrix subindexing extends to LTI objects as well. For example,
extracts the subsystem mapping the first two inputs to the third output.
selects the first input and all outputs, and
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
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
| Precedence and Property Inheritance | Referencing FRD Models Through Frequencies | ![]() |