245
|
1 # Copyright (C) 1993 John W. Eaton |
|
2 # |
|
3 # This file is part of Octave. |
|
4 # |
|
5 # Octave is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License as published by the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # for more details. |
|
14 # |
|
15 # You should have received a copy of the GNU General Public License |
|
16 # along with Octave; see the file COPYING. If not, write to the Free |
|
17 # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
76
|
19 function [k, p, e] = lqe (a, g, c, sigw, sigv, zz) |
|
20 |
|
21 # Usage: [k, p, e] = lqe (A, G, C, SigW, SigV {,Z}) |
|
22 # |
|
23 # Linear quadratic estimator (Kalman filter) design for the |
|
24 # continuous time system |
|
25 # |
|
26 # dx/dt = A x + B u + G w |
|
27 # y = C x + D u + w |
|
28 # |
|
29 # where w, v are zero-mean gaussian noise processes with respective |
|
30 # intensities SigW = cov (w, w) and SigV = cov (v, v). |
|
31 # |
|
32 # Z (if specified) is cov(w,v); otherwise cov(w,v) = 0. |
|
33 # |
|
34 # Observer structure is dz/dt = A z + B u + k( y - C z - D u). |
|
35 # |
|
36 # Returns: |
|
37 # |
|
38 # k = observer gain, (A - K C) is stable |
|
39 # p = solution of algebraic Riccati equation |
|
40 # e = closed loop poles of (A - K C) |
|
41 |
|
42 # Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. |
|
43 |
|
44 if (nargin != 5 && nargin != 6) |
|
45 error ("lqe: illegal number of arguments"); |
|
46 endif |
|
47 |
|
48 # The problem is dual to the regulator design, so transform to lqr |
|
49 # call. |
|
50 |
|
51 if (nargin == 5) |
|
52 [k, p, e] = lqr (a', c', g*sigw*g', sigv); |
|
53 else |
|
54 [k, p, e] = lqr (a', c', g*sigw*g', sigv, g*zz); |
|
55 endif |
|
56 |
|
57 endfunction |