Creating and Manipulating Models | ![]() ![]() |
Building LTI Arrays Using the stack Function
Another way to build LTI arrays is using the function stack
. This function operates on single LTI models as well as LTI arrays. It concatenates a list of LTI arrays or single LTI models only along the array dimension. The general syntax for stack
is
When you concatenate several models or LTI arrays along the jth array dimension, such as in
sys1,...,sysn
must all match.
sys1,...,sysn
must match.
For example, if two TF models sys1
and sys2
have the same number of inputs and outputs,
concatenates them into a 2-by-1 array of models.
There are two principles that you should keep in mind:
stack
only concatenates along an array dimension, not an I/O dimension.
[,] [;])
. See Model Interconnection Functions for more information on the use of bracket notation to concatenate models. See also Special Cases for Operations on LTI Arrays for some examples of this type of concatenation of LTI arrays.
Here's an example of how to build the LTI array H using the function stack
.
% Set up the parameter vectors. zeta = [0.66,0.75]; w = [1.2,1.5]; % Specify the four individual models with those parameters. % H11 = tf(w(1)^2,[1 2*zeta(1)*w(1) w(1)^2]); H12 = tf(w(2)^2,[1 2*zeta(1)*w(2) w(2)^2]); H21 = tf(w(1)^2,[1 2*zeta(2)*w(1) w(1)^2]); H22 = tf(w(2)^2,[1 2*zeta(2)*w(2) w(2)^2]); % Set up the LTI array using stack. COL1 = stack(1,H11,H21); % The first column of the 2-by-2 array COL2 = stack(1,H12,H22); % The second column of the 2-by-2 array H = stack(2, COL1, COL2); % Concatenate the two columns of models.
Notice that this result is very different from the single MIMO LTI model returned by
Accessing LTI Arrays of Variable Order
For arrays of state-space models with variable order, you cannot use the dot operator (e.g., sys.a
) to access arrays. Use the syntax
to extract the state-space matrices of each model as separate cells in the cell arrays a
, b
, c
, and d
.
![]() | Building LTI Arrays Using for Loops | Building LTI Arrays Using tf, zpk, ss, and frd | ![]() |