MATLAB代做|FPGA代做|simulink代做——小区同频干扰源码.建立基站、设置功率传输比

发布时间:2021/2/21 浏览数:1219
%CELLULAR _PARAMETERS
%===== Pre-defined simulation parameters ==========================
r_cell = 1000; % cell radius (in meters)
n_co_ch_users = 6; % number of co-channel users
P_BS = 0; % BS transmitter power (in dBW)
P_MS = 0; % MS transmitter power (in dBW)
corr_fwd = 0.0; % correlation coefficient - forward link
corr_rev = 0.0; % correlation coefficient - reverse link
K = 1; % constant in the link equation
in_beam = 0; % maximum gain of sectorized antennas (in dB)
%
% --- Limits (angles) of each sector ---
%%
sector_min = zeros(6,3);
sector_max = zeros(6,3);
sector_min(:,1) = (pi/3)*[-3:2]';
sector_min([1:3],2) = pi/3*[-3 -1 1]';
sector_min(1,3) = -pi;
sector_max(:,1) = sector_min(:,1) + pi/3;
sector_max([1:3],2) = sector_min([1:3],2) + 2*pi/3;
sector_max(1,3) = pi;
%
% --- Center of each sector ----
phi_center = zeros(6,3);
phi_center(:,1) = (pi/3)*[-3:2]';
phi_center([1:3],2) = (pi/3)*[-3 -1 1]';
%
% --- Beamwidth of each sector ---
phi_BW = [1 2 6]*pi/3;
%
% --- Number of sectors -----
num_sectors = [6 3 1];
%
% ===== User Inputs =========================================
num_snapshots = input('Number of snapshots = ');
cluster_size = input('Cluster size (3, 4 or 7) = ');
n_path = input('Path loss exponent = ');
sigma_int = input('Shadowing std deviation - interference (dB) = ');
sigma_S = input('Shadowing std deviation - desired signal (dB) = ');
sec = input('Sectorization(1=>60 degree, 2=>120 degree, 3=>omni). enter: ');
ftb = input('Front-to-back ratio of the BS antennas (dB) = ');
out_beam = in_beam - ftb;
% End of script file.
% Location of base stations (center cell is located at x = 0, y = 0)
% Location (angular) of the center cell of each cluster in the
% first tier.
theta_N = [pi/6 0 pi/6 atan(2/sqrt(3))];
% Angular distance between the center cells of all 6 clusters in
% first tier.
theta = pi/3*[0:5]';
aux_1 = [1 0 2 3 0 0 4];
ind = aux_1(cluster_size);
% Location [x,y] of the center cells of all clusters in the
% first tier.
bs_position = [sqrt(3*cluster_size)*r_cell*cos(theta + theta_N(ind)) sqrt(3*cluster_size)*r_cell*sin(theta + theta_N(ind))];
plot(bs_position(:,1),bs_position(:,2),'d'); grid on
 
SIRodB = [0:40];
SIRo = 10.^(SIRodB./10);
for j=1:length(SIRodB)
for i=1:num_snapshots
% Determination of the sector to simulated in this snapshot
%
% --- Select (randomly) a sector ---
sector = unidrnd(num_sectors(sec));
%
% --- Place the desired mobile within the select sector ---
des_user_beta = rand(1)*phi_BW(sec) + phi_center(sector,sec);
des_user_r = sqrt(rand(1).*(r_cell^2));
%
% --- Place co-channel mobiles within the selected sector of
% co-channel cells---
co_ch_user_beta = rand(6,1)*phi_BW(sec) + phi_center(sector,sec);
co_ch_user_r = sqrt(rand(6,1))*(r_cell);
 
des_user_position = des_user_r*[cos(des_user_beta) sin(des_user_beta)];
co_ch_user_position = [co_ch_user_r.*cos(co_ch_user_beta) co_ch_user_r.*sin(co_ch_user_beta)] + bs_position;
 
% --- DESIRED USER ---
m_S_fwd = P_BS - 10*K*n_path*log10(des_user_r);
%
% --- CO-CHANNEL USERS ---
% --- Location of desired mobile with respect to
% co-channel cells ---
aux_01 = ((des_user_position(1) - bs_position(:,1))+ sqrt(-1)*(des_user_position(2) - bs_position(:,2)));
beta_fwd = angle(aux_01);
d_I_fwd = abs(aux_01);
% --- Computation of antenna gain at co-channel cells
clear gain_fwd
for k = 1:n_co_ch_users
if (beta_fwd(k) >= sector_min(sector,sec)) & (beta_fwd(k) < sector_max(sector,sec))
gain_fwd(k) = in_beam;
else
gain_fwd(k) = out_beam;
end
end
% --- Computation of mean value and standard deviation ---

m_I_fwd = P_BS - 10*K*n_path*log10(d_I_fwd) + gain_fwd.';




sigma_I_fwd = sigma_int*ones(length(m_I_fwd),1);
[m_I_total_fwd, sigma_I_total_fwd] =wilkinson(m_I_fwd,sigma_I_fwd,corr_fwd);
 
m_SIR_fwd = m_S_fwd - m_I_total_fwd;
sigma_SIR_fwd = sqrt(sigma_S^2 + sigma_I_total_fwd^2 -2*corr_fwd*sigma_S*sigma_I_total_fwd);
 
m_SIR_fwd0 = 10^(m_SIR_fwd/10);
sigma_SIR_fwd0 = 10^(sigma_SIR_fwd/10);
term = (SIRo(j) - m_SIR_fwd0)/sigma_SIR_fwd0;
Poutage(i) = 1-erf(-term); %we obtain a sample of outage probability.
end
avgPout(j) = mean(Poutage)/2;
end
plot(SIRodB,100.*avgPout);
axis([0 40 0 100]);
grid on
figure,hist(SIRodB,100.*avgPout)
axis([-50 150 0 5]);
grid on
 

联系:highspeedlogic

QQ :1224848052

微信:HuangL1121

邮箱:1224848052@qq.com

网站:http://www.mat7lab.com/

网站:http://www.hslogic.com/

微信扫一扫:


Copyright 2017-2024 © 嘉兴麦特莱博软件开发工作室
  • 网站备案号:浙ICP备18008591号-1