how to compute optimal power allocation for sum rate maximization using NOMA scheme to allocate two different power levels to two users with different distances

21 次查看(过去 30 天)
I need to create a cell with two users (user1(near user) & user2(far user) and compute 100 sum rates of user1 and user2 within the cell. The code will generate the different distributions of the two users in a cell. I need a loop that will generate 100 different sum rates for user1 & user2 having different distances and power coefficients (alpha1 & alpha2) within a cell. I attached the codes for a single sum rate for user1 & user2 below. Many thanks
clc; clear variables; close all;
N = 10^5; % number of channel realization
df = 5000; dn = 1000; %Distances of user1& user2 (df=distance of far user1 and dn=distance of near user2)
eta = 4;
% compute the Raileigh fading coefficent for near user1
hf = sqrt(df^-eta)*(randn(1,N) + 1i*randn(1,N))/sqrt(2);
hn = sqrt(dn^-eta)*(randn(1,N) + 1i*randn(1,N))/sqrt(2);
gf = (abs(hf)).^2; %channel gain of far user1
gn = (abs(hn)).^2; %channel gain of near user2
R1 = 1; %Target rate bps/Hz
epsilon = (2^(R1))-1; %Target SINR
%Transmit power
Pt = 0:30;
pt = (10^-3)*db2pow(Pt);
%Noise power
No = -114;
no = (10^-3)*db2pow(No);
for u = 1:length(pt)
a1 = epsilon*(no + pt(u)*gf)./(pt(u)*gf*(1+epsilon));
a1(a1>1) = 0;
a2 = 1 - a1;
%Sum rate of fair PA
C1 = log2(1 + pt(u)*a1.*gf./(pt(u)*a2.*gf + no));
C2 = log2(1 + pt(u)*a2.*gn/no);
C_sum(u) = mean(C1+C2); %cummulative sum rate
end
plot(Pt,C_sum,'linewidth',1.5);
legend('Fair PA \alpha_1 = 0.75, \alpha_2 = 0.25')
xlabel('Transmit power (dBm)');
ylabel('Sum rate (bps/Hz)');

回答(1 个)

Felix Obite
Felix Obite 2022-10-24
Hi zolani, you can have a look at the attached file.

类别

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