3381
|
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. |
3213
|
18 |
3346
|
19 ## -*- texinfo -*- |
|
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}@}) |
|
22 ## Logical check for system stabilizability (i.e., all unstable modes are controllable). |
|
23 ## |
|
24 ## |
|
25 ## Test for stabilizability is performed via an ordered Schur decomposition |
|
26 ## that reveals the unstable subspace of the system @var{A} matrix. |
|
27 ## |
|
28 ## Returns @code{retval} = 1 if the system, @code{a}, is stabilizable, if the pair |
|
29 ## (@code{a}, @code{b}) is stabilizable, or 0 if not. |
|
30 ## @code{U} = orthogonal basis of controllable subspace. |
|
31 ## |
|
32 ## Controllable subspace is determined by applying Arnoldi iteration with |
|
33 ## complete re-orthogonalization to obtain an orthogonal basis of the |
|
34 ## Krylov subspace. |
|
35 ## @example |
|
36 ## span ([b,a*b,...,a^ b]). |
|
37 ## @end example |
|
38 ## tol is a roundoff paramter, set to 200*eps if omitted. |
|
39 ## @end deftypefn |
3213
|
40 |
3346
|
41 ## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector |
|
42 ## is_observable, is_stabilizable, is_detectable |
3213
|
43 |
3385
|
44 function [retval, U] = is_stabilizable (a, b, tol) |
3381
|
45 |
|
46 ## Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. |
|
47 ## Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb |
|
48 ## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 to accept systems |
3213
|
49 |
3228
|
50 if(nargin < 1) usage("[retval,U] = is_stabilizable(a {, b ,tol})"); |
3213
|
51 elseif(is_struct(a)) |
3381
|
52 ## sustem passed. |
3213
|
53 if(nargin == 2) |
|
54 tol = b; % get tolerance |
|
55 elseif(nargin > 2) |
|
56 usage("[retval,U] = is_stabilizable(sys{,tol})"); |
|
57 endif |
3228
|
58 [a,b] = sys2ss(sys); |
3213
|
59 else |
3381
|
60 ## a,b arguments sent directly. |
3213
|
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) |
3381
|
74 ## now use an ordered Schur decomposition to get an orthogonal |
|
75 ## basis of the unstable subspace... |
3213
|
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); |
3381
|
82 ## now see if span(ua) is contained in span(U) |
3213
|
83 retval = (norm(ua - U*U'*ua) < tol); |
|
84 else |
|
85 retval = 1; # all poles stable |
|
86 endif |
|
87 endif |
|
88 |
|
89 endfunction |