home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts.fat / control / packsys.m < prev    next >
Text File  |  1999-04-29  |  2KB  |  71 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 Asys = packsys(a,b,c,d,dflg)
  18.   # O B S O L E T E: use ss2sys instead.
  19.   # function Asys = packsys(a,b,c[,d,dflg])
  20.   #
  21.   # dflg: 0 for continuous time system, 1 for discrete-time system.
  22.   # 
  23.   # defaults:
  24.   #   D: 0 matrix of appropriate dimension.
  25.   #   dflg: 0 (continuous time)
  26.   #
  27.   # Note: discrete-state sampling time is not included!
  28.   #
  29.   
  30.   # Written by R. Bruce Tenison  July 29, 1994
  31.   # Modified by David Clem November 13, 1994
  32.   # Modified by A. S. Hodel April 1995
  33.  
  34.   warning("packsys is obsolete!  Use ss2sys instead.");
  35.   
  36.   if (nargin < 3 || nargin > 5)
  37.     disp("packsys: Invalid number of arguments")
  38.   endif
  39.  
  40.   # check dflg
  41.   if(nargin == 5)
  42.     if( !is_scal(dflg))
  43.       [m,n] = size(dflg);
  44.       error(["packsys: dflg (",num2str(m),",",num2str(n), ...
  45.     ") must be a scalar."]);
  46.     elseif( (dflg != 0) && (dflg != 1))
  47.       error(["packsys: dflg=",num2str(dflg),"must be 0 or 1"]);
  48.     endif
  49.   else
  50.     #default condition
  51.     dflg = 0;
  52.   endif
  53.  
  54.   if (nargin == 3)
  55.     # No D matrix.  Form a zero one!
  56.     [brows,bcols] = size(b);
  57.     [crows,ccols] = size(c);
  58.     d = zeros(crows,bcols);
  59.   endif
  60.  
  61.   [n,m,p] = abcddim(a,b,c,d);
  62.   if (n == -1 || m == -1 || p == -1)
  63.     error("packsys: incompatible dimensions")
  64.   endif
  65.   
  66.   Asys = ss2sys(a,b,c,d,dflg);
  67.  
  68. endfunction
  69.