vendredi 30 janvier 2015

how to associate user to a nearest base station

This is the code in MATLAB to generate base station locations in a Voronoi tesselation but I need to generate users and to associate each user to a nearest base station.


Please help me and thanks in advance.



function [X Y init_n] = generate_ppp_square(params, lambda, r_total)

%%% generate a PPP in a square of dimensions 2r*2r centered at (0,0)
%assignparams;

lambda =0.1;
r_total =10;
cell_area = (2*r_total)^2;
init_n = poissrnd(lambda*cell_area);

%init_n = ceil(lambda*cell_area);
%UserPoints = sqrt(cell_area)*rand(init_n,2);
X = -r_total + 2*r_total*rand(init_n,1)
Y = -r_total + 2*r_total*rand(init_n,1)
voronoi(X,Y,'o');hold on




Aucun commentaire:

Enregistrer un commentaire