Monday, 25 July 2011

GENERATING HEXAGONAL CELL SITE WITH RANDOM USERS IN MATLAB


This code will generate Hexagonal Cell Site in Matlab.
I’d used this Cell generation code in one of my Projects in which I’d to perform Monte Carlo simulationwith users being generated in a hexagonal cell site
In this code, the cell radius was 1.4 units.
You can alter this. For eg. If your cell radius needs to be 1 unit then replace
1.40 by 1
2.42 (1.4 x 1.732) by 1.732 (1 x 1.732)
1.21 (1.4 x 0.866) by 0.866 (1 x 0.866)
2.10 (1.4 x 1.500) by 1.500 (1 x 1.500)
Also adjust xa, xb, ya & yb accordingly.
01% Yogesh Mhatre || IGOY.IN
02clc;
03clear all;
04%close all;
05 
06%Generating a hexagon with centre (0,0)and radius 1.4
07 
08t=linspace(0,2*pi,7);
09ahx=0+1.4*cos(t);
10bhx=0+1.4*sin(t);
11plot(ahx,bhx);
12plot(0,0,'ro');
13grid on
14hold on
15 
16% To generate 6 adjacent hexagon
17 
18a1=0+1.4*cos(t);                        % Upper hex
19b1=2.42+1.4*sin(t);
20plot(a1,b1);
21plot(0,2.42,'ko');
22 
23a2=0+1.4*cos(t);                        % Lower hex
24b2=-2.42+1.4*sin(t);
25plot(a2,b2);
26plot(0,-2.42,'ko');
27 
28a3=2.1+1.4*cos(t);                      % Right lower hex
29b3=-1.21+1.4*sin(t);
30plot(a3,b3);
31plot(2.1,-1.21,'ko');
32 
33a4=2.1+1.4*cos(t);                      % Right upper hex
34b4=1.21+1.4*sin(t);
35plot(a4,b4);
36plot(2.1,1.21,'ko');
37 
38a5=-2.1+1.4*cos(t);                     % Left upper hex
39b5=1.21+1.4*sin(t);
40plot(a5,b5);
41plot(-2.1,1.21,'ko');
42 
43a6=-2.1+1.4*cos(t);                     % Left lower hex
44b6=-1.21+1.4*sin(t);
45plot(a6,b6);
46plot(-2.1,-1.21,'ko');
47 
48    for i=1:250
49        xa=-0.75+1.5*rand(1,1);
50        ya=-1.2+2.4*rand(1,1);
51        xra(i)=xa;
52        yra(i)=ya;
53 
54        xb=-1+2*rand(1,1);
55        yb=-0.65+1.3*rand(1,1);
56        xrb(i)=xb;
57        yrb(i)=yb;
58 
59        figure(1)
60        plot(xra(i),yra(i),'k.');
61        hold on
62        plot(xrb(i),yrb(i),'k.');
63 
64   end

4 comments:

  1. Dear harit

    your code for generating hexagonal cell site with random user is very useful.I have a similar project where I have to generate 19 hexagonal cells and generate 1000 random user in the first cell. Then I have to find the following:

    a. Find cumulative distribution function of SINR in monte carlo simulation platform where SINR=Recieved power/(Interference power+Noise power). Re eived power will be from two nearest base statio, Interference power will be cumulative recieved power from rest 17 base station and i have equation for noise power. can you please help how to do it? My email add is shaz04@gmail.com. if you can help me please write me a mail. Thanks in advance. Shaz

    ReplyDelete
  2. Dear shaz, I have the same project as yours. Can you please help me how to do it? If you can help me than please write.My email ad is devd042@gmail.com. Thanks in advance. Debasish

    ReplyDelete
  3. can any one of you please email me the stuff you had related to this project ,i am even working on same project .
    email - burugupallirashmisai@gmail.com
    Thank you

    ReplyDelete
  4. Dear Shaz, can u please email me how to find SINR with this. email id : sscd92@gmail.com.
    Thankx in advance

    ReplyDelete