% Matlab Self Paced example: File = evplot.m
% Plot the eigenvalues of an n by n real matrix
% As matrix is real, eigenvlaues are either real
% or occur in complex conjugate pairs

% Dimension of matrix
n = 100

% n by n matrix with each element a sample from
% the standard normal distribution N(0, 1)
A = randn(n);

% Eigenvalues of the matrix A
ev = eig(A);

% Plot real part against imaginary part of eigenvalues
figure(1)
plot(ev, '*');
grid on
tstr = sprintf('%d eigenvalues of a real matrix with elements from N(0,1)', n);
title(tstr)
xlabel('Real part');
ylabel('Imaginary part')
axis equal