Please, would you tell me if this code is CORRECT or NOT to measure the path loss, and the SNR ?
1 次查看(过去 30 天)
显示 更早的评论
I just wanted to make sure if this code correct to measure the path loss and SNR specifically to use the euclidean distance between ground Base Station (gNB ) and the associated users (NumUEs).
%%%%Pathloss between gNB and users
function [Lgnb_ue,R_UE,SNR] = PL_gNBUE (NumUEs,distance,theta1,PLOS)
NumUEs=100; % number of users
R=500; % raduis of ground Base station
fc=10e9; % operating frequency
c=3e8; % light speed
h_gNB=35; % Height of ground Base station
h_ue = 1.5; % height of user
delta_h = h_gNB - h_ue; % difference between user's height and ground base station
%distance between the ground base station and associated users
distance=sqrt(unifrnd(0,R^2,[1,NumUEs])); % Distances of users from the ground Base station
distance=sort(distance); % arrange the elements of array asendingly
theta1 = 180/pi*(atan(delta_h./distance));
b =0.3511; % envirnment parameters
a = 5.0188;% envirnment parameters
eta_los1 =1.0;% envirnment parameters
eta_nlos1 =20;% envirnment parameters
PLOS = 1./(1+a.*exp(-b.*(theta1)-a));
PNLOS = 1-PLOS
Lgnb_ue= 20*log(4*pi*fc/c)+ PLOS*eta_los1 + PNLOS*eta_nlos1;
GT = 15; %dbi transmit antenna gain if its omni direction should be zero
PL_gNBUE = Lgnb_ue.*(1/10^(GT/10));
figure
plot(distance, PL_gNBUE,'b');
%plot(d, Lgnb_ue); % parthloss between gNB and UEs
grid on
hold off
xlabel('distance in meter');
ylabel('pathloss in dB');
PgNB = 46;% power in watt %watts = 10^((dbm-30)/10)
Pue= PgNB./NumUEs;
BW = 20e6;
BWaccess =BW/2;
UE_PL = PL_gNBUE.*(1/10^(GT/10));
Rx_RBs_gNBUE = Pue-UE_PL;
Nf=9;
N_therDencity = -101;
N_power = (10.^(N_therDencity./10)./1000).*BWaccess*Nf; %dB thermal noise power for each RB
SNR = Rx_RBs_gNBUE./N_power;
SNR = 10*log10(SNR);
%SNR= mag2db(SNR); %dB
%SNR= db2mag(SNR); %dB
figure
plot(SNR);
xlabel('NumUEs');
ylabel('SNR [dB]');
hold on
grid on
figure
R_UE= ((BWaccess./NumUEs) .*log2(1+SNR))./10^6
%R_UE = R_UE./e6;
plot(R_UE);
xlabel('NumUEs');
ylabel('R_UE [Mbps]');
hold off
grid on
end
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!