%% Compare Exponentials
% Compute and compare the exponential of A with the matrix exponential of A.

A = [1 1 0; 0 0 2; 0 0 -1];
exp(A)

%

expm(A)

% Notice that the diagonal elements of the two results are equal, which is true for any triangular matrix. The off-diagonal elements, including those below the diagonal, are different.
% Copyright 2015 The MathWorks, Inc.