comparison scripts/control/is_stabilizable.m @ 3228:dbcc24961c44

[project @ 1998-12-09 18:42:12 by jwe]
author jwe
date Wed, 09 Dec 1998 18:42:13 +0000
parents ba1c7cdc6090
children 28aba52a2368
comparison
equal deleted inserted replaced
3227:e090571062ee 3228:dbcc24961c44
31 # span ([b,a*b,...,a^ b]). 31 # span ([b,a*b,...,a^ b]).
32 # 32 #
33 # tol is a roundoff paramter, set to 200*eps if omitted. 33 # tol is a roundoff paramter, set to 200*eps if omitted.
34 # 34 #
35 # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector 35 # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector
36 # is_observable, is_stabilizable, is_detectable, krylov, krylovb 36 # is_observable, is_stabilizable, is_detectable
37 37
38 # Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993. 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 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 40 # Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 to accept systems
41 # SYS_INTERNAL accesses members of system structure 41 # $Revision: 2.0.0.0 $
42 # $Revision: 1.1.1.1 $
43 42
44 if(nargin < 1) 43 if(nargin < 1) usage("[retval,U] = is_stabilizable(a {, b ,tol})");
45 usage("[retval,U] = is_stabilizable(a {, b ,tol})");
46 elseif(is_struct(a)) 44 elseif(is_struct(a))
47 # sustem passed. 45 # sustem passed.
48 if(nargin == 2) 46 if(nargin == 2)
49 tol = b; % get tolerance 47 tol = b; % get tolerance
50 elseif(nargin > 2) 48 elseif(nargin > 2)
51 usage("[retval,U] = is_stabilizable(sys{,tol})"); 49 usage("[retval,U] = is_stabilizable(sys{,tol})");
52 endif 50 endif
53 sys = sysupdate(a,"ss"); 51 [a,b] = sys2ss(sys);
54 a = sys.a;
55 b = sys.b;
56 else 52 else
57 # a,b arguments sent directly. 53 # a,b arguments sent directly.
58 if(nargin > 3) 54 if(nargin > 3)
59 usage("[retval,U] = is_stabilizable(a {, b ,tol})"); 55 usage("[retval,U] = is_stabilizable(a {, b ,tol})");
60 endif 56 endif
65 else 61 else
66 [retval,U] = is_controllable(a,b); 62 [retval,U] = is_controllable(a,b);
67 tol = 1e2*rows(b)*eps; 63 tol = 1e2*rows(b)*eps;
68 endif 64 endif
69 65
70 #disp("is_stabilzable: is_controllable returns")
71 #retval
72 #U
73 #disp("/is_stabilzable: is_controllable returns")
74
75 if( !retval & columns(U) > 0) 66 if( !retval & columns(U) > 0)
76 # now use an ordered Schur decomposition to get an orthogonal 67 # now use an ordered Schur decomposition to get an orthogonal
77 # basis of the unstable subspace... 68 # basis of the unstable subspace...
78 n = rows(a); 69 n = rows(a);
79 [ua,s] = schur(-(a+eye(n)*tol),'A'); 70 [ua,s] = schur(-(a+eye(n)*tol),'A');
80 k = sum( real(eig(a)) >= 0 ); # count unstable poles 71 k = sum( real(eig(a)) >= 0 ); # count unstable poles
81 72
82 #disp("is_stabilizable: unstable poles found:")
83 #k
84 #s
85 #disp("/is_stabilizable: unstable poles found:")
86
87 if( k > 0 ) 73 if( k > 0 )
88 ua = ua(:,1:k); 74 ua = ua(:,1:k);
89 # now see if span(ua) is contained in span(U) 75 # now see if span(ua) is contained in span(U)
90 retval = (norm(ua - U*U'*ua) < tol); 76 retval = (norm(ua - U*U'*ua) < tol);
91 else 77 else