Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
wamedh naseer
wamedh naseer am 3 Sep. 2022
Beantwortet: Sufiyan am 30 Mär. 2023
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);

Antworten (1)

Sufiyan
Sufiyan am 30 Mär. 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);

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by