3213
|
1 # Copyright (C) 1993, 1994, 1995 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 |
|
19 function [retval,U] = is_stabilizable (a, b, tol) |
|
20 |
|
21 # Usage: [retval,U] = is_stabilizable (a {, b, tol}) |
|
22 # |
|
23 # Returns retval = 1 if the system, a, is stabilizable, if the pair (a, b) is |
|
24 # stabilizable, or 0 if not. |
|
25 # U = orthogonal basis of controllable subspace. |
|
26 # |
|
27 # Controllable subspace is determined by applying Arnoldi iteration with |
|
28 # complete re-orthogonalization to obtain an orthogonal basis of the |
|
29 # Krylov subspace. |
|
30 # |
|
31 # span ([b,a*b,...,a^ b]). |
|
32 # |
|
33 # tol is a roundoff paramter, set to 200*eps if omitted. |
|
34 # |
|
35 # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector |
3228
|
36 # is_observable, is_stabilizable, is_detectable |
3213
|
37 |
|
38 # Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. |
|
39 # Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb |
|
40 # Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 to accept systems |
3228
|
41 # $Revision: 2.0.0.0 $ |
3213
|
42 |
3228
|
43 if(nargin < 1) usage("[retval,U] = is_stabilizable(a {, b ,tol})"); |
3213
|
44 elseif(is_struct(a)) |
|
45 # sustem passed. |
|
46 if(nargin == 2) |
|
47 tol = b; % get tolerance |
|
48 elseif(nargin > 2) |
|
49 usage("[retval,U] = is_stabilizable(sys{,tol})"); |
|
50 endif |
3228
|
51 [a,b] = sys2ss(sys); |
3213
|
52 else |
|
53 # a,b arguments sent directly. |
|
54 if(nargin > 3) |
|
55 usage("[retval,U] = is_stabilizable(a {, b ,tol})"); |
|
56 endif |
|
57 endif |
|
58 |
|
59 if(exist("tol")) |
|
60 [retval,U] = is_controllable(a,b,tol); |
|
61 else |
|
62 [retval,U] = is_controllable(a,b); |
|
63 tol = 1e2*rows(b)*eps; |
|
64 endif |
|
65 |
|
66 if( !retval & columns(U) > 0) |
|
67 # now use an ordered Schur decomposition to get an orthogonal |
|
68 # basis of the unstable subspace... |
|
69 n = rows(a); |
|
70 [ua,s] = schur(-(a+eye(n)*tol),'A'); |
|
71 k = sum( real(eig(a)) >= 0 ); # count unstable poles |
|
72 |
|
73 if( k > 0 ) |
|
74 ua = ua(:,1:k); |
|
75 # now see if span(ua) is contained in span(U) |
|
76 retval = (norm(ua - U*U'*ua) < tol); |
|
77 else |
|
78 retval = 1; # all poles stable |
|
79 endif |
|
80 endif |
|
81 |
|
82 endfunction |