3441
|
1 ## Copyright (C) 1993, 1994, 1995 Auburn University. All rights reserved. |
|
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, 59 Temple Place, Suite 330, Boston, MA 02111 USA. |
|
18 |
|
19 ## -*- texinfo -*- |
3502
|
20 ## @deftypefn {Function File} {[@var{retval}, @var{u}] =} is_stabilizable (@var{sys}, @var{tol}) |
|
21 ## @deftypefnx {Function File} {[@var{retval}, @var{u}] =} is_stabilizable (@var{a}, @var{b}, @var{tol}) |
3441
|
22 ## Logical check for system stabilizability (i.e., all unstable modes are controllable). |
|
23 ## |
|
24 ## Test for stabilizability is performed via an ordered Schur decomposition |
3502
|
25 ## that reveals the unstable subspace of the system @var{a} matrix. |
3441
|
26 ## |
3502
|
27 ## Returns @code{retval} = 1 if the system, @var{a}, is stabilizable, |
|
28 ## if the pair (@var{a}, @var{b}) is stabilizable, or 0 if not. |
|
29 ## @var{u} = orthogonal basis of controllable subspace. |
3441
|
30 ## |
|
31 ## Controllable subspace is determined by applying Arnoldi iteration with |
|
32 ## complete re-orthogonalization to obtain an orthogonal basis of the |
|
33 ## Krylov subspace. |
|
34 ## @example |
|
35 ## span ([b,a*b,...,a^ b]). |
|
36 ## @end example |
|
37 ## tol is a roundoff paramter, set to 200*eps if omitted. |
|
38 ## @end deftypefn |
|
39 |
4030
|
40 ## See also: size, rows, columns, length, ismatrix, isscalar, isvector |
3441
|
41 ## is_observable, is_stabilizable, is_detectable |
|
42 |
|
43 ## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu> |
|
44 ## Created: August 1993 |
|
45 ## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb |
|
46 ## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 to accept systems |
|
47 |
|
48 function [retval, U] = is_stabilizable (a, b, tol) |
|
49 |
|
50 if(nargin < 1) usage("[retval,U] = is_stabilizable(a {, b ,tol})"); |
4030
|
51 elseif(isstruct(a)) |
3441
|
52 ## sustem passed. |
|
53 if(nargin == 2) |
|
54 tol = b; % get tolerance |
|
55 elseif(nargin > 2) |
|
56 usage("[retval,U] = is_stabilizable(sys{,tol})"); |
|
57 endif |
3814
|
58 [a,b] = sys2ss(a); |
3441
|
59 else |
|
60 ## a,b arguments sent directly. |
|
61 if(nargin > 3) |
|
62 usage("[retval,U] = is_stabilizable(a {, b ,tol})"); |
|
63 endif |
|
64 endif |
|
65 |
|
66 if(exist("tol")) |
|
67 [retval,U] = is_controllable(a,b,tol); |
|
68 else |
|
69 [retval,U] = is_controllable(a,b); |
|
70 tol = 1e2*rows(b)*eps; |
|
71 endif |
|
72 |
|
73 if( !retval & columns(U) > 0) |
|
74 ## now use an ordered Schur decomposition to get an orthogonal |
|
75 ## basis of the unstable subspace... |
|
76 n = rows(a); |
|
77 [ua, s] = schur (-(a+eye(n)*tol), "A"); |
|
78 k = sum( real(eig(a)) >= 0 ); # count unstable poles |
|
79 |
|
80 if( k > 0 ) |
|
81 ua = ua(:,1:k); |
|
82 ## now see if span(ua) is contained in span(U) |
|
83 retval = (norm(ua - U*U'*ua) < tol); |
|
84 else |
|
85 retval = 1; # all poles stable |
|
86 endif |
|
87 endif |
|
88 |
|
89 endfunction |