%% Query Model Characteristics
% This example shows how to query model characteristics such as stability, time domain, and number of inputs and outputs. You can use the techniques of this example on any type of dynamic system model.
% Load a saved state-space (ss) model.

load('queryexample.mat','T')

%
% Query whether T has stable dynamics.

Bstab = isstable(T)

% The isstable command returns 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 command returns 0 (false). Here, the result shows that the model is stable.
%
% Query whether T has time delays.

Bdel = hasdelay(T)

% The returned value, 1, indicates that T has a time delay. For a state-space model, time delay can be stored as input delay, output delay, internal delay, or a combination. Use get(T) to determine which properties of T hold the time delay, and use dot notation to access the delay values. The hasInternalDelay command tells you whether there is any internal delay.
%
% Query whether T is proper.

Bprop = isproper(T)

% The returned value indicates that the system has relative degree less than or equal to 0. This is true of a SISO system when it can be represented as a transfer function in which the degree of the numerator does not exceed the degree of the denominator.
%
% Query the order of T.

N = order(T)

% For a state-space model, order returns the number of states, which is 5 in this case. 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 system.

Bdisc = isdt(T)

% The returned value indicates that T is a discrete-time model. Similarly, use isct to query whether T is a continuous-time model.
%
% Load a MIMO model and query the input/output dimensions.

load('queryexample.mat','Tmimo')
ios = iosize(Tmimo)

% In the resulting array, the number of outputs is first. Therefore, Tmimo has 4 inputs and 7 outputs.
% Copyright 2012 The MathWorks, Inc.