%Generates matrix with known eigen values
function [A] = genMatWithEV(E)
n=size(E,1); 
D=diag(E);%Create diagonal matrix with eigen values in it
G=-1+2.0.*rand(n); %Create a random matrix
[Q, R]=qr(G); %Do a QR to get the Q - orthogonal matrix
A = Q*D*Q'; %QDQ' gives a matrix whose eigen values are the same as D
end