changeset 73:f3c9042fd609

[project @ 1993-08-30 14:49:08 by jwe]
author jwe
date Mon, 30 Aug 1993 14:54:55 +0000
parents 2d480148756b
children 1b1a6414f9ed
files scripts/control/are.m scripts/control/is_controllable.m scripts/control/lyap.m scripts/control/tzero.m scripts/general/is_symmetric.m
diffstat 5 files changed, 48 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/control/are.m
+++ b/scripts/control/are.m
@@ -1,6 +1,6 @@
 function x = are (a, b, c, opt)
 
-# usage: x = are (a, b, c {,opt})
+# Usage: x = are (a, b, c {,opt})
 #
 # Solves algebraic riccati equation
 #
@@ -12,7 +12,9 @@
 # opt is an option passed to the eigenvalue balancing routine; default
 # is `B'. 
 #
-# see also: balance
+# See also: balance
+
+# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
 
   if (nargin == 3 || nargin == 4)
     if (nargin == 4)
--- a/scripts/control/is_controllable.m
+++ b/scripts/control/is_controllable.m
@@ -1,20 +1,24 @@
-function retval = is_controllable (a,b,tol)
+function retval = is_controllable (a, b, tol)
 
-# usage: is_controllable (a,b{,tol})
+# Usage: is_controllable (a, b {,tol})
 #
 # Returns 1 if the pair (a, b) is controllable, or 0 if not.
 #
 # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector
-
+#
 # This should really use the method below, but I'm being lazy for now:
 #
 # Controllability is determined by applying Arnoldi iteration with
 # complete re-orthogonalization to obtain an orthogonal basis of the
-# Krylov subspace
+# Krylov subspace.
+#
+# (FIX ME... The Krylov subspace approach is not done yet!)
 #                      n-1
 #   span ([b,a*b,...,a^   b]).
 #
-# tol is a roundoff paramter, set to 2*eps if omitted
+# tol is a roundoff paramter, set to 2*eps if omitted.
+
+# Written by A. S. Hodel (scotte@eng.auburn.edu) August, 1993.
 
   if (nargin == 2 || nargin == 3)
 
--- a/scripts/control/lyap.m
+++ b/scripts/control/lyap.m
@@ -1,6 +1,6 @@
 function x = lyap (a, b, c)
 
-# usage: x = lyap (a, b {,c})
+# Usage: x = lyap (a, b {,c})
 #
 # If (a, b, c) are specified, then lyap returns the solution of the
 # Sylvester equation
@@ -21,6 +21,11 @@
 #   a x + x a' + b b' = 0
 #
 # whichever is appropriate.
+#
+# Solves by using the Bartels-Stewart algorithm (1972).
+
+# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
+  
 
   if (nargin != 3 && nargin != 2)
     error ("usage: lyap (a, b {,c})");
@@ -68,7 +73,7 @@
       error ("lyap: b must be square in a sylvester equation");
     endif
 
-    [n1,m1] = size(c);
+    [n1, m1] = size(c);
 
     if (n != n1 || m != m1)
       error("lyap: a,b,c not conformably dimensioned");
@@ -77,6 +82,6 @@
 
 # Call octave built-in function.
 
-  x = syl(a,b,c);
+  x = syl (a, b, c);
 
 endfunction
--- a/scripts/control/tzero.m
+++ b/scripts/control/tzero.m
@@ -8,41 +8,38 @@
 #
 # Needs to incorporate mvzero algorithm to isolate finite zeros.
 
-# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993
+# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
 
   if (nargin == 4)
     bal = "B";
-  elseif (nargin ~= 5)
-    error("tzero: illegal number of arguments")
+  elseif (nargin != 5)
+    error ("tzero: illegal number of arguments");
   endif
 
-  [n, m, p] = abcdchk (a, b, c, d);
-
-  if(m != p)
-
-    disp("warning: tzero: number of inputs,outputs differ -- squaring up")
+  [n, m, p] = abcddim (a, b, c, d);
 
-    if (p > m)
-      disp ("  by padding b, d with zeros")
-      b = [b, zeros (n, p-m)];
-      d = [d, zeros (p, p-m)];
-      m = p;
-    else
-      disp ("  by padding c,d with zeros")
-      c = [c; zeros (m-p, n)];
-      d = [d; zeros (m-p, m)];
-      p = m;
+  if (n > 0 && m > 0 && p > 0)
+    if (m != p)
+      fprintf (stderr "tzero: number of inputs,outputs differ.  squaring up");
+      if (p > m)
+	fprintf (stderr, "       by padding b and d with zeros.");
+	b = [b, zeros (n, p-m)];
+	d = [d, zeros (p, p-m)];
+	m = p;
+      else
+	fprintf (stderr, "       by padding c and d with zeros.");
+	c = [c; zeros (m-p, n)];
+	d = [d; zeros (m-p, m)];
+	p = m;
+      endif
+      fprintf (stderr, "This is a kludge.  Try again with SISO system.");
     endif
-
-    disp ("This is a kludge.  Try again with SISO system.")
-
-  endif
-
-  if (n != -1)
-    ab = [-a -b; c d];
+    ab = [-a, -b; c, d];
     bb = [eye (n), zeros (n, m); zeros (p, n), zeros (p, m)];
-    [ab, bb] = balance (ab, bb);
-    zr = qzval (ab, bb);
+    [ab,bb] = balance (ab, bb);
+    zr = -qzval (ab, bb);
+  else
+    error ("tzero: a, b, c, d not compatible.  exiting");
   endif
 
 endfunction
--- a/scripts/general/is_symmetric.m
+++ b/scripts/general/is_symmetric.m
@@ -1,12 +1,14 @@
 function retval = is_symmetric (x,tol)
 
-# usage: is_symmetric (x{,tol})
+# Usage: is_symmetric (x {,tol})
 #
 # If x is symmetric, return the dimension of x, otherwise, return 0.
 #
 # See also: size, rows, columns, length, is_matrix, is_scalar, 
 # is_square, is_vector
 
+# Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
+
   if (nargin == 1 || nargin == 2)
     if ((retval = is_square (x)))
       if (nargin == 1)