1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579
|
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
from ./octave.texi on 18 June 1999 -->
<TITLE>GNU Octave - Control Theory</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_25.html">previous</A>, <A HREF="octave_27.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
<P><HR><P>
<H1><A NAME="SEC161" HREF="octave_toc.html#TOC161">Control Theory</A></H1>
<P>
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}.
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>n</VAR>, <VAR>m</VAR>, <VAR>p</VAR>] = <B>abcddim</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>c</VAR>, <VAR>d</VAR>)</I>
<DD><A NAME="IDX789"></A>
Check for compatibility of the dimensions of the matrices defining
the linear system
[A, B, C, D] corresponding to
</P>
<PRE>
dx/dt = a x + b u
y = c x + d u
</PRE>
<P>
or a similar discrete-time system.
</P>
<P>
If the matrices are compatibly dimensioned, then <CODE>abcddim</CODE> returns
</P>
<DL COMPACT>
<DT><VAR>n</VAR>
<DD>
The number of system states.
<DT><VAR>m</VAR>
<DD>
The number of system inputs.
<DT><VAR>p</VAR>
<DD>
The number of system outputs.
</DL>
<P>
Otherwise <CODE>abcddim</CODE> returns <VAR>n</VAR> = <VAR>m</VAR> = <VAR>p</VAR> = -1.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>are</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>c</VAR>, <VAR>opt</VAR>)</I>
<DD><A NAME="IDX790"></A>
</P>
<P>
Return the solution, <VAR>x</VAR>, of the algebraic Riccati equation
</P>
<PRE>
a' * x + x * a - x * b * x + c = 0
</PRE>
<P>
for identically dimensioned square matrices <VAR>a</VAR>, <VAR>b</VAR>, and
<VAR>c</VAR>. If <VAR>b</VAR> is not square, <CODE>are</CODE> attempts to use
<CODE><VAR>b</VAR>*<VAR>b</VAR>'</CODE> instead. If <VAR>c</VAR> is not square, <CODE>are</CODE>
attempts to use <CODE><VAR>c</VAR>'*<VAR>c</VAR></CODE>) instead.
</P>
<P>
To form the solution, Laub's Schur method (IEEE Transactions on
Automatic Control, 1979) is applied to the appropriate Hamiltonian
matrix.
</P>
<P>
The optional argument <VAR>opt</VAR> is passed to the eigenvalue balancing
routine. If it is omitted, a value of <CODE>"B"</CODE> is assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>c2d</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>t</VAR>)</I>
<DD><A NAME="IDX791"></A>
Convert the continuous time system described by:
</P>
<PRE>
dx/dt = a x + b u
</PRE>
<P>
into a discrete time equivalent model
</P>
<PRE>
x[k+1] = Ad x[k] + Bd u[k]
</PRE>
<P>
via the matrix exponential assuming a zero-order hold on the input and
sample time <VAR>t</VAR>.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>dare</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>c</VAR>, <VAR>r</VAR>, <VAR>opt</VAR>)</I>
<DD><A NAME="IDX792"></A>
</P>
<P>
Return the solution, <VAR>x</VAR> of the discrete-time algebraic Riccati
equation
</P>
<PRE>
a' x a - x + a' x b (r + b' x b)^(-1) b' x a + c = 0
</PRE>
<P>
for matrices with dimensions:
</P>
<DL COMPACT>
<DT><VAR>a</VAR>
<DD>
<VAR>n</VAR> by <VAR>n</VAR>.
<DT><VAR>b</VAR>
<DD>
<VAR>n</VAR> by <VAR>m</VAR>.
<DT><VAR>c</VAR>
<DD>
<VAR>n</VAR> by <VAR>n</VAR>, symmetric positive semidefinite.
<DT><VAR>r</VAR>
<DD>
<VAR>m</VAR> by <VAR>m</VAR>, symmetric positive definite (invertible).
</DL>
<P>
If <VAR>c</VAR> is not square, then the function attempts to use
<CODE><VAR>c</VAR>'*<VAR>c</VAR></CODE> instead.
</P>
<P>
To form the solution, Laub's Schur method (IEEE Transactions on
Automatic Control, 1979) is applied to the appropriate symplectic
matrix.
</P>
<P>
See also Ran and Rodman, <CITE>Stable Hermitian Solutions of Discrete
Algebraic Riccati Equations</CITE>, Mathematics of Control, Signals and
Systems, Volume 5, Number 2 (1992).
</P>
<P>
The optional argument <VAR>opt</VAR> is passed to the eigenvalue balancing
routine. If it is omitted, a value of <CODE>"B"</CODE> is assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>dgram</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>)</I>
<DD><A NAME="IDX793"></A>
Return the discrete controllability or observability gramian for the
discrete time system described by
</P>
<PRE>
x[k+1] = A x[k] + B u[k]
y[k] = C x[k] + D u[k]
</PRE>
<P>
For example, <CODE>dgram (<VAR>a</VAR>, <VAR>b</VAR>)</CODE> returns the discrete
controllability gramian and <CODE>dgram (<VAR>a</VAR>', <VAR>c</VAR>')</CODE> returns
the observability gramian.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>l</VAR>, <VAR>m</VAR>, <VAR>p</VAR>, <VAR>e</VAR>] = <B>dlqe</B> <I>(<VAR>a</VAR>, <VAR>g</VAR>, <VAR>c</VAR>, <VAR>sigw</VAR>, <VAR>sigv</VAR>, <VAR>z</VAR>)</I>
<DD><A NAME="IDX794"></A>
Construct the linear quadratic estimator (Kalman filter) for the
discrete time system
</P>
<PRE>
x[k+1] = A x[k] + B u[k] + G w[k]
y[k] = C x[k] + D u[k] + w[k]
</PRE>
<P>
where <VAR>w</VAR>, <VAR>v</VAR> are zero-mean gaussian noise processes with
respective intensities <CODE><VAR>sigw</VAR> = cov (<VAR>w</VAR>, <VAR>w</VAR>)</CODE> and
<CODE><VAR>sigv</VAR> = cov (<VAR>v</VAR>, <VAR>v</VAR>)</CODE>.
</P>
<P>
If specified, <VAR>z</VAR> is <CODE>cov (<VAR>w</VAR>, <VAR>v</VAR>)</CODE>. Otherwise
<CODE>cov (<VAR>w</VAR>, <VAR>v</VAR>) = 0</CODE>.
</P>
<P>
The observer structure is
</P>
<PRE>
z[k+1] = A z[k] + B u[k] + k(y[k] - C z[k] - D u[k])
</PRE>
<P>
The following values are returned:
</P>
<DL COMPACT>
<DT><VAR>l</VAR>
<DD>
The observer gain,
(<VAR>a</VAR> - <VAR>a</VAR><VAR>l</VAR><VAR>c</VAR>).
is stable.
<DT><VAR>m</VAR>
<DD>
The Riccati equation solution.
<DT><VAR>p</VAR>
<DD>
The estimate error covariance after the measurement update.
<DT><VAR>e</VAR>
<DD>
The closed loop poles of
(<VAR>a</VAR> - <VAR>a</VAR><VAR>l</VAR><VAR>c</VAR>).
</DL>
</DL>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>k</VAR>, <VAR>p</VAR>, <VAR>e</VAR>] = <B>dlqr</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>q</VAR>, <VAR>r</VAR>, <VAR>z</VAR>)</I>
<DD><A NAME="IDX795"></A>
Construct the linear quadratic regulator for the discrete time system
</P>
<PRE>
x[k+1] = A x[k] + B u[k]
</PRE>
<P>
to minimize the cost functional
</P>
<PRE>
J = Sum (x' Q x + u' R u)
</PRE>
<P>
<VAR>z</VAR> omitted or
</P>
<PRE>
J = Sum (x' Q x + u' R u + 2 x' Z u)
</PRE>
<P>
<VAR>z</VAR> included.
</P>
<P>
The following values are returned:
</P>
<DL COMPACT>
<DT><VAR>k</VAR>
<DD>
The state feedback gain,
(<VAR>a</VAR> - <VAR>b</VAR><VAR>k</VAR>)
is stable.
<DT><VAR>p</VAR>
<DD>
The solution of algebraic Riccati equation.
<DT><VAR>e</VAR>
<DD>
The closed loop poles of
(<VAR>a</VAR> - <VAR>b</VAR><VAR>k</VAR>).
</DL>
</DL>
<P>
<DL>
<DT><U>Function File:</U> <B>dlyap</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>)</I>
<DD><A NAME="IDX796"></A>
Solve the discrete-time Lyapunov equation
<CODE>a x a' - x + b = 0</CODE>
for square matrices <VAR>a</VAR>, <VAR>b</VAR>. If <VAR>b</VAR> is not square, then the
function attempts to solve either
<CITE>An Algorithm for Solving the Matrix Equation <VAR>X</VAR> =
<VAR>F</VAR><VAR>X</VAR><VAR>F</VAR>' + <VAR>S</VAR></CITE>,
International Journal of Control, Volume 25, Number 5, pages 745--753
(1977); column-by-column solution method as suggested in
Hammerling, <CITE>Numerical Solution of the Stable, Non-Negative
Definite Lyapunov Equation</CITE>, IMA Journal of Numerical Analysis, Volume
2, pages 303--323 (1982).
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>is_controllable</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>tol</VAR>)</I>
<DD><A NAME="IDX797"></A>
Return 1 if the pair (<VAR>a</VAR>, <VAR>b</VAR>) is controllable. Otherwise,
return 0.
</P>
<P>
The optional argument <VAR>tol</VAR> is a roundoff parameter. If it is
omitted, a value of <CODE>2*eps</CODE> is used.
</P>
<P>
Currently, <CODE>is_controllable</CODE> just constructs the controllability
matrix and checks rank.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>is_observable</B> <I>(<VAR>a</VAR>, <VAR>c</VAR>, <VAR>tol</VAR>)</I>
<DD><A NAME="IDX798"></A>
</P>
<P>
Return 1 if the pair (<VAR>a</VAR>, <VAR>c</VAR>) is observable.
Otherwise, return 0.
</P>
<P>
The optional argument <VAR>tol</VAR> is a roundoff parameter. If it is
omitted, a value of <CODE>2*eps</CODE> is used.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>k</VAR>, <VAR>p</VAR>, <VAR>e</VAR>] = <B>lqe</B> <I>(<VAR>a</VAR>, <VAR>g</VAR>, <VAR>c</VAR>, <VAR>sigw</VAR>, <VAR>sigv</VAR>, <VAR>z</VAR>)</I>
<DD><A NAME="IDX799"></A>
Construct the linear quadratic estimator (Kalman filter) for the
continuous time system
</P>
<PRE>
dx
-- = a x + b u
dt
y = c x + d u
</PRE>
<P>
where <VAR>w</VAR> and <VAR>v</VAR> are zero-mean gaussian noise processes with
respective intensities
</P>
<PRE>
sigw = cov (w, w)
sigv = cov (v, v)
</PRE>
<P>
The optional argument <VAR>z</VAR> is the cross-covariance
<CODE>cov (<VAR>w</VAR>, <VAR>v</VAR>)</CODE>. If it is omitted,
<CODE>cov (<VAR>w</VAR>, <VAR>v</VAR>) = 0</CODE> is assumed.
</P>
<P>
Observer structure is <CODE>dz/dt = A z + B u + k (y - C z - D u)</CODE>
</P>
<P>
The following values are returned:
</P>
<DL COMPACT>
<DT><VAR>k</VAR>
<DD>
The observer gain,
(<VAR>a</VAR> - <VAR>k</VAR><VAR>c</VAR>)
is stable.
<DT><VAR>p</VAR>
<DD>
The solution of algebraic Riccati equation.
<DT><VAR>e</VAR>
<DD>
The vector of closed loop poles of
(<VAR>a</VAR> - <VAR>k</VAR><VAR>c</VAR>).
</DL>
</DL>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>k</VAR>, <VAR>p</VAR>, <VAR>e</VAR>] = <B>lqr</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>q</VAR>, <VAR>r</VAR>, <VAR>z</VAR>)</I>
<DD><A NAME="IDX800"></A>
construct the linear quadratic regulator for the continuous time system
</P>
<PRE>
dx
-- = A x + B u
dt
</PRE>
<P>
to minimize the cost functional
</P>
<PRE>
infinity
/
J = | x' Q x + u' R u
/
t=0
</PRE>
<P>
<VAR>z</VAR> omitted or
</P>
<PRE>
infinity
/
J = | x' Q x + u' R u + 2 x' Z u
/
t=0
</PRE>
<P>
<VAR>z</VAR> included.
</P>
<P>
The following values are returned:
</P>
<DL COMPACT>
<DT><VAR>k</VAR>
<DD>
The state feedback gain,
(<VAR>a</VAR> - <VAR>b</VAR><VAR>k</VAR>)
is stable.
<DT><VAR>p</VAR>
<DD>
The stabilizing solution of appropriate algebraic Riccati equation.
<DT><VAR>e</VAR>
<DD>
The vector of the closed loop poles of
(<VAR>a</VAR> - <VAR>b</VAR><VAR>k</VAR>).
</DL>
</DL>
<P>
<DL>
<DT><U>Function File:</U> <B>lyap</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>c</VAR>)</I>
<DD><A NAME="IDX801"></A>
Solve the Lyapunov (or Sylvester) equation via the Bartels-Stewart
algorithm (Communications of the ACM, 1972).
</P>
<P>
If <VAR>a</VAR>, <VAR>b</VAR>, and <VAR>c</VAR> are specified, then <CODE>lyap</CODE> returns
the solution of the Sylvester equation
</P>
<PRE>
a x + x b + c = 0
</PRE>
<P>
If only <CODE>(a, b)</CODE> are specified, then <CODE>lyap</CODE> returns the
solution of the Lyapunov equation
</P>
<PRE>
a' x + x a + b = 0
</PRE>
<P>
If <VAR>b</VAR> is not square, then <CODE>lyap</CODE> returns the solution of either
</P>
<PRE>
a' x + x a + b' b = 0
</PRE>
<P>
or
</P>
<PRE>
a x + x a' + b b' = 0
</PRE>
<P>
whichever is appropriate.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>tzero</B> <I>(<VAR>a</VAR>, <VAR>b</VAR>, <VAR>c</VAR>, <VAR>d</VAR>, <VAR>opt</VAR>)</I>
<DD><A NAME="IDX802"></A>
Compute the transmission zeros of
[A, B, C, D].
</P>
<P>
The optional argument <VAR>opt</VAR> is passed to the eigenvalue balancing
routine. If it is omitted, a value of <CODE>"B"</CODE> is assumed.
</DL>
</P>
<P><HR><P>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_25.html">previous</A>, <A HREF="octave_27.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
</BODY>
</HTML>
|