-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprecoder_select_ver4.m
96 lines (90 loc) · 3.06 KB
/
precoder_select_ver4.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%filename:precoder_select_ver4.m
function [F] = precoder_select_ver4(H,nS,getIndex)
j=sqrt(-1);
%LTE-A codebook
u=[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1;
-1, -j, 1, j, (-1-j)/sqrt(2), (1-j)/sqrt(2), (1+j)/sqrt(2), (-1+j)/sqrt(2), -1, -j, 1, j, -1, -1, 1, 1;
-1, 1, -1, 1, -j, j, -j, j, 1, -1, 1, -1, -1, 1, -1, 1;
-1, j, 1, -j, (1-j)/sqrt(2), (-1-j)/sqrt(2),(-1+j)/sqrt(2),(1+j)/sqrt(2), 1, -j, -1, j, 1, -1, -1, 1];
W=zeros(4,4,16);
W(:,:,1)=eye(4)-(2*u(:,1)*(u(:,1)'))/((u(:,1)')*u(:,1));
W(:,:,2)=eye(4)-(2*u(:,2)*(u(:,2)'))/((u(:,2)')*u(:,2));
W(:,:,3)=eye(4)-(2*u(:,3)*(u(:,3)'))/((u(:,3)')*u(:,3));
W(:,:,4)=eye(4)-(2*u(:,4)*(u(:,4)'))/((u(:,4)')*u(:,4));
W(:,:,5)=eye(4)-(2*u(:,5)*(u(:,5)'))/((u(:,5)')*u(:,5));
W(:,:,6)=eye(4)-(2*u(:,6)*(u(:,6)'))/((u(:,6)')*u(:,6));
W(:,:,7)=eye(4)-(2*u(:,7)*(u(:,7)'))/((u(:,7)')*u(:,7));
W(:,:,8)=eye(4)-(2*u(:,8)*(u(:,8)'))/((u(:,8)')*u(:,8));
W(:,:,9)=eye(4)-(2*u(:,9)*(u(:,9)'))/((u(:,9)')*u(:,9));
W(:,:,10)=eye(4)-(2*u(:,10)*(u(:,10)'))/((u(:,10)')*u(:,10));
W(:,:,11)=eye(4)-(2*u(:,11)*(u(:,11)'))/((u(:,11)')*u(:,11));
W(:,:,12)=eye(4)-(2*u(:,12)*(u(:,12)'))/((u(:,12)')*u(:,12));
W(:,:,13)=eye(4)-(2*u(:,13)*(u(:,13)'))/((u(:,13)')*u(:,13));
W(:,:,14)=eye(4)-(2*u(:,14)*(u(:,14)'))/((u(:,14)')*u(:,14));
W(:,:,15)=eye(4)-(2*u(:,15)*(u(:,15)'))/((u(:,15)')*u(:,15));
W(:,:,16)=eye(4)-(2*u(:,16)*(u(:,16)'))/((u(:,16)')*u(:,16));
F4=zeros(4,4,16);
F4(:,:,1)=W(:,[1 2 3 4],1);
F4(:,:,2)=W(:,[1 2 3 4],2);
F4(:,:,3)=W(:,[3 2 1 4],3);
F4(:,:,4)=W(:,[3 2 1 4],4);
F4(:,:,5)=W(:,[1 2 3 4],5);
F4(:,:,6)=W(:,[1 2 3 4],6);
F4(:,:,7)=W(:,[1 3 2 4],7);
F4(:,:,8)=W(:,[1 3 2 4],8);
F4(:,:,9)=W(:,[1 2 3 4],9);
F4(:,:,10)=W(:,[1 2 3 4],10);
F4(:,:,11)=W(:,[1 3 2 4],11);
F4(:,:,12)=W(:,[1 3 2 4],12);
F4(:,:,13)=W(:,[1 2 3 4],13);
F4(:,:,14)=W(:,[1 3 2 4],14);
F4(:,:,15)=W(:,[3 2 1 4],15);
F4(:,:,16)=W(:,[1 2 3 4],16);
F2=zeros(4,2,16);
F2(:,:,1)=W(:,[1 4],1);
F2(:,:,2)=W(:,[1 2],2);
F2(:,:,3)=W(:,[1 2],3);
F2(:,:,4)=W(:,[1 2],4);
F2(:,:,5)=W(:,[1 4],5);
F2(:,:,6)=W(:,[1 4],6);
F2(:,:,7)=W(:,[1 3],7);
F2(:,:,8)=W(:,[1 3],8);
F2(:,:,9)=W(:,[1 2],9);
F2(:,:,10)=W(:,[1 4],10);
F2(:,:,11)=W(:,[1 3],11);
F2(:,:,12)=W(:,[1 3],12);
F2(:,:,13)=W(:,[1 2],13);
F2(:,:,14)=W(:,[1 3],14);
F2(:,:,15)=W(:,[1 3],15);
F2(:,:,16)=W(:,[1 2],16);
diag_min_of_max=10000;
if nS==4
for ii=1:16
invHF=inv(H*F4(:,:,ii));
r=[norm(invHF(1,:)) norm(invHF(2,:)) norm(invHF(3,:)) norm(invHF(4,:))];
if diag_min_of_max>max(r)
diag_min_of_max=max(r);
min_idx=ii;
end
end
if getIndex == 1
F = min_idx;
else
F=F4(:,:,min_idx);
end
elseif nS==2
for ii=1:16
HF=H*F2(:,:,ii);
pinvHF=(HF'*HF)\HF';
r=[norm(pinvHF(1,:)) norm(pinvHF(2,:))];
if diag_min_of_max>max(r)
diag_min_of_max=max(r);
min_idx=ii;
end
end
if getIndex == 1
F = min_idx;
else
F=F2(:,:,min_idx);
end
end