diff scripts/control/is_controllable.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
line wrap: on
line diff
--- a/scripts/control/is_controllable.m
+++ b/scripts/control/is_controllable.m
@@ -37,13 +37,12 @@
 # Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993.
 # Updated by A. S. Hodel (scotte@eng.auburn.edu) Aubust, 1995 to use krylovb 
 # Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 for packed systems
-# SYS_INTERNAL accesses members of packed system structure
-# $Revision: 1.14 $
+# $Revision: 1.15 $
 
   deftol = 1;    # assume default tolerance
   if(nargin < 1 | nargin > 3)
-    usage(sprintf("[retval,U] = %s\n\t%s", "is_controllable(a {, b ,tol})", ...
-	"is_controllable(sys{,tol})"));
+    usage("[retval,U] = %s\n\t%s", "is_controllable(a {, b ,tol})", ...
+	"is_controllable(sys{,tol})");
   elseif(is_struct(a))
     # system structure passed.
     sys = sysupdate(a,"ss");
@@ -68,8 +67,11 @@
   if(deftol) tol = 1000*eps; endif
 
   # check tol dimensions
-  if( !is_sample(tol) )
-    error("is_controllable: tol must be a positive scalar!");
+  if( !is_scalar(tol) )
+    error("is_controllable: tol(%dx%d) must be a scalar", ...
+	rows(tol),columns(tol));
+  elseif( !is_sample(tol) )
+    error("is_controllable: tol=%e must be positive",tol);
   endif
 
   # check dimensions compatibility
@@ -77,14 +79,13 @@
   [nr, nc] = size (b);
 
   if (n == 0 | n != nr | nc == 0)
-    warning(["is_controllable: a=(",num2str(rows(a)),"x", ...
-      num2str(columns(a)),"), b=(",num2str(nr),"x",num2str(nc),")"])
+    warning("is_controllable: a=(%dx%d), b(%dx%d)",rows(a),columns(a),nr,nc);
     retval = 0;
   else
     # call block-krylov subspace routine to get an orthogonal basis
     # of the controllable subspace.
     if(nc == 1)
-      [U,H,Ucols] = krylov(a,b,n,tol);
+      [U,H,Ucols] = krylov(a,b,n,tol,1);
       U = U(:,1:Ucols);
     else
       [U,Ucols] = krylovb(a,b,n,tol);