home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts / control / is_observable.m < prev    next >
Text File  |  1999-03-05  |  2KB  |  56 lines

  1. # Copyright (C) 1993, 1994, 1995 John W. Eaton
  2. # This file is part of Octave.
  3. # Octave is free software; you can redistribute it and/or modify it
  4. # under the terms of the GNU General Public License as published by the
  5. # Free Software Foundation; either version 2, or (at your option) any
  6. # later version.
  7. # Octave is distributed in the hope that it will be useful, but WITHOUT
  8. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  10. # for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with Octave; see the file COPYING.  If not, write to the Free
  13. # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  14.  
  15. function [retval,U] = is_observable (a,c,tol)
  16.  
  17. # [retval,U] = is_observable (a,c,tol)
  18. # usage: is_observable (a , c {,tol})
  19. #     or is_observable (sys {,tol})
  20. #
  21. # Default: tol = 10*norm(a,'fro')*eps
  22. #
  23. # Returns 1 if the system, a, is observable, 1 if the pair (a, c) is 
  24. # observable, or 0 if not.
  25. #
  26. # See also: size, rows, columns, length, is_matrix, is_scalar, is_vector.
  27.  
  28. # Written by A. S. Hodel (scotte@eng.auburn.edu) August 1993.
  29. # Updated by John Ingram (ingraje@eng.auburn.edu) July 1996.
  30.  
  31.   if( nargin < 1) 
  32.     usage("[retval,U] = is_observable(a , c {, tol})");
  33.   elseif(is_struct(a))
  34.     # system form
  35.     if(nargin == 2)
  36.       tol = c;
  37.     elseif(nargin > 2)
  38.       usage("[retval,U] = is_observable(sys {, tol})");
  39.     endif
  40.     [a,b,c] = sys2ss(a);
  41.   elseif(nargin > 3)
  42.     usage("[retval,U] = is_observable(a , c {, tol})");
  43.   endif
  44.   if(exist("tol"))
  45.     [retval,U] = is_controllable (a', c', tol);
  46.   else
  47.     [retval,U] = is_controllable (a', c');
  48.   endif
  49.  
  50. endfunction
  51.  
  52.