home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / MATFUN.DI$ / EXPM2.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  456 b   |  19 lines

  1. function E = expm2(A)
  2. %EXPM2    Matrix exponential via Taylor series.
  3. %    E = expm2(A) illustrates the classic definition for the
  4. %    matrix exponential.  As a practical numerical method,
  5. %    this is often slow and inaccurate.
  6. %    See also EXPM, EXPM1, EXMP3.
  7.  
  8. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  9.  
  10. % Taylor series for exp(A)
  11. E = zeros(size(A));
  12. F = eye(size(A));
  13. k = 1;
  14. while norm(E+F-E,1) > 0
  15.    E = E + F;
  16.    F = A*F/k;
  17.    k = k+1;
  18. end
  19.