Categories &

Functions List

Class Definition: ss

Function File: sys = ss (sys)
Function File: sys = ss (d, …)
Function File: sys = ss (a, b, …)
Function File: sys = ss (a, b, c, …)
Function File: sys = ss (a, b, c, d, …)
Function File: sys = ss (a, b, c, d, tsam, …)

Create or convert to state-space model.

Inputs

sys

LTI model to be converted to state-space.

a

State matrix (n-by-n).

b

Input matrix (n-by-m).

c

Output matrix (p-by-n). If c is empty [] or not specified, an identity matrix is assumed.

d

Feedthrough matrix (p-by-m). If d is empty [] or not specified, a zero matrix is assumed.

tsam

Sampling time in seconds. If tsam is not specified, a continuous-time model is assumed.

Optional pairs of properties and values. Type set (ss) for more information.

Outputs

sys

State-space model.

Option Keys and Values

’a’, ’b’, ’c’, ’d’, ’e’

State-space matrices. See ’Inputs’ for details.

’stname’

The name of the states in sys. Cell vector containing strings for each state. Default names are {'x1', 'x2', ...}

’scaled’

Logical. If set to true, no automatic scaling is used, e.g. for frequency response plots.

’tsam’

Sampling time. See ’Inputs’ for details.

’inname’

The name of the input channels in sys. Cell vector of length m containing strings. Default names are {'u1', 'u2', ...}

’outname’

The name of the output channels in sys. Cell vector of length p containing strings. Default names are {'y1', 'y2', ...}

’ingroup’

Struct with input group names as field names and vectors of input indices as field values. Default is an empty struct.

’outgroup’

Struct with output group names as field names and vectors of output indices as field values. Default is an empty struct.

’name’

String containing the name of the model.

’notes’

String or cell of string containing comments.

’userdata’

Any data type.

Equations $$\dot{x} = A\,x + B\,u$$$$y = C\,x + D\,u$$

Example

 
 
 octave:1> a = [1 2 3; 4 5 6; 7 8 9];
 octave:2> b = [10; 11; 12];
 octave:3> stname = {'V', 'A', 'kJ'};
 octave:4> sys = ss (a, b, 'stname', stname)
 
 sys.a =
         V   A  kJ
    V    1   2   3
    A    4   5   6
    kJ   7   8   9
 
 sys.b =
        u1
    V   10
    A   11
    kJ  12

 sys.c =
         V   A  kJ
    y1   1   0   0
    y2   0   1   0
    y3   0   0   1
 
 sys.d =
        u1
    y1   0
    y2   0
    y3   0
 
 Continuous-time model.
 octave:5> 
 
 

Note on compatibility

If the state-space model sys is converted from a transfer function, the resulting state-space model can be transformed into the form computed by Matlab (a controllable canonical form with flipped state variables order) by using the following similarity transformation:

 
 
 n = size (sys.a, 1)
 QSi = inv (ctrb (sys))
 T(n,:) = QSi(n,:)
 for i=n-1:-1:1, T(i,:) = T(i+1,:)*sys.a, endfor
 sys_ml = ss2ss (sys, T)
 
 

See also: tf, dss

Source Code: ss

Method: ss

Function File: sys = ss (sys)
Function File: sys = ss (d, …)
Function File: sys = ss (a, b, …)
Function File: sys = ss (a, b, c, …)
Function File: sys = ss (a, b, c, d, …)
Function File: sys = ss (a, b, c, d, tsam, …)

Create or convert to state-space model.

Inputs

sys

LTI model to be converted to state-space.

a

State matrix (n-by-n).

b

Input matrix (n-by-m).

c

Output matrix (p-by-n). If c is empty [] or not specified, an identity matrix is assumed.

d

Feedthrough matrix (p-by-m). If d is empty [] or not specified, a zero matrix is assumed.

tsam

Sampling time in seconds. If tsam is not specified, a continuous-time model is assumed.

Optional pairs of properties and values. Type set (ss) for more information.

Outputs

sys

State-space model.

Option Keys and Values

’a’, ’b’, ’c’, ’d’, ’e’

State-space matrices. See ’Inputs’ for details.

’stname’

The name of the states in sys. Cell vector containing strings for each state. Default names are {'x1', 'x2', ...}

’scaled’

Logical. If set to true, no automatic scaling is used, e.g. for frequency response plots.

’tsam’

Sampling time. See ’Inputs’ for details.

’inname’

The name of the input channels in sys. Cell vector of length m containing strings. Default names are {'u1', 'u2', ...}

’outname’

The name of the output channels in sys. Cell vector of length p containing strings. Default names are {'y1', 'y2', ...}

’ingroup’

Struct with input group names as field names and vectors of input indices as field values. Default is an empty struct.

’outgroup’

Struct with output group names as field names and vectors of output indices as field values. Default is an empty struct.

’name’

String containing the name of the model.

’notes’

String or cell of string containing comments.

’userdata’

Any data type.

Equations $$\dot{x} = A\,x + B\,u$$$$y = C\,x + D\,u$$

Example

 
 
 octave:1> a = [1 2 3; 4 5 6; 7 8 9];
 octave:2> b = [10; 11; 12];
 octave:3> stname = {'V', 'A', 'kJ'};
 octave:4> sys = ss (a, b, 'stname', stname)

 sys.a =
         V   A  kJ
    V    1   2   3
    A    4   5   6
    kJ   7   8   9

 sys.b =
        u1
    V   10
    A   11
    kJ  12

 sys.c =
         V   A  kJ
    y1   1   0   0
    y2   0   1   0
    y3   0   0   1

 sys.d =
        u1
    y1   0
    y2   0
    y3   0

 Continuous-time model.
 octave:5>
 
 

Note on compatibility

If the state-space model sys is converted from a transfer function, the resulting state-space model can be transformed into the form computed by Matlab (a controllable canonical form with flipped state variables order) by using the following similarity transformation:

 
 
 n = size (sys.a, 1)
 QSi = inv (ctrb (sys))
 T(n,:) = QSi(n,:)
 for i=n-1:-1:1, T(i,:) = T(i+1,:)*sys.a, endfor
 sys_ml = ss2ss (sys, T)
 
 

See also: tf, dss