Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user location assignment #1

Open
muhammetp opened this issue Jul 29, 2019 · 1 comment
Open

user location assignment #1

muhammetp opened this issue Jul 29, 2019 · 1 comment

Comments

@muhammetp
Copy link

for i = 1:L % k-th user in the j-th cell to i-th BS
for j = 1:L
for k = 1:K
x1 = BaseP(i,1);
y1 = BaseP(i,2);
% x2 = random('unif', 0, 2R_Cell, 1, 1);
% y2 = random('unif', 0, 2
R_Cell, 1, 1);
% while ((x2-R_Cell)^2+(y2-R_Cell)^2>R_Cell^2) || ((x2-R_Cell)^2+(y2-R_Cell)^2<r_Min^2)
% x2 = random('unif', 0, 2R_Cell, 1, 1);
% y2 = random('unif', 0, 2
R_Cell, 1, 1);
% end
x2 = random('unif', -R_Cell, R_Cell, 1, 1);
y2 = random('unif', -R_Cell, R_Cell, 1, 1);
while ((x2)^2 + (y2)^2 > R_Cell^2) || ((x2)^2 + (y2)^2 < r_Min^2)
x2 = random('unif', -R_Cell, R_Cell, 1, 1);
y2 = random('unif', -R_Cell, R_Cell, 1, 1);
end
x2 = x2 + BaseP(j,1);
y2 = y2 + BaseP(j,2);
r = sqrt((x1-x2)^2+(y1-y2)^2); % distance between UE and BS
z = 10^(random('norm', 0, 10^(sigma_shadow/20), 1, 1)/10);
Beta(k,i,j) = z/((r/R_Cell)^alpha+1);
H(:,k,i,j) = sqrt(Beta(k,i,j))1/sqrt(2)(random('norm', 0, 1, 1, M)+random('norm', 0, 1, 1, M)*1j);
end
end
end

As you can all users in all cell positions are updated for each base station H and Beta calculation. However, This positions must have been to fixed for each each base station H and Beta so
% k-th user in the j-th cell to i-th BS
for j = 1:L
for k = 1:K
for i = 1:L

@muhammetp
Copy link
Author

Corrected for loop must have been like that
for j = 1:L
for k = 1:K

        x2 = random('unif', -R_Cell, R_Cell, 1, 1);
        y2 = random('unif', -R_Cell, R_Cell, 1, 1);

        while ((x2)^2 + (y2)^2 > R_Cell^2) || ((x2)^2 + (y2)^2 < r_Min^2)
        x2 = random('unif', -R_Cell, R_Cell, 1, 1);
        y2 = random('unif', -R_Cell, R_Cell, 1, 1);
        end

        x2 = x2 + BaseP(j,1);
        y2 = y2 + BaseP(j,2);

        for i = 1:L
             x1 = BaseP(i,1);
             y1 = BaseP(i,2);
             r = sqrt((x1-x2)^2+(y1-y2)^2); % distance between UE and BS
             z = 10^(random('norm', 0, 10^(sigma_shadow/20), 1, 1)/10);
             Beta(k,i,j) = z/((r/R_Cell)^alpha+1);
             H(:,k,i,j) = sqrt(Beta(k,i,j))1/sqrt(2)(random('norm', 0, 1, 1, M)+random('norm', 0, 1, 1, 
              M)*1j);
         end

end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant