Skip to content

Instantly share code, notes, and snippets.

@gajomi
Created May 28, 2014 16:27
Show Gist options
  • Save gajomi/1f08e73581cc09752382 to your computer and use it in GitHub Desktop.
Save gajomi/1f08e73581cc09752382 to your computer and use it in GitHub Desktop.
Structured matrix eigenvalue clusters
%params
N = 512;
k = 128;
p = .5;
%form block clustered matrix
A = rand(N,N)>p;%or randn(N,N) also
B = diag([50*ones(1,k) 1*ones(1,N-k)]);
C = A+B;
%compute spectrum
E = eig(C);
%plot stuff
figure(1)
subplot(211)
imagesc(C)
subplot(212)
plot(E,'o')
axis(equal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment