Most of the functions described in this chapter were contributed by A. Scottedward Hodel @email{A.S.Hodel@eng.auburn.edu} and R. Bruce Tenison @email{Bruce.Tenison@eng.auburn.edu}. They have also written a larger collection of functions for solving linear control problems. It is currently being updated for Octave version 2, with snapshots of the sources available from @url{ftp://ftp.eng.auburn.edu/pub/hodel}.

__Function File:__[`n`,`m`,`p`] =**abcddim***(*`a`,`b`,`c`,`d`)-
Check for compatibility of the dimensions of the matrices defining
the linear system
[A, B, C, D] corresponding to
dx/dt = a x + b u y = c x + d u

or a similar discrete-time system.

If the matrices are compatibly dimensioned, then

`abcddim`

returns`n`- The number of system states.
`m`- The number of system inputs.
`p`- The number of system outputs.

Otherwise

`abcddim`

returns`n`=`m`=`p`= -1.

__Function File:__**are***(*`a`,`b`,`c`,`opt`)-
Return the solution,

`x`, of the algebraic Riccati equationa' * x + x * a - x * b * x + c = 0

for identically dimensioned square matrices

`a`,`b`, and`c`. If`b`is not square,`are`

attempts to use

instead. If`b`*`b`'`c`is not square,`are`

attempts to use

) instead.`c`'*`c`To form the solution, Laub's Schur method (IEEE Transactions on Automatic Control, 1979) is applied to the appropriate Hamiltonian matrix.

The optional argument

`opt`is passed to the eigenvalue balancing routine. If it is omitted, a value of`"B"`

is assumed.

__Function File:__**c2d***(*`a`,`b`,`t`)-
Convert the continuous time system described by:
dx/dt = a x + b u

into a discrete time equivalent model

x[k+1] = Ad x[k] + Bd u[k]

via the matrix exponential assuming a zero-order hold on the input and sample time

`t`.

__Function File:__**dare***(*`a`,`b`,`c`,`r`,`opt`)-
Return the solution,

`x`of the discrete-time algebraic Riccati equationa' x a - x + a' x b (r + b' x b)^(-1) b' x a + c = 0

for matrices with dimensions:

`a`-
`n`by`n`. `b`-
`n`by`m`. `c`-
`n`by`n`, symmetric positive semidefinite. `r`-
`m`by`m`, symmetric positive definite (invertible).

If

`c`is not square, then the function attempts to use

instead.`c`'*`c`To form the solution, Laub's Schur method (IEEE Transactions on Automatic Control, 1979) is applied to the appropriate symplectic matrix.

See also Ran and Rodman, Stable Hermitian Solutions of Discrete Algebraic Riccati Equations, Mathematics of Control, Signals and Systems, Volume 5, Number 2 (1992).

The optional argument

`opt`is passed to the eigenvalue balancing routine. If it is omitted, a value of`"B"`

is assumed.

__Function File:__**dgram***(*`a`,`b`)-
Return the discrete controllability or observability gramian for the
discrete time system described by
x[k+1] = A x[k] + B u[k] y[k] = C x[k] + D u[k]

For example,

`dgram (`

returns the discrete controllability gramian and`a`,`b`)`dgram (`

returns the observability gramian.`a`',`c`')

__Function File:__[`l`,`m`,`p`,`e`] =**dlqe***(*`a`,`g`,`c`,`sigw`,`sigv`,`z`)-
Construct the linear quadratic estimator (Kalman filter) for the
discrete time system
x[k+1] = A x[k] + B u[k] + G w[k] y[k] = C x[k] + D u[k] + w[k]

where

`w`,`v`are zero-mean gaussian noise processes with respective intensities

and`sigw`= cov (`w`,`w`)

.`sigv`= cov (`v`,`v`)If specified,

`z`is`cov (`

. Otherwise`w`,`v`)`cov (`

.`w`,`v`) = 0The observer structure is

z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k])

The following values are returned:

`l`-
The observer gain,
(
`a`-`a``l``c`). is stable. `m`- The Riccati equation solution.
`p`- The estimate error covariance after the measurement update.
`e`-
The closed loop poles of
(
`a`-`a``l``c`).

__Function File:__[`k`,`p`,`e`] =**dlqr***(*`a`,`b`,`q`,`r`,`z`)-
Construct the linear quadratic regulator for the discrete time system
x[k+1] = A x[k] + B u[k]

to minimize the cost functional

J = Sum (x' Q x + u' R u)

`z`omitted orJ = Sum (x' Q x + u' R u + 2 x' Z u)

`z`included.The following values are returned:

`k`-
The state feedback gain,
(
`a`-`b``k`) is stable. `p`- The solution of algebraic Riccati equation.
`e`-
The closed loop poles of
(
`a`-`b``k`).

__Function File:__**dlyap***(*`a`,`b`)-
Solve the discrete-time Lyapunov equation
`a x a' - x + b = 0`

for square matrices`a`,`b`. If`b`is not square, then the function attempts to solve either An Algorithm for Solving the Matrix Equation`X`=`F``X``F`' +`S`, International Journal of Control, Volume 25, Number 5, pages 745--753 (1977); column-by-column solution method as suggested in Hammerling, Numerical Solution of the Stable, Non-Negative Definite Lyapunov Equation, IMA Journal of Numerical Analysis, Volume 2, pages 303--323 (1982).

__Function File:__**is_controllable***(*`a`,`b`,`tol`)-
Return 1 if the pair (
`a`,`b`) is controllable. Otherwise, return 0.The optional argument

`tol`is a roundoff parameter. If it is omitted, a value of`2*eps`

is used.Currently,

`is_controllable`

just constructs the controllability matrix and checks rank.

__Function File:__**is_observable***(*`a`,`c`,`tol`)-
Return 1 if the pair (

`a`,`c`) is observable. Otherwise, return 0.The optional argument

`tol`is a roundoff parameter. If it is omitted, a value of`2*eps`

is used.

__Function File:__[`k`,`p`,`e`] =**lqe***(*`a`,`g`,`c`,`sigw`,`sigv`,`z`)-
Construct the linear quadratic estimator (Kalman filter) for the
continuous time system
dx -- = a x + b u dt y = c x + d u

where

`w`and`v`are zero-mean gaussian noise processes with respective intensitiessigw = cov (w, w) sigv = cov (v, v)

The optional argument

`z`is the cross-covariance`cov (`

. If it is omitted,`w`,`v`)`cov (`

is assumed.`w`,`v`) = 0Observer structure is

`dz/dt = A z + B u + k (y - C z - D u)`

The following values are returned:

`k`-
The observer gain,
(
`a`-`k``c`) is stable. `p`- The solution of algebraic Riccati equation.
`e`-
The vector of closed loop poles of
(
`a`-`k``c`).

__Function File:__[`k`,`p`,`e`] =**lqr***(*`a`,`b`,`q`,`r`,`z`)-
construct the linear quadratic regulator for the continuous time system
dx -- = A x + B u dt

to minimize the cost functional

infinity / J = | x' Q x + u' R u / t=0

`z`omitted orinfinity / J = | x' Q x + u' R u + 2 x' Z u / t=0

`z`included.The following values are returned:

`k`-
The state feedback gain,
(
`a`-`b``k`) is stable. `p`- The stabilizing solution of appropriate algebraic Riccati equation.
`e`-
The vector of the closed loop poles of
(
`a`-`b``k`).

__Function File:__**lyap***(*`a`,`b`,`c`)-
Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart
algorithm (Communications of the ACM, 1972).
If

`a`,`b`, and`c`are specified, then`lyap`

returns the solution of the Sylvester equationa x + x b + c = 0

If only

`(a, b)`

are specified, then`lyap`

returns the solution of the Lyapunov equationa' x + x a + b = 0

If

`b`is not square, then`lyap`

returns the solution of eithera' x + x a + b' b = 0

or

a x + x a' + b b' = 0

whichever is appropriate.

__Function File:__**tzero***(*`a`,`b`,`c`,`d`,`opt`)-
Compute the transmission zeros of
[A, B, C, D].
The optional argument

`opt`is passed to the eigenvalue balancing routine. If it is omitted, a value of`"B"`

is assumed.

Go to the first, previous, next, last section, table of contents.