can any one tell me how to make every 1 subcarrier take 2 user ?
    1 view (last 30 days)
  
       Show older comments
    
N=128;  % number of subcarriers
K=4;    % number of users
SINR = 20;  % SINR in dB (average)
% SINR = 10 log10(Signal power / Noise power)
% sigma squared = sigma2 = (Noise power / Signal Power)
% SINR = 10 log10(1 / sigma2) = -10 log10(sigma2)
sigma2 = 10^(-SINR/10);
channel_gain = rand(N,K)*2;
g = channel_gain;
a = zeros(N,K);
subcarrier_allocation = zeros(128,1);
% Initialize allocation
% Assume only 1 user can have every subcarrier
for count = 1:128
    [Max_g,user] = max(g(count,:));
    subcarrier_allocation(count) = user;
    a(count, user) = 1;
end
Ptotal = 1;
[rate_user, power_user] = waterfilling(1,a,g,Ptotal,N);
utility(1) = sum(rate_user);
0 Comments
Answers (1)
  Sufiyan
    
 on 30 Mar 2023
        Hi,
You can refer to the code below
N=128;  % number of subcarriers
K=4;    % number of users
SINR = 20;  % SINR in dB (average)
sigma2 = 10^(-SINR/10);
channel_gain = rand(N,K)*2;
g = channel_gain;
a = zeros(N,K);
subcarrier_allocation = zeros(128,1);
% Initialize allocation
% Assume only 1 user can have every subcarrier
for count = 1:2:N
    [Max_g,user] = max(g(count,:));
    subcarrier_allocation(count) = user;
    a(count, user) = 1;
    % Assign the next user to the same subcarrier
    [Max_g,user] = max(g(count+1,:));
    subcarrier_allocation(count+1) = user;
    a(count+1, user) = 1;
end
Ptotal = 1;
[rate_user, power_user] = waterfilling(1,a,g,Ptotal,N);
utility(1) = sum(rate_user);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
