home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS1.DI$ / ND2SYS.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  790 b   |  29 lines

  1. % function sys = nd2sys(num,den,gain)
  2. %
  3. %   ND2SYS converts a numerator/denominator single-input/
  4. %   single-output transfer function into a SYSTEM matrix. 
  5. %   GAIN is an optional argument that scales the output SYS.
  6. %
  7. %   See also:  PCK, PSS2SYS, SYS2PSS, TF2SS, UNPCK, SYSIC, and ZP2SYS.
  8.  
  9. function sys = nd2sys(num,den,gain)
  10.   if nargin < 2
  11.     disp('usage: sys = nd2sys(num,den,gain)');
  12.     return
  13.   end
  14.   if length(num) > length(den)
  15.     error('numerator order is larger than denominator order');
  16.     return
  17.   else
  18.     if nargin == 2
  19.       [a,b,c,d] = tf2ss(num,den);
  20.       sys = pck(a,b,c,d);
  21.     else
  22.       [a,b,c,d] = tf2ss(num,den);
  23.       sys = pck(a,b,c,d);
  24.       sys = mscl(sys,gain); 
  25.     end
  26.   end
  27. %
  28. % Copyright MUSYN INC 1991,  All Rights Reserved
  29.