%% Matrix Exponents
% Create a 2-by-2 matrix and use it as the exponent for a scalar.

B = [0 1; 1 0];
C = 2^B

%
% Compute C by first finding the eigenvalues D and eigenvectors V of the matrix B.

[V,D] = eig(B)

%
% Next, use the formula 2^B = V*2^D/V to compute the power.

C = V*2^D/V

% Copyright 2012 The MathWorks, Inc.