-
Notifications
You must be signed in to change notification settings - Fork 7
/
F_CS_SOFT.m
59 lines (49 loc) · 1.04 KB
/
F_CS_SOFT.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
function [P_output eu] = F_CS_SOFT(L, K, S, Beta,lambda)
eu=2;
sigma=0;
P = zeros(L, K);
beta_2=zeros(K,L);
for l=1:L
for k=1:K
beta_2(k,l)=Beta(k,l,l)^2;
end
end
% for k=1:K
% sigma=sigma+beta_2(k,1);
% end
%
% sigma=sigma/k*lambda;
%
% for k=1:K
% if beta_2(k,1)<sigma
% eu=eu+1;
% end
% end
% for l=1:L
% [v pos]=sort(beta_2(:,l));
% max_pos=pos(K-eu+1:K);
% for i=1:eu
% P(l,max_pos(i))=-1;
% end
% end
for l=1:L
[v pos]=sort(beta_2(:,l));
min_pos=pos(1:eu);
for i=1:eu
P(l,min_pos(i))=100+i;
end
end
for i = 1:L % random pilot assignment
temp = randperm(S);
eum=0;
for k=1:K
if P(i,k) == -1
eum=eum+1;
end
if P(i,k) == 0
P(i,k) = temp(k-eum);
end
end
end
P_output = P;
end