| Control System Toolbox™ | ![]() |
Specify state-space models or convert LTI model to state space
ss
sys = ss(a,b,c,d)
sys = ss(a,b,c,d,Ts)
sys = ss(d)
sys = ss(a,b,c,d,ltisys)
sys_ss = ss(sys)
ss is used to create real- or complex-valued state-space models (SS objects) or to convert transfer function or zero-pole-gain models to state space.
sys = ss(a,b,c,d) creates the continuous-time state-space model
![]()
For a model with Nx states, Ny outputs, and Nu inputs:
a is an Nx-by-Nx real- or complex-valued matrix.
b is an Nx-by-Nu real- or complex-valued matrix.
c is an Ny-by-Nx real- or complex-valued matrix.
d is an Ny-by-Nu real- or complex-valued matrix.
The output sys is an SS model that stores
the model data (see "State-Space Models" on page 2-14). If
, you can simply set d to the scalar 0 (zero), regardless of the dimension.
sys = ss(a,b,c,d,Ts) creates the discrete-time model
![]()
with sample time Ts (in seconds). Set Ts = -1 or Ts = [] to leave the sample time unspecified.
sys = ss(d) specifies
a static gain matrix
and is equivalent to
sys = ss([],[],[],d)
sys = ss(a,b,c,d,ltisys) creates a state-space model with generic LTI properties inherited from the LTI model ltisys (including the sample time). See "Generic Properties" on page 2-26 for an overview of generic LTI properties.
See "Building LTI Arrays" on page 4-12 for information on how to build arrays of state-space models.
Any of the previous syntaxes can be followed by property name/property value pairs.
'PropertyName',PropertyValue
Each pair specifies a particular LTI property of the model, for example, the input names or some notes on the model history. See set and the example below for details. Note that
sys = ss(a,b,c,d,'Property1',Value1,...,'PropertyN',ValueN)
is equivalent to the sequence of commands.
sys = ss(a,b,c,d) set(sys,'Property1',Value1,...,'PropertyN',ValueN)
sys_ss = ss(sys) converts an arbitrary TF or ZPK model sys to state space. The output sys_ss is an equivalent state-space model (SS object). This operation is known as state-space realization.
sys_ss = ss(sys,'minimal') produces a state-space realization with no uncontrollable or unobservable states. This is equivalent to sys_ss = minreal(ss(sys)).
In the case of TF to SS model conversion, ss(sys_tf) returns a modified version of the controllable canonical form. It uses an algorithm similar to tf2ss, but further rescales the state vector to compress the numerical range in state matrix A and to improve numerics in subsequent computations.
In the case of ZPK to SS conversion, ss(sys_zpk) uses direct form II structures as defined in signal processing texts. See "Discrete-Time Signal Processing" by Oppenheim and Schafer for details.
For example, in the following code, A and sys.a differ by a diagonal state transformation:
n=[1 1];
d=[1 1 10];
[A,B,C,D]=tf2ss(n,d);
sys=ss(tf(n,d));
A
A =
-1 -10
1 0
sys.a
ans =
-1 -5
2 0
See the balance or ssbal documentation for details.
The command
sys = ss(A,B,C,D,0.05,'statename',{'position' 'velocity'},...
'inputname','force',...
'notes','Created 10/15/96')
creates a discrete-time model with matrices
and sample time 0.05 second. This model has two
states labeled position and velocity, and one input labeled force (the dimensions
of
should be consistent with these
numbers of states and inputs). Finally, a note is attached with the
date of creation of the model.
Compute a state-space realization of the transfer function

by typing
H = [tf([1 1],[1 3 3 2]) ; tf([1 0 3],[1 1 1])]; sys = ss(H); size(sys) State-space model with 2 outputs, 1 input, and 5 states.
Note that the number of states is equal to the cumulative order of the SISO entries of H(s).
To obtain a minimal realization of H(s), type
sys = ss(H,'min'); size(sys) State-space model with 2 outputs, 1 input, and 3 states.
The resulting state-space model order has order three, the minimum number of states needed to represent H(s). This can be seen directly by factoring H(s) as the product of a first order system with a second order one.

dss, frd, get, set, ssdata, tf, zpk
![]() | sminreal | ss2ss | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |