home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts.fat / control / minfo.m < prev    next >
Text File  |  1999-04-29  |  3KB  |  85 lines

  1. # Copyright (C) 1996 A. Scottedward Hodel 
  2. #
  3. # This file is part of Octave. 
  4. #
  5. # Octave is free software; you can redistribute it and/or modify it 
  6. # under the terms of the GNU General Public License as published by the 
  7. # Free Software Foundation; either version 2, or (at your option) any 
  8. # later version. 
  9. # Octave is distributed in the hope that it will be useful, but WITHOUT 
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  11. # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
  12. # for more details.
  13. # You should have received a copy of the GNU General Public License 
  14. # along with Octave; see the file COPYING.  If not, write to the Free 
  15. # Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  16.  
  17. function [systype, nout, nin, ncstates, ndstates] = minfo(inmat)
  18.   #  function [systype, nout, nin, ncstates, ndstates] = minfo(inmat)
  19.   #
  20.   # MINFO:  Determines the type of system matrix.  INMAT can be
  21.   #         a varying(*), system, constant, and empty matrix.
  22.   #
  23.   #    Returns:
  24.   #      systype can be one of:
  25.   #            varying, system, constant, and empty
  26.   #      nout is the number of outputs of the system
  27.   #      nin is the number of inputs of the system
  28.   #      ncstates is the number of continuous states of the system
  29.   #     ndstates is the number of discrete states of the system
  30.  
  31.   # Written by R. Bruce Tenison July 29, 1994
  32.   # Modified by David Clem November 13, 1994
  33.   # Modified by A. S. Hodel July 1995
  34.  
  35.   warning("minfo: obsolete.  Use sys2ss, sys2tf, or sys2zp.");
  36.     
  37.   if (nargin ~= 1 )
  38.     disp('MINFO: Wrong number of arguments')
  39.     systype = nout = nin = ncstates = ndstates = [];
  40.   endif
  41.   
  42.   [rr,cc] = size(inmat);
  43.   
  44.   # Check for empty matrix first!
  45.   if (isempty(inmat))
  46.     systype = "empty";
  47.     nout = nin = ncstates = ndstates = 0;
  48.     return
  49.   
  50.   # Check for Constant matrix
  51.  
  52.   elseif (rr == 1 || cc == 1)
  53.     systype = "constant";
  54.     nout = nin = ncstates = ndstates = 1;
  55.     return
  56.   
  57.   # Check for system type matrix
  58.   elseif (inmat(rr,cc) == -Inf)
  59.     systype = "system";
  60.     ncstates = inmat(1,cc);
  61.     ndstates = inmat(rr,1);
  62.     nstates = ncstates + ndstates;
  63.     nout = rr - nstates - 1;
  64.     nin = cc - nstates - 1;
  65.   
  66.   # Check for Varying type matrix
  67.   elseif (inmat(rr,cc) == Inf)
  68.     systype = "varying";
  69.     npoints = inmat(rr,cc-1);
  70.     nin = cc - 1;
  71.     nout = rr / npoints;
  72.     nstates = 0;
  73.  
  74.     # Must be a standard matrix
  75.   else
  76.     systype = "constant";
  77.     nin = cc;
  78.     nout = rr;
  79.     ncstates = 0;
  80.     ndstates = 0;
  81.   endif
  82. endfunction
  83.