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

  1. function [Phi, Gamma] = c2d(a, b, t)
  2. %C2D    Conversion of state space models from continuous to discrete time.
  3. %    [Phi, Gamma] = C2D(A,B,T)  converts the continuous-time system:
  4. %        .
  5. %        x = Ax + Bu
  6. %
  7. %    to the discrete-time state-space system:
  8. %
  9. %        x[n+1] = Phi * x[n] + Gamma * u[n]
  10. %
  11. %    assuming a zero-order hold on the inputs and sample time T.
  12. %
  13. %    See also: C2DM, and D2C.
  14.  
  15. %    J.N. Little 4-21-85
  16. %    Copyright (c) 1986-93 by the MathWorks, Inc.
  17.  
  18. error(nargchk(3,3,nargin));
  19. error(abcdchk(a,b));
  20.  
  21. [m,n] = size(a);
  22. [m,nb] = size(b);
  23. s = expm([[a b]*t; zeros(nb,n+nb)]);
  24. Phi = s(1:n,1:n);
  25. Gamma = s(1:n,n+1:n+nb);
  26.