can any one tell me how to make every 1 subcarrier take 2 user ?

4 次查看(过去 30 天)
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);

回答(1 个)

Sufiyan
Sufiyan 2023-3-30
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);

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by