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

  1. % function discout = samhld(sys,T)
  2. %
  3. %   SAMHLD applies a sample-hold to the input of the continuous 
  4. %   time systems SYS, and samples the output, to produce a 
  5. %   discrete time system, DISCOUT. The sampling time is the 
  6. %   same at the input and output, and is specified by T.
  7. %
  8. %   See also: EXP, EXPM, and TUSTIN.
  9.  
  10. function discout = samhld(sys,st)
  11.  if nargin < 2
  12.    disp('usage: discout = samhld(sys,st)')
  13.    return
  14.  end
  15.  
  16.  [systype,sysrows,syscols,sysnx] = minfo(sys);
  17.  if systype == 'cons'
  18.    discout = sys;
  19.  elseif systype == 'vary'
  20.    error('the input matrix should be a SYSTEM or CONSTANT matrix')
  21.    return
  22.  elseif systype == 'syst'
  23.    if sysnx == 0
  24.     discout = sys;
  25.    else
  26.      [a,b,c,d] = unpck(sys);
  27.      ab = [a*st b*st;zeros(syscols,sysnx+syscols)];
  28.      eab = expm(ab);
  29.      ad = eab(1:sysnx,1:sysnx);
  30.      bd = eab(1:sysnx,sysnx+1:sysnx+syscols);
  31.      discout = pck(ad,bd,c,d);
  32.    end
  33.  end
  34. %
  35. % Copyright MUSYN INC 1991,  All Rights Reserved
  36.