-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdemo8.m
More file actions
53 lines (37 loc) · 1.11 KB
/
demo8.m
File metadata and controls
53 lines (37 loc) · 1.11 KB
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
52
53
clear all
close all
clc
% create time series grid as graph
n=101;
W=zeros(n,n);
for i=1:n-1
W(i,i+1)=1;
W(i+1,i)=1;
end
W(1,n)=1;
W(n,1)=1;
% calculate combinatorial Laplacian Matrix
d = sum(W,2);
L = diag(d)-W;
% calculate basis
[u v]=eig(L);
% make eignevalue as vector
v=diag(v);
v(v<0)=0;
% get maximum eigenvalue
lmax=max(v);
nv=linspace(0,2,21);
basis=bspline_basis(21, nv,v, 3);
nu=u*basis;
figure;subplot(2,3,1);plot(u(:,5));ylim([-0.15 0.15]);xlim([1 101]);
title(['5th eigenvector, value=' num2str(v(5))]);
subplot(2,3,2);plot(u(:,11));ylim([-0.15 0.15]);xlim([1 101]);
title(['11th eigenvector, value=' num2str(v(11))]);
subplot(2,3,3);plot(u(:,end));ylim([-0.15 0.15]);xlim([1 101]);
title(['last eigenvector, value=' num2str(v(end))]);
subplot(2,3,4);plot(nu(:,5));xlim([1 101]); %ylim([-0.15 0.15]);
title(['5th eigenvector, value=' num2str(nv(5))]);
subplot(2,3,5);plot(nu(:,11));xlim([1 101]); %ylim([-0.15 0.15]);
title(['11th eigenvector, value=' num2str(nv(11))]);
subplot(2,3,6);plot(nu(:,end));xlim([1 101]); %ylim([-0.15 0.15]);
title(['last eigenvector, value=' num2str(nv(end))]);