home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21eb.zip / octave / SCRIPTS.ZIP / scripts / control / sys2zp.m < prev    next >
Text File  |  1999-03-05  |  2KB  |  56 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 [zer,pol,k,tsam,inname,outname] = sys2zp(sys)
  18. # [zer,pol,k,tsam,inname,outname] = sys2zp(sys)
  19. # extract zero/pole/leading coefficient information from a system data
  20. # structure
  21. # inputs: sys: system data structure
  22. # outputs:
  23. #   zer: vector of system zeros
  24. #   pol: vector of system poles
  25. #   k: scalar leading coefficient
  26. #   tsam: sampling period. default: 0 (continuous system)
  27. #   inname, outname: input/output signal names (strings)
  28.  
  29. # Created by John Ingram July 15 1996
  30.  
  31.   if(nargin != 1)
  32.     usage("[zer,pol,k,tsam,inname,outname] = sys2zp(sys)");
  33.   elseif( !is_struct(sys))
  34.     error("sysconnect: sys must be in system data structure form")
  35.   elseif (! is_siso(sys) )
  36.     [n, nz, m, p] = sysdimensions(sys);
  37.     error(["system is not SISO (",num2str(m)," inputs, ...
  38.     ", num2str(p)," outputs"]);
  39.   endif
  40.  
  41.   # update zero-pole form
  42.   sys = sysupdate(sys,"zp");
  43.  
  44.   zer = sys.zer;
  45.   pol = sys.pol;
  46.   k = sys.k;
  47.   tsam    = sysgettsam(sys);
  48.   inname  = sysgetsignals(sys,"in");
  49.   outname = sysgetsignals(sys,"out");
  50.  
  51. endfunction
  52.  
  53.  
  54.