changeset 3441:36ae9880c594

[project @ 2000-01-14 22:03:32 by jwe]
author jwe
date Fri, 14 Jan 2000 22:05:57 +0000
parents c487fb85b843
children 86e1068c2abb
files scripts/ChangeLog scripts/control/base/is_controllable.m scripts/control/base/is_detectable.m scripts/control/base/is_observable.m scripts/control/base/is_stabilizable.m scripts/control/base/is_stable.m scripts/control/system/is_controllable.m scripts/control/system/is_detectable.m scripts/control/system/is_observable.m scripts/control/system/is_stabilizable.m scripts/control/system/is_stable.m
diffstat 11 files changed, 410 insertions(+), 410 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Fri Jan 14 22:00:20 2000 +0000
+++ b/scripts/ChangeLog	Fri Jan 14 22:05:57 2000 +0000
@@ -39,7 +39,6 @@
 	* control/base/damp.m: Ditto.
 	* control/base/dare.m: Ditto.
 	* control/base/dcgain.m: Ditto.
-	* control/base/dgkfdemo.m: Ditto.
 	* control/base/dgram.m: Ditto.
 	* control/base/dlqe.m: Ditto.
 	* control/base/dlqr.m: Ditto.
@@ -50,12 +49,6 @@
 	* control/base/freqresp.m: Ditto.
 	* control/base/gram.m: Ditto.
 	* control/base/impulse.m: Ditto.
-	* control/base/is_controllable.m: Ditto.
-	* control/base/is_detectable.m: Ditto.
-	* control/base/is_dgkf.m: Ditto.
-	* control/base/is_observable.m: Ditto.
-	* control/base/is_stabilizable.m: Ditto.
-	* control/base/is_stable.m: Ditto.
 	* control/base/lqe.m: Ditto.
 	* control/base/lqg.m: Ditto.
 	* control/base/lqr.m: Ditto.
@@ -85,6 +78,8 @@
 	* control/hinf/hinfsyn_chk.m: Ditto.
 	* control/hinf/hinfsyn_ric.m: Ditto.
 	* control/hinf/wgt1o.m: Ditto.
+	* control/hinf/dgkfdemo.m: Ditto.
+	* control/hinf/is_dgkf.m: Ditto.
 
 	* control/marsyas: New directory.
 	* control/marsyas/demomarsyas.m: Move here from control directory.
@@ -106,6 +101,11 @@
 	* control/system/is_sample.m: Ditto.
 	* control/system/is_signal_list.m: Ditto.
 	* control/system/is_siso.m: Ditto.
+	* control/system/is_controllable.m: Ditto.
+	* control/system/is_detectable.m: Ditto.
+	* control/system/is_observable.m: Ditto.
+	* control/system/is_stabilizable.m: Ditto.
+	* control/system/is_stable.m: Ditto.
 	* control/system/jet707.m: Ditto.
 	* control/system/listidx.m: Ditto.
 	* control/system/moddemo.m: Ditto.
--- a/scripts/control/base/is_controllable.m	Fri Jan 14 22:00:20 2000 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{sys}@{, @var{tol}@})
-## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{a}@{, @var{b}, @var{tol}@})
-## Logical check for system controllability.
-##
-## @strong{Inputs}
-## @table @var
-## @item sys
-## system data structure
-## @item a
-## @itemx b
-## @var{n} by @var{n}, @var{n} by @var{m} matrices, respectively
-## @item tol
-## optional roundoff paramter.  default value: @code{10*eps}
-## @end table
-##
-## @strong{Outputs}
-## @table @var
-## @item retval
-## Logical flag; returns true (1) if the system @var{sys} or the
-## pair (@var{a},@var{b}) is controllable, whichever was passed as input
-## arguments.
-## @item U
-##  U is an orthogonal basis of the controllable subspace.
-## @end table
-##
-## @strong{Method}
-## Controllability is determined by applying Arnoldi iteration with
-## complete re-orthogonalization to obtain an orthogonal basis of the
-## Krylov subspace
-## @example
-## span ([b,a*b,...,a^@{n-1@}*b]).
-## @end example
-## The Arnoldi iteration is executed with @code{krylov} if the system
-## has a single input; otherwise a block Arnoldi iteration is performed
-## with @code{krylovb}.
-## @end deftypefn
-## @seealso{size, rows, columns, length, is_matrix, is_scalar, is_vector
-## is_observable, is_stabilizable, is_detectable, krylov, and krylovb}
-
-## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
-## Created: 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
-
-function [retval, U] = is_controllable (a, b, tol)
-
-  deftol = 1;    # assume default tolerance
-  if(nargin < 1 | nargin > 3)
-    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");
-    [a,bs] = sys2ss(sys);
-    if(nargin > 2)
-      usage("[retval,U] = is_controllable(sys{,tol})");
-    elseif(nargin == 2)
-      tol = b;          % get tolerance
-      deftol = 0;
-    endif
-    b = bs;
-  else
-    ## a,b arguments sent directly.
-    if(nargin < 2)
-      usage("[retval,U] = is_controllable(a {, b ,tol})");
-    else
-      deftol = 1;
-    endif
-  endif
-
-  ## check for default tolerance
-  if(deftol) tol = 1000*eps; endif
-
-  ## check tol dimensions
-  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
-  n = is_square (a);
-  [nr, nc] = size (b);
-
-  if (n == 0 | n != nr | nc == 0)
-    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.
-    [U,H,Ucols] = krylov(a,b,n,tol,1);
-    retval = (Ucols == n);
-  endif
-endfunction
--- a/scripts/control/base/is_detectable.m	Fri Jan 14 22:00:20 2000 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{a}, @var{c}@{, @var{tol}@})
-## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{sys}@{, @var{tol}@})
-## Test for detactability (observability of unstable modes) of
-## (@var{a},@var{c}).
-##
-## Returns 1 if the system @var{a} or the pair (@var{a},@var{c})is
-## detectable, 0 if not.
-##
-## @strong{See} @code{is_stabilizable} for detailed description of
-## arguments and computational method.
-##
-## Default: tol = 10*norm(a,'fro')*eps
-##
-## @end deftypefn
-## @seealso{is_stabilizable, size, rows, columns, length, is_matrix,
-## is_scalar, and is_vector}
-
-## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
-## Created: August 1993
-## Updated by John Ingram (ingraje@eng.auburn.edu) July 1996.
-
-function [retval, U] = is_detectable (a, c, tol)
-
-  if( nargin < 1)
-    usage("[retval,U] = is_detectable(a , c {, tol})");
-  elseif(is_struct(a))
-    ## system form
-    if(nargin == 2)
-      tol = c;
-    elseif(nargin > 2)
-      usage("[retval,U] = is_detectable(sys {, tol})");
-    endif
-    [a,b,c] = sys2ss(a);
-  elseif(nargin > 3)
-    usage("[retval,U] = is_detectable(a , c {, tol})");
-  endif
-  if(exist("tol"))
-    [retval,U] = is_stabilizable (a', c', tol);
-  else
-    [retval,U] = is_stabilizable (a', c');
-  endif
-
-
-endfunction
-
--- a/scripts/control/base/is_observable.m	Fri Jan 14 22:00:20 2000 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{retval},@var{U}] =} is_observable (@var{a}, @var{c}@{,@var{tol}@})
-## @deftypefnx {Function File} {[@var{retval},@var{U}] =} is_observable (@var{sys}@{, @var{tol}@})
-## Logical check for system observability.
-##
-## Default: tol = 10*norm(a,'fro')*eps
-##
-## Returns 1 if the system @var{sys} or the pair (@var{a},@var{c}) is
-## observable, 0 if not.
-##
-## @strong{See} @code{is_controllable} for detailed description of arguments
-## and default values.
-## @end deftypefn
-## @seealso{size, rows, columns, length, is_matrix, is_scalar, and is_vector}
-
-## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
-## Created: August 1993
-## Updated by John Ingram (ingraje@eng.auburn.edu) July 1996.
-
-function [retval, U] = is_observable (a, c, tol)
-
-  if( nargin < 1)
-    usage("[retval,U] = is_observable(a , c {, tol})");
-  elseif(is_struct(a))
-    ## system form
-    if(nargin == 2)
-      tol = c;
-    elseif(nargin > 2)
-      usage("[retval,U] = is_observable(sys {, tol})");
-    endif
-    [a,b,c] = sys2ss(a);
-  elseif(nargin > 3)
-    usage("[retval,U] = is_observable(a , c {, tol})");
-  endif
-  if(exist("tol"))
-    [retval,U] = is_controllable (a', c', tol);
-  else
-    [retval,U] = is_controllable (a', c');
-  endif
-
-endfunction
-
--- a/scripts/control/base/is_stabilizable.m	Fri Jan 14 22:00:20 2000 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_stabilizable (@var{sys}@{, @var{tol}@})
-## @deftypefnx {Function File } {[@var{retval}, @var{U}] =} is_stabilizable (@var{a}@{, @var{b} ,@var{tol}@})
-## Logical check for system stabilizability (i.e., all unstable modes are controllable).
-##
-## Test for stabilizability is performed via an ordered Schur decomposition
-## that reveals the unstable subspace of the system @var{A} matrix.
-##
-## Returns @code{retval} = 1 if the system, @code{a}, is stabilizable,
-## if the pair  (@code{a}, @code{b}) is stabilizable, or 0 if not.
-## @code{U} = orthogonal basis of controllable subspace.
-##
-## Controllable subspace is determined by applying Arnoldi iteration with
-## complete re-orthogonalization to obtain an orthogonal basis of the
-## Krylov subspace.
-## @example
-##   span ([b,a*b,...,a^   b]).
-## @end example
-## tol is a roundoff paramter, set to 200*eps if omitted.
-## @end deftypefn
-
-## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector
-##     is_observable, is_stabilizable, is_detectable
-
-## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
-## Created: 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 to accept systems
-
-function [retval, U] = is_stabilizable (a, b, tol)
-
-  if(nargin < 1)        usage("[retval,U] = is_stabilizable(a {, b ,tol})");
-  elseif(is_struct(a))
-    ## sustem passed.
-    if(nargin == 2)
-      tol = b;          % get tolerance
-    elseif(nargin > 2)
-      usage("[retval,U] = is_stabilizable(sys{,tol})");
-    endif
-    [a,b] = sys2ss(sys);
-  else
-    ## a,b arguments sent directly.
-    if(nargin > 3)
-      usage("[retval,U] = is_stabilizable(a {, b ,tol})");
-    endif
-  endif
-
-  if(exist("tol"))
-    [retval,U] = is_controllable(a,b,tol);
-  else
-    [retval,U] = is_controllable(a,b);
-    tol = 1e2*rows(b)*eps;
-  endif
-
-  if( !retval & columns(U) > 0)
-    ## now use an ordered Schur decomposition to get an orthogonal
-    ## basis of the unstable subspace...
-    n = rows(a);
-    [ua, s] = schur (-(a+eye(n)*tol), "A");
-    k = sum( real(eig(a)) >= 0 );       # count unstable poles
-
-    if( k > 0 )
-      ua = ua(:,1:k);
-      ## now see if span(ua) is contained in span(U)
-      retval = (norm(ua - U*U'*ua) < tol);
-    else
-      retval = 1;                       # all poles stable
-    endif
-  endif
-
-endfunction
--- a/scripts/control/base/is_stable.m	Fri Jan 14 22:00:20 2000 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by the
-## Free Software Foundation; either version 2, or (at your option) any
-## later version.
-##
-## Octave is distributed in the hope that it will be useful, but WITHOUT
-## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-## for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, write to the Free
-## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
-
-## -*- texinfo -*-
-## @deftypefn {Function File} {@var{retval} =} is_stable (@var{a}@{,@var{tol},@var{dflg}@})
-## @deftypefnx {Function File} {@var{retval} =} is_stable (@var{sys}@{,@var{tol}@})
-## Returns retval = 1 if the matrix @var{a} or the system @var{sys}
-## is stable, or 0 if not.
-##
-## @strong{Inputs}
-## @table @var
-## @item  tol
-## is a roundoff paramter, set to 200*@var{eps} if omitted.
-## @item dflg
-## Digital system flag (not required for system data structure):
-## @table @code
-## @item @var{dflg} != 0
-## stable if eig(a) in unit circle
-##
-## @item @var{dflg} == 0
-## stable if eig(a) in open LHP (default)
-## @end table
-## @end table
-## @end deftypefn
-## @seealso{size, rows, columns, length, is_matrix, is_scalar, is_vector
-## is_observable, is_stabilizable, is_detectable, krylov, and krylovb}
-
-## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
-## Created: August 1993
-## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 for systems
-## Updated to simpler form by a.s.hodel 1998
-
-function retval = is_stable (a, tol, disc)
-
-  if( (nargin < 1) | (nargin > 3) )   usage("is_stable(a {,tol,disc})");
-  elseif(is_struct(a))
-    ## system was passed
-    if(nargin < 3)                      disc = is_digital(a);
-    elseif(disc != is_digital(a))
-      warning("is_stable: disc =%d does not match system",disc)
-    endif
-    sys = sysupdate(a,"ss");
-    a = sys2ss(sys);
-  else
-    if(nargin < 3)              disc = 0;               endif
-    if(is_square(a) == 0)
-      error("A(%dx%d) must be square",rows(A), columns(A));
-    endif
-  endif
-
-  if(nargin < 2)                tol = 200*eps;
-  elseif( !is_scalar(tol) )
-    error("is_stable: tol(%dx%d) must be a scalar",rows(tol),columns(tol));
-  endif
-
-  l = eig(a);
-  if(disc)      nbad = sum(abs(l)*(1+tol) > 1);
-  else          nbad = sum(real(l)+tol > 0);            endif
-  retval = (nbad == 0);
-
-endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/control/system/is_controllable.m	Fri Jan 14 22:05:57 2000 +0000
@@ -0,0 +1,114 @@
+## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{sys}@{, @var{tol}@})
+## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_controllable (@var{a}@{, @var{b}, @var{tol}@})
+## Logical check for system controllability.
+##
+## @strong{Inputs}
+## @table @var
+## @item sys
+## system data structure
+## @item a
+## @itemx b
+## @var{n} by @var{n}, @var{n} by @var{m} matrices, respectively
+## @item tol
+## optional roundoff paramter.  default value: @code{10*eps}
+## @end table
+##
+## @strong{Outputs}
+## @table @var
+## @item retval
+## Logical flag; returns true (1) if the system @var{sys} or the
+## pair (@var{a},@var{b}) is controllable, whichever was passed as input
+## arguments.
+## @item U
+##  U is an orthogonal basis of the controllable subspace.
+## @end table
+##
+## @strong{Method}
+## Controllability is determined by applying Arnoldi iteration with
+## complete re-orthogonalization to obtain an orthogonal basis of the
+## Krylov subspace
+## @example
+## span ([b,a*b,...,a^@{n-1@}*b]).
+## @end example
+## The Arnoldi iteration is executed with @code{krylov} if the system
+## has a single input; otherwise a block Arnoldi iteration is performed
+## with @code{krylovb}.
+## @end deftypefn
+## @seealso{size, rows, columns, length, is_matrix, is_scalar, is_vector
+## is_observable, is_stabilizable, is_detectable, krylov, and krylovb}
+
+## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Created: 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
+
+function [retval, U] = is_controllable (a, b, tol)
+
+  deftol = 1;    # assume default tolerance
+  if(nargin < 1 | nargin > 3)
+    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");
+    [a,bs] = sys2ss(sys);
+    if(nargin > 2)
+      usage("[retval,U] = is_controllable(sys{,tol})");
+    elseif(nargin == 2)
+      tol = b;          % get tolerance
+      deftol = 0;
+    endif
+    b = bs;
+  else
+    ## a,b arguments sent directly.
+    if(nargin < 2)
+      usage("[retval,U] = is_controllable(a {, b ,tol})");
+    else
+      deftol = 1;
+    endif
+  endif
+
+  ## check for default tolerance
+  if(deftol) tol = 1000*eps; endif
+
+  ## check tol dimensions
+  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
+  n = is_square (a);
+  [nr, nc] = size (b);
+
+  if (n == 0 | n != nr | nc == 0)
+    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.
+    [U,H,Ucols] = krylov(a,b,n,tol,1);
+    retval = (Ucols == n);
+  endif
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/control/system/is_detectable.m	Fri Jan 14 22:05:57 2000 +0000
@@ -0,0 +1,64 @@
+## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{a}, @var{c}@{, @var{tol}@})
+## @deftypefnx {Function File} {[@var{retval}, @var{U}] =} is_detectable (@var{sys}@{, @var{tol}@})
+## Test for detactability (observability of unstable modes) of
+## (@var{a},@var{c}).
+##
+## Returns 1 if the system @var{a} or the pair (@var{a},@var{c})is
+## detectable, 0 if not.
+##
+## @strong{See} @code{is_stabilizable} for detailed description of
+## arguments and computational method.
+##
+## Default: tol = 10*norm(a,'fro')*eps
+##
+## @end deftypefn
+## @seealso{is_stabilizable, size, rows, columns, length, is_matrix,
+## is_scalar, and is_vector}
+
+## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Created: August 1993
+## Updated by John Ingram (ingraje@eng.auburn.edu) July 1996.
+
+function [retval, U] = is_detectable (a, c, tol)
+
+  if( nargin < 1)
+    usage("[retval,U] = is_detectable(a , c {, tol})");
+  elseif(is_struct(a))
+    ## system form
+    if(nargin == 2)
+      tol = c;
+    elseif(nargin > 2)
+      usage("[retval,U] = is_detectable(sys {, tol})");
+    endif
+    [a,b,c] = sys2ss(a);
+  elseif(nargin > 3)
+    usage("[retval,U] = is_detectable(a , c {, tol})");
+  endif
+  if(exist("tol"))
+    [retval,U] = is_stabilizable (a', c', tol);
+  else
+    [retval,U] = is_stabilizable (a', c');
+  endif
+
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/control/system/is_observable.m	Fri Jan 14 22:05:57 2000 +0000
@@ -0,0 +1,60 @@
+## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{retval},@var{U}] =} is_observable (@var{a}, @var{c}@{,@var{tol}@})
+## @deftypefnx {Function File} {[@var{retval},@var{U}] =} is_observable (@var{sys}@{, @var{tol}@})
+## Logical check for system observability.
+##
+## Default: tol = 10*norm(a,'fro')*eps
+##
+## Returns 1 if the system @var{sys} or the pair (@var{a},@var{c}) is
+## observable, 0 if not.
+##
+## @strong{See} @code{is_controllable} for detailed description of arguments
+## and default values.
+## @end deftypefn
+## @seealso{size, rows, columns, length, is_matrix, is_scalar, and is_vector}
+
+## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Created: August 1993
+## Updated by John Ingram (ingraje@eng.auburn.edu) July 1996.
+
+function [retval, U] = is_observable (a, c, tol)
+
+  if( nargin < 1)
+    usage("[retval,U] = is_observable(a , c {, tol})");
+  elseif(is_struct(a))
+    ## system form
+    if(nargin == 2)
+      tol = c;
+    elseif(nargin > 2)
+      usage("[retval,U] = is_observable(sys {, tol})");
+    endif
+    [a,b,c] = sys2ss(a);
+  elseif(nargin > 3)
+    usage("[retval,U] = is_observable(a , c {, tol})");
+  endif
+  if(exist("tol"))
+    [retval,U] = is_controllable (a', c', tol);
+  else
+    [retval,U] = is_controllable (a', c');
+  endif
+
+endfunction
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/control/system/is_stabilizable.m	Fri Jan 14 22:05:57 2000 +0000
@@ -0,0 +1,89 @@
+## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {[@var{retval}, @var{U}] =} is_stabilizable (@var{sys}@{, @var{tol}@})
+## @deftypefnx {Function File } {[@var{retval}, @var{U}] =} is_stabilizable (@var{a}@{, @var{b} ,@var{tol}@})
+## Logical check for system stabilizability (i.e., all unstable modes are controllable).
+##
+## Test for stabilizability is performed via an ordered Schur decomposition
+## that reveals the unstable subspace of the system @var{A} matrix.
+##
+## Returns @code{retval} = 1 if the system, @code{a}, is stabilizable,
+## if the pair  (@code{a}, @code{b}) is stabilizable, or 0 if not.
+## @code{U} = orthogonal basis of controllable subspace.
+##
+## Controllable subspace is determined by applying Arnoldi iteration with
+## complete re-orthogonalization to obtain an orthogonal basis of the
+## Krylov subspace.
+## @example
+##   span ([b,a*b,...,a^   b]).
+## @end example
+## tol is a roundoff paramter, set to 200*eps if omitted.
+## @end deftypefn
+
+## See also: size, rows, columns, length, is_matrix, is_scalar, is_vector
+##     is_observable, is_stabilizable, is_detectable
+
+## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Created: 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 to accept systems
+
+function [retval, U] = is_stabilizable (a, b, tol)
+
+  if(nargin < 1)        usage("[retval,U] = is_stabilizable(a {, b ,tol})");
+  elseif(is_struct(a))
+    ## sustem passed.
+    if(nargin == 2)
+      tol = b;          % get tolerance
+    elseif(nargin > 2)
+      usage("[retval,U] = is_stabilizable(sys{,tol})");
+    endif
+    [a,b] = sys2ss(sys);
+  else
+    ## a,b arguments sent directly.
+    if(nargin > 3)
+      usage("[retval,U] = is_stabilizable(a {, b ,tol})");
+    endif
+  endif
+
+  if(exist("tol"))
+    [retval,U] = is_controllable(a,b,tol);
+  else
+    [retval,U] = is_controllable(a,b);
+    tol = 1e2*rows(b)*eps;
+  endif
+
+  if( !retval & columns(U) > 0)
+    ## now use an ordered Schur decomposition to get an orthogonal
+    ## basis of the unstable subspace...
+    n = rows(a);
+    [ua, s] = schur (-(a+eye(n)*tol), "A");
+    k = sum( real(eig(a)) >= 0 );       # count unstable poles
+
+    if( k > 0 )
+      ua = ua(:,1:k);
+      ## now see if span(ua) is contained in span(U)
+      retval = (norm(ua - U*U'*ua) < tol);
+    else
+      retval = 1;                       # all poles stable
+    endif
+  endif
+
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/control/system/is_stable.m	Fri Jan 14 22:05:57 2000 +0000
@@ -0,0 +1,76 @@
+## Copyright (C) 1993, 1994, 1995 Auburn University.  All rights reserved.
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 2, or (at your option) any
+## later version.
+##
+## Octave is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, write to the Free
+## Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {@var{retval} =} is_stable (@var{a}@{,@var{tol},@var{dflg}@})
+## @deftypefnx {Function File} {@var{retval} =} is_stable (@var{sys}@{,@var{tol}@})
+## Returns retval = 1 if the matrix @var{a} or the system @var{sys}
+## is stable, or 0 if not.
+##
+## @strong{Inputs}
+## @table @var
+## @item  tol
+## is a roundoff paramter, set to 200*@var{eps} if omitted.
+## @item dflg
+## Digital system flag (not required for system data structure):
+## @table @code
+## @item @var{dflg} != 0
+## stable if eig(a) in unit circle
+##
+## @item @var{dflg} == 0
+## stable if eig(a) in open LHP (default)
+## @end table
+## @end table
+## @end deftypefn
+## @seealso{size, rows, columns, length, is_matrix, is_scalar, is_vector
+## is_observable, is_stabilizable, is_detectable, krylov, and krylovb}
+
+## Author: A. S. Hodel <a.s.hodel@eng.auburn.edu>
+## Created: August 1993
+## Updated by John Ingram (ingraje@eng.auburn.edu) July, 1996 for systems
+## Updated to simpler form by a.s.hodel 1998
+
+function retval = is_stable (a, tol, disc)
+
+  if( (nargin < 1) | (nargin > 3) )   usage("is_stable(a {,tol,disc})");
+  elseif(is_struct(a))
+    ## system was passed
+    if(nargin < 3)                      disc = is_digital(a);
+    elseif(disc != is_digital(a))
+      warning("is_stable: disc =%d does not match system",disc)
+    endif
+    sys = sysupdate(a,"ss");
+    a = sys2ss(sys);
+  else
+    if(nargin < 3)              disc = 0;               endif
+    if(is_square(a) == 0)
+      error("A(%dx%d) must be square",rows(A), columns(A));
+    endif
+  endif
+
+  if(nargin < 2)                tol = 200*eps;
+  elseif( !is_scalar(tol) )
+    error("is_stable: tol(%dx%d) must be a scalar",rows(tol),columns(tol));
+  endif
+
+  l = eig(a);
+  if(disc)      nbad = sum(abs(l)*(1+tol) > 1);
+  else          nbad = sum(real(l)+tol > 0);            endif
+  retval = (nbad == 0);
+
+endfunction