|On this page…|
How to query model characteristics such as stability, time domain, and number of inputs and outputs.
This example shows how to query model dynamics such as stability, time domain, and model order. You can use the techniques of this example on type of model.
Load a saved state-space model.
load queryexample.mat T;
Query whether T has stable dynamics.
The isstable command returns a Boolean value of 1 (true) if all system poles are in the open left-half plane (for continuous-time models) or inside the open unit disk (for discrete-time models). Otherwise, isstable returns 0 (false).
Query whether T has any time delays.
This command returns 1, which indicates that T has a time delay. For a state-space model, time delay can be stored as input delay, output delay, or internal delay. Use get(T) to determine which properties of T hold the time delay.
Query whether T is proper.
This command returns 1, if the system has relative degree ≤ 0.
Query the order of T.
For a state-space model, order returns the number of states. For a tf or zpk model, the order is the number of states required for a state-space realization of the system.
Query whether T is a discrete-time model.
This command returns 1, indicating that T is a discrete-time model. Similarly, you can use isct to query whether T is a continuous-time model.
This example shows how to query the size of model arrays, including the number of inputs and outputs and the number of models in an array.
You can also use these commands on individual models.
Load a saved model array.
load queryexample sysarr
Query the array dimensions.
This command displays the array size, and the number of inputs, outputs, and states of the models in the array.
Alternatively, to obtain the array dimensions as a numeric array, use size with an output argument.
dims = size(sysarr)
This command produces the result:
dims = 3 1 2 4
The first two entries 3,1 are the number of outputs and inputs, respectively. The remaining entries 2,4 are the array dimensions.
Tip To query the number of array dimensions, use ndims.
Query the number of models in the array.
N = nmodels(sysarr)
Because sysarr is a 2-by-4 array, this command returns a result of 2 × 4 = 8.
Query whether the models in sysarr are single-input, single-output (SISO).
The command issiso returns a Boolean value of 1 (true) if the models in the array are SISO, and 0 (false) if the models are not SISO.
Query the number of inputs and outputs in the models in the array using iosize.
ios = iosize(sysarr)
This command returns a numeric array containing the number of outputs and inputs of the models in the array.