-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsim_eigen_maze.m
51 lines (40 loc) · 920 Bytes
/
sim_eigen_maze.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function h = sim_eigen_maze(plt_nr,plt_nc,plt_np)
do_plot = 1;
eignums = [15 20 32];
A = run(eignums);
if ~do_plot
return;
end
%--------------------------------------------------------------------------
if nargin<1
close all;
plt_nr = 1;
plt_nc = 3;
plt_np = 1:3;
fsiz = [0.3536 0.6907 0.6 0.2204];
figure; set(gcf,'units','normalized'); set(gcf,'position',fsiz);
end
%----------------------
for i= 1:length(A)
h(i) = subplot(plt_nr,plt_nc,plt_np(i));
imagesc(A{i});
set(gca,'xtick',[],'ytick',[],'box','on');
end
end
function A = run(eignums)
n = 50;
I = n;
J = n;
[T, xy] = core_griding(I,J);
c= .1*ones(size(T,1),1);
D = (diag(exp(c))-T)^-1;
i = max(eignums);
[U,~] = eigs(D,i);
idx = sub2ind([n n],xy(:,1),xy(:,2));
A = cell(1,length(eignums));
for i=1:length(eignums)
Ap = zeros(n,n);
Ap(idx) = U(:,eignums(i));
A{i} = Ap;
end
end