# HG changeset patch # User jwe # Date 746722495 0 # Node ID f3c9042fd6094954b10b91f677f584d84c503d53 # Parent 2d480148756bb4ab1cda651be0711ec2f2fd710c [project @ 1993-08-30 14:49:08 by jwe] diff -r 2d480148756b -r f3c9042fd609 scripts/control/are.m --- a/scripts/control/are.m Mon Aug 30 14:44:35 1993 +0000 +++ b/scripts/control/are.m Mon Aug 30 14:54:55 1993 +0000 @@ -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) diff -r 2d480148756b -r f3c9042fd609 scripts/control/is_controllable.m --- a/scripts/control/is_controllable.m Mon Aug 30 14:44:35 1993 +0000 +++ b/scripts/control/is_controllable.m Mon Aug 30 14:54:55 1993 +0000 @@ -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) diff -r 2d480148756b -r f3c9042fd609 scripts/control/lyap.m --- a/scripts/control/lyap.m Mon Aug 30 14:44:35 1993 +0000 +++ b/scripts/control/lyap.m Mon Aug 30 14:54:55 1993 +0000 @@ -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 diff -r 2d480148756b -r f3c9042fd609 scripts/control/tzero.m --- a/scripts/control/tzero.m Mon Aug 30 14:44:35 1993 +0000 +++ b/scripts/control/tzero.m Mon Aug 30 14:54:55 1993 +0000 @@ -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 diff -r 2d480148756b -r f3c9042fd609 scripts/general/is_symmetric.m --- a/scripts/general/is_symmetric.m Mon Aug 30 14:44:35 1993 +0000 +++ b/scripts/general/is_symmetric.m Mon Aug 30 14:54:55 1993 +0000 @@ -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)