| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Control System Toolbox |
| Contents | Index |
| Learn more about Control System Toolbox |
| On this page… |
|---|
Note on Indexing into LTI Arrays of FRD Models Accessing Particular Models in an LTI Array Extracting LTI Arrays of Subsystems |
You can index into LTI arrays in much the same way as you would for multidimensional arrays to
Access models
Extract subsystems
Reassign parts of an LTI array
Delete parts of an LTI array
When you index into an LTI array sys, the indices should be organized according to the following format
![]()
where
Outputs are indices that select output channels.
Inputs are indices that select input channels.
are indices into
the array dimensions that select one model or a subset of models in
the LTI array.
For FRD models, the array indices can be followed by the keyword 'frequency' and some expression selecting a subset of the frequency points as in
sys (outputs, inputs, n1,...,nk, 'frequency', SelectedFreqs)
See Referencing FRD Models Through Frequencies for details on frequency point selection in FRD models.
To access any given model in an LTI array:
Use colon arguments (:,:) for the first two indices to select all I/O channels.
The remaining indices specify the model coordinates within the array.
For example, if sys is a 5-by-2 array of state-space models defined by
sys = rss(4,3,2,5,2);
you can access (and display) the model located in the (3,2) position of the array sys by typing
sys(:,:,3,2)
If sys is a 5-by-2 array of 3-output, 2-input FRD models, with frequency vector [1,2,3,4,5], then you can access the response data corresponding to the middle frequency (3 rad/s), of the model in the (3,1) position by typing
sys(:,:,3,1,'frequency',3.0)
To access all frequencies of this model in the array, you can simply type
sys(:,:,3,1)
You can also access models using single index referencing of the array dimensions.
For example, in the 5-by-2 LTI array sys above, you can also access the model located in the (3,2) position by typing
sys(:,:,8)
since this model is in the eighth position if you were to list the 10 models in the array by successively scanning through its entries along each of its columns.
For more information on single index referencing, see Linear Indexing in the MATLAB online documentation.
To select a particular subset of I/O channels from all the models in an LTI array, use the syntax described in Extracting and Modifying Subsystems. For example,
sys = rss(4,3,2,5,2); A = sys(1, [1 2])
or equivalently,
A = sys(1,[1 2],:,:)
selects the first two input channels, and the first output channel in each model of the LTI array A, and returns the resulting 5-by-2 array of one-output, two-input subsystems.
You can also combine model selection with I/O selection within an LTI array. For example, to access both:
The state-space model in the (3,2) array position
Only the portion of that model relating the second input to the first output
type
sys(1,2,3,2)
To access the subsystem from all inputs to the first two output channels of this same array entry, type
sys(1:2,:,3,2)
You can reassign entire models or portions of models in an LTI array. For example,
sys = rss(4,3,2,5,2); % 5X2 array of state-space models H = rss(4,1,1,5,2); % 5X2 array of SISO models sys(1,2) = H
reassigns the subsystem from input two to output one, for all models in the LTI array sys. This SISO subsystem of each model in the LTI array is replaced with the LTI array H of SISO models. This one-line assignment command is equivalent to the following 10-step nested for loop.
for k = 1:5
for j = 1:2
sys(1,2,k,j) = H(:,:,k,j);
end
end
Notice that you don't have to use the array dimensions with this assignment. This is because I/O selection applies to all models in the array when the array indices are omitted.
Similarly, the commands
sys(:,:,3,2) = sys(:,:,4,1); sys(1,2,3,2) = 0;
reassign the entire model in the (3,2) position of the LTI array sys and the (1,2) subsystem of this model, respectively.
You can use indexing to delete any part of an LTI array by reassigning it to be empty ([]). For instance,
sys = rss(4,3,2,5,2); sys(1,:) = []; size(sys) 5x2 array of continuous-time state-space models Each model has 2 outputs, 2 inputs, and 4 states.
deletes the first output channel from every model of this LTI array.
Similarly,
sys(:,:,[3 4],:) = []
deletes the third and fourth rows of this two-dimensional array of models.
![]() | Building LTI Arrays | Operations on LTI Arrays | ![]() |

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 |