Creating and Manipulating Models | ![]() ![]() |
size and ndims
You can access the dimensions and shape of an LTI array using
size
to determine the lengths of each of the dimensions associated with an LTI array
ndims
to determine the total number of dimensions in an LTI array
When applied to an LTI array, size
returns
Ny
is the number of outputs common to all models in the LTI array.
Nu
is the number of inputs common to all models in the LTI array.
Si
is the number of models along the ith array dimension.
Note the following when using the size
function:
[Ny Nu]
.
[Ny Nu 2 1]
size
ignores trailing singleton dimensions beyond the second array dimension. For example, size returns [Ny Nu 2 3]
for a 2-by-3-by-1-by-1 LTI array of models with Ny
outputs and Nu
inputs.
The function ndims
returns the total number of dimensions in an LTI array:
p
, for LTI arrays, where p
(greater than 2) is the number of array dimensions
To see how these work on the sample 2-by-3 LTI array m2d
of two-output, one-input models, type
Notice that size
returns a vector whose entries correspond to the length of each of the four dimensions of m2d
: two outputs and one input in a 2-by-3 array of models. Type
to see that there are indeed four dimensions attributed to this LTI array.
![]() | Dimensions, Size, and Shape of an LTI Array | reshape | ![]() |