create a state-space system object - Maple Help

Home : Support : Online Help : Science and Engineering : Dynamic Systems : System Object : DynamicSystems/StateSpace

DynamicSystems[StateSpace] - create a state-space system object

 Calling Sequence StateSpace(opts) StateSpace(sys, opts) StateSpace(tf, opts) StateSpace(z, p, k, opts) StateSpace(num, den, opts) StateSpace(a, b, c, d, opts) StateSpace(de, invars, outvars, opts)

Parameters

 sys - System; system object tf - algebraic or Matrix(algebraic); transfer function z - list(algebraic) or Matrix(list(algebraic)); zeros p - list(algebraic) or Matrix(list(algebraic)); poles k - algebraic or Matrix(algebraic); gain(s) num - list(algebraic) or Matrix (list(algebraic)); numerator coefficients den - list(algebraic) or Matrix (list(algebraic)); denominator coefficients a - Matrix; state-space matrix A b - Matrix; state-space matrix B c - Matrix; state-space matrix C d - Matrix; state-space matrix D de - equation or list(equation); diff-equations invars - name, anyfunc(name) or list of same; input variables outvars - name, anyfunc(name) or list of same; output variables opts - (optional) equation(s) of the form option = value; specify options for the StateSpace command

Description

 • The StateSpace command creates a state-space (SS) system object. The time-domain behavior of the object is modeled by four state-space Matrices, A, B, C, and D, that describe the input, output, and state equations.
 • The input can be specified as one of several representations: transfer function (TF), zero-pole-gain (ZPK), coefficients (Coeff), state-space (SS), or diff-equations (DE).
 • If no input is provided, a unity-gain SS system is created.
 • The optional parameter sys is a system object; it is converted to the SS representation. All options are ignored.
 • The optional parameter tf is the transfer function of a TF system. For a single-input/single-output system, tf is a rational function (ratpoly). For a multi-input/multi-output system, tf is a Matrix of rational functions. The indeterminate of the polynomials depends on whether the system is continuous or discrete; a continuous system typically uses s while a discrete system typically uses z as the indeterminate. The actual names are assigned by DynamicSystems[SystemOptions].
 • The optional parameters z, p, and k are the zeros, poles, and gain, respectively, of a ZPK system. For a single-input/single-output system, z and p are lists and k is an algebraic expression. For a multi-input/multi-output system, z and p are Matrices of lists and k is a Matrix of algebraic expressions.
 • The optional parameters num and den are the coefficients of the numerator and denominator, respectively, of a Coeff system. For a single-input/single-output system, num and den are lists, the first element being the coefficient of the highest order term. For a multi-input/multi-output system, num and den are Matrices of lists.
 • The optional parameters a, b, c, and d are the four state-space matrices, A, B, C, and D, respectively, of an SS system.
 • The optional parameter de is the difference/differential equation(s) of a DE system. A list is used to specify more than one equation.
 • The parameters invars and outvars specify the input and output variables of difference/differential equations. They are not required, but if either is not specified then the corresponding keyword parameter inputvariable or outputvariable must be assigned. If both positional and keyword parameters are specified, the keyword parameter take precedence.

Examples

 > $\mathrm{with}\left(\mathrm{DynamicSystems}\right):$
 > $\mathrm{sys1}:=\mathrm{StateSpace}\left(\right)$
 ${\mathrm{sys1}}{:=}\left[\begin{array}{c}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 1 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right)\right]\end{array}\right$ (1)
 > $\mathrm{PrintSystem}\left(\mathrm{sys1}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 1 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{c}{0}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{c}{0}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{1}\end{array}\right]\end{array}\right$ (2)
 > $\mathrm{sys2}:=\mathrm{StateSpace}\left(\frac{s}{{s}^{3}+5{s}^{2}+7s+6}\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys2}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 3 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{ccc}{0}& {1}& {0}\\ {0}& {0}& {1}\\ {-6}& {-7}& {-5}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{0}\\ {0}\\ {1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{ccc}{0}& {1}& {0}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{0}\end{array}\right]\end{array}\right$ (3)
 > $\mathrm{sys3}:=\mathrm{StateSpace}\left(\left[1,2\right],\left[1,2,3\right]\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys3}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{0}& {1}\\ {-3}& {-2}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{0}\\ {1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{2}& {1}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{0}\end{array}\right]\end{array}\right$ (4)
 > $\mathrm{sys4}:=\mathrm{StateSpace}\left(\left[\right],\left[-5+1I,-5-1I\right],1\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys4}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{0}& {1}\\ {-26}& {-10}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{0}\\ {1}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{1}& {0}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{0}\end{array}\right]\end{array}\right$ (5)
 > $\mathrm{ss_a}:=\mathrm{Matrix}\left(\left[\left[1,2\right],\left[0,4\right]\right]\right)$
 ${\mathrm{ss_a}}{:=}\left[\begin{array}{rr}{1}& {2}\\ {0}& {4}\end{array}\right]$ (6)
 > $\mathrm{ss_b}:=\mathrm{Matrix}\left(\left[\left[3,7\right],\left[9,6\right]\right]\right)$
 ${\mathrm{ss_b}}{:=}\left[\begin{array}{rr}{3}& {7}\\ {9}& {6}\end{array}\right]$ (7)
 > $\mathrm{ss_c}:=\mathrm{Matrix}\left(\left[\left[5,6\right],\left[5,2\right]\right]\right)$
 ${\mathrm{ss_c}}{:=}\left[\begin{array}{rr}{5}& {6}\\ {5}& {2}\end{array}\right]$ (8)
 > $\mathrm{ss_d}:=\mathrm{Matrix}\left(\left[\left[0,0\right],\left[0,0\right]\right]\right)$
 ${\mathrm{ss_d}}{:=}\left[\begin{array}{rr}{0}& {0}\\ {0}& {0}\end{array}\right]$ (9)
 > $\mathrm{sys5}:=\mathrm{StateSpace}\left(\mathrm{ss_a},\mathrm{ss_b},\mathrm{ss_c},\mathrm{ss_d},\mathrm{discrete},\mathrm{sampletime}=0.001,\mathrm{systemname}="Example discrete MIMO system"\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys5}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{discrete; sampletime = .1e-2}}\\ {\mathrm{systemname}}{=}{\mathrm{Example discrete MIMO system}}\\ {\mathrm{2 output\left(s\right); 2 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({q}\right){,}{\mathrm{u2}}{}\left({q}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({q}\right){,}{\mathrm{y2}}{}\left({q}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({q}\right){,}{\mathrm{x2}}{}\left({q}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{1}& {2}\\ {0}& {4}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{cc}{3}& {7}\\ {9}& {6}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{5}& {6}\\ {5}& {2}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{cc}{0}& {0}\\ {0}& {0}\end{array}\right]\end{array}\right$ (10)

Create a system with symbolic matrices.

 > $\mathrm{sys6}:=\mathrm{StateSpace}\left('\mathrm{usesymbols}','\mathrm{numinputs}'=2,'\mathrm{numoutputs}'=3,'\mathrm{numstates}'=4\right)$
 ${\mathrm{sys6}}{:=}\left[\begin{array}{c}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{3 output\left(s\right); 2 input\left(s\right); 4 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right){,}{\mathrm{y3}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right)\right]\end{array}\right$ (11)
 > $\mathrm{PrintSystem}\left(\mathrm{sys6}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{3 output\left(s\right); 2 input\left(s\right); 4 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right){,}{\mathrm{y3}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cccc}{{a}}_{{1}{,}{1}}& {{a}}_{{1}{,}{2}}& {{a}}_{{1}{,}{3}}& {{a}}_{{1}{,}{4}}\\ {{a}}_{{2}{,}{1}}& {{a}}_{{2}{,}{2}}& {{a}}_{{2}{,}{3}}& {{a}}_{{2}{,}{4}}\\ {{a}}_{{3}{,}{1}}& {{a}}_{{3}{,}{2}}& {{a}}_{{3}{,}{3}}& {{a}}_{{3}{,}{4}}\\ {{a}}_{{4}{,}{1}}& {{a}}_{{4}{,}{2}}& {{a}}_{{4}{,}{3}}& {{a}}_{{4}{,}{4}}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{cc}{{b}}_{{1}{,}{1}}& {{b}}_{{1}{,}{2}}\\ {{b}}_{{2}{,}{1}}& {{b}}_{{2}{,}{2}}\\ {{b}}_{{3}{,}{1}}& {{b}}_{{3}{,}{2}}\\ {{b}}_{{4}{,}{1}}& {{b}}_{{4}{,}{2}}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cccc}{{c}}_{{1}{,}{1}}& {{c}}_{{1}{,}{2}}& {{c}}_{{1}{,}{3}}& {{c}}_{{1}{,}{4}}\\ {{c}}_{{2}{,}{1}}& {{c}}_{{2}{,}{2}}& {{c}}_{{2}{,}{3}}& {{c}}_{{2}{,}{4}}\\ {{c}}_{{3}{,}{1}}& {{c}}_{{3}{,}{2}}& {{c}}_{{3}{,}{3}}& {{c}}_{{3}{,}{4}}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{cc}{{d}}_{{1}{,}{1}}& {{d}}_{{1}{,}{2}}\\ {{d}}_{{2}{,}{1}}& {{d}}_{{2}{,}{2}}\\ {{d}}_{{3}{,}{1}}& {{d}}_{{3}{,}{2}}\end{array}\right]\end{array}\right$ (12)

Create a random test state-space system

 > $\mathrm{sys7}:=\mathrm{StateSpace}\left('\mathrm{randomtest}','\mathrm{numstates}'=6,'\mathrm{numinputs}'=3,'\mathrm{numoutputs}'=2,'\mathrm{genbound}'=5\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys7}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{2 output\left(s\right); 3 input\left(s\right); 6 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right){,}{\mathrm{u2}}{}\left({t}\right){,}{\mathrm{u3}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right){,}{\mathrm{y2}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right){,}{\mathrm{x3}}{}\left({t}\right){,}{\mathrm{x4}}{}\left({t}\right){,}{\mathrm{x5}}{}\left({t}\right){,}{\mathrm{x6}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cccccc}{-12}& {1}& {1}& {-4}& {-4}& {0}\\ {5}& {-7}& {0}& {-5}& {-3}& {-1}\\ {-4}& {0}& {-14}& {-2}& {-1}& {2}\\ {-3}& {-4}& {1}& {-8}& {-2}& {3}\\ {-5}& {-2}& {0}& {3}& {-11}& {-2}\\ {1}& {-1}& {-5}& {-2}& {4}& {-13}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{ccc}{3}& {-5}& {5}\\ {1}& {1}& {-1}\\ {-2}& {5}& {-3}\\ {2}& {-3}& {2}\\ {-5}& {3}& {-3}\\ {-2}& {-2}& {5}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cccccc}{1}& {-1}& {5}& {-2}& {-4}& {3}\\ {-5}& {4}& {-3}& {-1}& {-3}& {-5}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{ccc}{-3}& {4}& {0}\\ {5}& {-4}& {2}\end{array}\right]\end{array}\right$ (13)
 > $\mathrm{eigs}:=\mathrm{evalf}\left(\mathrm{LinearAlgebra}:-\mathrm{Eigenvalues}\left(\mathrm{sys7}:-a\right)\right)$
 ${\mathrm{eigs}}{:=}\left[\begin{array}{c}{-}{13.16245939}{+}{5.027249293}{}{I}\\ {-}{11.28053239}{+}{2.099451111}{}{I}\\ {-}{0.07172170047}\\ {-}{16.04229473}\\ {-}{11.28053239}{-}{2.099451111}{}{I}\\ {-}{13.16245939}{-}{5.027249293}{}{I}\end{array}\right]$ (14)
 > $\mathrm{sys8}:=\mathrm{StateSpace}\left('\mathrm{randomtest}','\mathrm{numstates}'=2,'\mathrm{numinputs}'=1,'\mathrm{numoutputs}'=1,'\mathrm{genbound}'=5.0\right):$
 > $\mathrm{PrintSystem}\left(\mathrm{sys8}\right)$
 $\left[\begin{array}{l}{\mathbf{State Space}}\\ {\mathrm{continuous}}\\ {\mathrm{1 output\left(s\right); 1 input\left(s\right); 2 state\left(s\right)}}\\ {\mathrm{inputvariable}}{=}\left[{\mathrm{u1}}{}\left({t}\right)\right]\\ {\mathrm{outputvariable}}{=}\left[{\mathrm{y1}}{}\left({t}\right)\right]\\ {\mathrm{statevariable}}{=}\left[{\mathrm{x1}}{}\left({t}\right){,}{\mathrm{x2}}{}\left({t}\right)\right]\\ {\mathrm{a}}{=}\left[\begin{array}{cc}{-}{6.184415429069916}& {-}{4.655539194970912}\\ {-}{0.6125564034360176}& {-}{0.49777951161645007}\end{array}\right]\\ {\mathrm{b}}{=}\left[\begin{array}{c}{2.95199901137063137}\\ {2.65516788149002370}\end{array}\right]\\ {\mathrm{c}}{=}\left[\begin{array}{cc}{-0.102356042117689228}& {-3.13127395445621381}\end{array}\right]\\ {\mathrm{d}}{=}\left[\begin{array}{c}{-0.544137992891005062}\end{array}\right]\end{array}\right$ (15)
 > $\mathrm{eigs}:=\mathrm{LinearAlgebra}:-\mathrm{Eigenvalues}\left(\mathrm{sys8}:-a\right)$
 ${\mathrm{eigs}}{:=}\left[\begin{array}{c}{-}{6.64809571040089}{+}{0.}{}{I}\\ {-}{0.0340992302854792}{+}{0.}{}{I}\end{array}\right]$ (16)