Products & Services Solutions Academia Support User Community Company

Learn more about Control System Toolbox   

ss - Specify state-space models or convert LTI model to state space

Syntax

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)
sys_ss = ss(sys,'minimal')
sys_ss = ss(sys,'explicit')

Description

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.

Creation of State-Space Models

sys = ss(a,b,c,d) creates a SS object representing the continuous-time state-space model

For a model with Nx states, Ny outputs, and Nu inputs:

To set D = 0 , set d to the scalar 0 (zero), regardless of the dimension. For more information on state-space models, see Creating State Space Models.

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 D 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). For an overview of generic LTI properties, see Generic LTI Properties.

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. For more details, see set and Example 1. The following expression:

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)

See Building LTI Arrays for information on how to build arrays of state-space models.

Conversion to State Space

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 state-space realization is equivalent to sys_ss = minreal(ss(sys)).

sys_ss = ss(sys,'explicit') computes an explicit realization (E = I) of the proper LTI model sys. If sys is improper, ss returns an error.

Algorithm

For 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.

For 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

For details, see balance.

Examples

Example 1

The command

sys = ss(A,B,C,D,0.05,'statename',{'position' 'velocity'},...
                          'inputname','force',...
                          'notes','Created 10/15/07')

creates a discrete-time model with matrices A,B,C,D and sample time 0.05 second. This model has two states labeled position and velocity, and one input labeled force (the dimensions of A,B,C,D should be consistent with these numbers of states and inputs). Finally, a note is attached with the date of creation of the model.

Example 2

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.

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 has order of three, which is the minimum number of states needed to represent H(s). You can see this number of states by factoring H(s) as the product of a first-order system with a second-order system.

Example 3

Compute an explicit realization of a descriptor state-space model.

a = [2 -4; 4 2];
b = [-1; 0.5];
c = [-0.5, -2];
d = [-1];
e = [1 0; -3 0.5];
% Create a descriptor state-space model.
sys1 = dss(a,b,c,d,e); 

% Compute an explicit realization.
sys2 = ss(sys1,'explicit')

a = 
        x1   x2
   x1    2   -4
   x2   20  -20
 
b = 
       u1
   x1  -1
   x2  -5
 
c = 
         x1    x2
   y1  -0.5    -2
 
d = 
       u1
   y1  -1
 
Continuous-time model.

The result is an explicit state-space model (E = I). A Bode plot shows that sys1 and sys2 are equivalent.

bode(sys1,sys2)

See Also

dss, frd, get, set, ssdata, tf, zpk

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2010- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS