Is the following method of calculating SINR correct

18 views (last 30 days)
Syed
Syed on 5 May 2017
Commented: omar th on 19 Jan 2022
Hi all,
I am trying to implement device-to-device discovery technique. I have written a code for that purpose. I am a bit unsure about the way I have calculated SINR. Can someone spare some moments and let me know if I am right or not?
The following is the code: Loof for the comments of interference vector in particular.
%%constant / parameters
freq = 2e9; wavelength = (3e8)/freq;
Noise_dB = -121; %dB Noise = 10^(Noise_dB/10);
SINR_th = 2.5;
N_RB = 44; % Number of resrouce blocks
N_Time_slots = 64; % Number of time slots. Total Resources = N_RB * N_Time_slots
Pmax = -7;%dB (23 dBm)
Rd = 500; % Radius of cirular region aroung device
tagged_user = 0 + 0i;
tic;
N_devices = 100;
% There are 'N_devices' devices in total,
%Transmit power of 'N_devices-1' devices.
Pt = ones(1, N_devices-1)*Pmax;
users_pos = gen_d2d_devices(tagged_user, N_devices-1, Rd);
DUE_pos = [real(users_pos); imag(users_pos)]';
d = abs(users_pos); %Since location of tagged user is at origin
D = d./1000; % meters to KM, since the formula below uses distance in km
PL = 135.5 + 40*log10(D);
Pr = zeros(1, N_devices-1);
discovered_devices = zeros(1,N_devices-1);
%Discovery periods from 1 -> tot_of_disctime
for td = 1:tot_of_disctime
% RB allocation => Frequency + 1j*time
RA_a = randi([1,N_RB], 1, N_devices) + randi([1,N_Time_slots], 1, N_devices).*1i;
RA1 = RA_a(1);
RA_a(1) = [];
Pr = Pt - PL;
%dB to linear scale
Pr_a = 10.^(Pr/10);
%Interference vector
I = zeros(1, N_devices-1);
%Making Interference vector: All devices that transmit in the same RB interfere
for ii=1:N_devices-1
for jj = 1 : N_devices-1
if(ii == jj)
continue
else
if(RA_a(ii) == RA_a(jj))%if(RA(ii) == RA(jj))
I(ii) = I(ii) + Pr_a(jj);
else
continue;
end
end
end
end
%Total Received power, including Interference.
PrA = Pr_a + I;
%Calculate SINR
SINR = PrA ./ (Noise + I);
valid_devices = 10*log10(SINR)>SINR_th;
%half duplexing
SameBTUFRAME = imag(RA1) == imag(RA_a);
discovered_devices = discovered_devices | and(valid_devices,not(SameBTUFRAME));
Discovery_ratio(td) = sum(discovered_devices) / (N_devices-1);
end
mean_discovery1 = mean(Final_discovery1);

Answers (1)

Raman Kaur
Raman Kaur on 5 Oct 2018
Hi Did this work? i am also working on Sinr..Please help
  3 Comments
omar th
omar th on 19 Jan 2022
@Syed please, would you share your code of sinr with us if it is worked ?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!