-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode.m
More file actions
53 lines (48 loc) · 1.37 KB
/
code.m
File metadata and controls
53 lines (48 loc) · 1.37 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
% a = []
% for i= 1:1:25
% for j= i+1:1:25
% a = [a [i;j;corr(s(:,i),s(:,j))]]
% end
% end
% M1 = csvread('mat1.csv',1,1);
% M2 = csvread('mat2.csv',1,1);
% M1 = M1.';
% M2 = M2.';
% cov_M1 = cov(M1);
% cov_M2 = cov(M2);
% [A,D] = eig(cov_M1,cov_M1+cov_M2);
% [right_coeff,right_index] = sort(A(1:22,25),'descend');
% [left_coeff,left_index] = sort(A(1:22,1),'descend');
right_channels = []
left_channels = []
for i = 1:1:100
temp_M1 = []
t = randperm(63, 44)
for j = 1:1:44
if(t(j)==1)
temp_M1=[temp_M1;M1(1:(t(j)*1375),:)];
else
disp(t(j))
temp_M1=[temp_M1;M1((t(j)-1)*1375+1:(t(j)-1)*1375+1375,:)];
end
end
temp_M2 = []
t = randperm(63, 44);
for j = 1:1:44
if(t(j)==1)
temp_M2=[temp_M2;M2(1:(t(j)*1375),:)];
else
temp_M2=[temp_M2;M2((t(j)-1)*1375+1:(t(j)-1)*1375+1375,:)];
end
%temp_M1 = []M1(randperm(msize, 1106892))
end
cov_M1 = cov(temp_M1);
cov_M2 = cov(temp_M2);
[A,D] = eig(cov_M1,cov_M1+cov_M2);
[right_coeff,right_index] = sort(A(1:22,25),'descend');
[left_coeff,left_index] = sort(A(1:22,1),'descend');
right_channels = [right_channels; (right_index.')];
left_channels = [left_channels; (left_index.')];
end
csvwrite('right_channel.csv',right_channels)
csvwrite('left_channel.csv',left_channels)