ss
Create or convert to state-space model.
Inputs
LTI model to be converted to state-space.
State matrix (n-by-n).
Input matrix (n-by-m).
Output matrix (p-by-n).
If c is empty []
or not specified, an identity matrix is assumed.
Feedthrough matrix (p-by-m).
If d is empty []
or not specified, a zero matrix is assumed.
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
State-space model.
Option Keys and Values
State-space matrices. See ’Inputs’ for details.
The name of the states in sys.
Cell vector containing strings for each state.
Default names are {'x1', 'x2', ...}
Logical. If set to true, no automatic scaling is used, e.g. for frequency response plots.
Sampling time. See ’Inputs’ for details.
The name of the input channels in sys.
Cell vector of length m containing strings.
Default names are {'u1', 'u2', ...}
The name of the output channels in sys.
Cell vector of length p containing strings.
Default names are {'y1', 'y2', ...}
Struct with input group names as field names and vectors of input indices as field values. Default is an empty struct.
Struct with output group names as field names and vectors of output indices as field values. Default is an empty struct.
String containing the name of the model.
String or cell of string containing comments.
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) |
Source Code: ss
ss
Create or convert to state-space model.
Inputs
LTI model to be converted to state-space.
State matrix (n-by-n).
Input matrix (n-by-m).
Output matrix (p-by-n).
If c is empty []
or not specified, an identity matrix is assumed.
Feedthrough matrix (p-by-m).
If d is empty []
or not specified, a zero matrix is assumed.
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
State-space model.
Option Keys and Values
State-space matrices. See ’Inputs’ for details.
The name of the states in sys.
Cell vector containing strings for each state.
Default names are {'x1', 'x2', ...}
Logical. If set to true, no automatic scaling is used, e.g. for frequency response plots.
Sampling time. See ’Inputs’ for details.
The name of the input channels in sys.
Cell vector of length m containing strings.
Default names are {'u1', 'u2', ...}
The name of the output channels in sys.
Cell vector of length p containing strings.
Default names are {'y1', 'y2', ...}
Struct with input group names as field names and vectors of input indices as field values. Default is an empty struct.
Struct with output group names as field names and vectors of output indices as field values. Default is an empty struct.
String containing the name of the model.
String or cell of string containing comments.
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) |