Saturday, October 6, 2012

MATLAB to automatically create a wireless network GUI graphical user interface

This is a sample of creating a node manuly using GUI
BeconX=500;
BeconY=500;
axes(handles.axes1);
gca;
hold on;
hbecon=plot(BeconX,BeconY,'s')
set(hbecon,'color','red','LineWidth',8);

Basic part of my code is to randomly place the sensor nodes in the given space then connecting each two nodes if the distance between them less than or equal to the communication radius. Please check Matlab code below.

clear;
noOfNodes = 50;
rand('state', 0);
figure(1);
clf;
hold on;
L = 1000;
R = 200; % maximum range;
netXloc = rand(1,noOfNodes)*L;
netYloc = rand(1,noOfNodes)*L;
for i = 1:noOfNodes
plot(netXloc(i), netYloc(i), '.');
text(netXloc(i), netYloc(i), num2str(i));
for j = 1:noOfNodes
distance = sqrt((netXloc(i) - netXloc(j))^2 + (netYloc(i) - netYloc(j))^2);
if distance <= R
matrix(i, j) = 1; % there is a link;
line([netXloc(i) netXloc(j)], [netYloc(i) netYloc(j)], 'LineStyle', ':');
else
matrix(i, j) = inf;
end;
end;
end;

13 comments:

  1. Hello vinayagam

    i'm new for using matlab, i want to use it to simulate some WSN protocol, would you like to tell me from where i can start? and once more, i have searched framework for simulating wsn in matlab and i've found a framework named Simulink, are mostly wsn simulations in matlab use it, and what about your code, are they simulate with this framework?

    Thx regards sorry for my english :)

    ReplyDelete
    Replies
    1. Mobility WSN Animator
      Create Number of node with Random position, adjust the parameter of mobility range and simulation speed control also available.

      This model mainly used for localized based replication attack avoidance.
      https://drive.google.com/file/d/0B3h7QpcvUv3TbTEzTnFjUUNtNHM/view?usp=sharing

      SimpleNetworkAnimator2
      this is basically implement for key authentication for group key transfer.here show animator only..
      https://drive.google.com/file/d/0B3h7QpcvUv3TUnFtLU8tcHhIVWs/view?usp=sharing

      Simple WSN animator
      simple wireless Network Animator..

      In future we create fully supported WSN toolbox and its link with background matlab/algorithm files...
      https://drive.google.com/file/d/0B3h7QpcvUv3TOUxSTFFGN29jZlU/view?usp=sharing

      watch wsn video
      https://drive.google.com/file/d/0B3h7QpcvUv3TdXI0QklGMThCUlE/view?usp=sharing

      Delete
  2. hello
    i m new for using matlab .my problem is coverage problem i want to create sensor node like ur post but some different i want to create sensor node in any polygon region n draw circle each node baesd on radius .....plz help me my email add-smritideb14@gmail.com

    ReplyDelete
    Replies
    1. The aim of geom3d library (toolbox in matlab http://www.mathworks.com/matlabcentral/fileexchange/24484-geom3d) is to handle and visualize 3D geometric primitives such as points, lines, planes, polyhedra... It provides low-level functions for manipulating 3D geometric primitives, making easier the development of more complex geometric algorithms.
      Some features of the library are:
      - creation of various shapes (3D points, 3D lines, planes, polyhedra...) through an intuitive syntax. Ex:
      createPlane(p1, p2, p3) to create a plane through 3 points.
      - derivation of new shapes: intersection between 2 planes, intersection between a plane and a line, between a sphere and a line...
      - functions for 3D polygons and polyhedra. Polyhedra use classical vertex-faces arrays (face array contain indices of vertices), and support faces with any number of vertices. Some basic models are provided (createOctaedron, createCubeoctaedron...), as well as some computation (like faceNormal or centroid)

      - manipulation of planar transformation. Ex.:
      ROT = createRotationOx(THETA);
      P2 = transformPoint3d(P1, ROT);

      - direct drawing of shapes with specialized functions. Clipping is performed automatically for unbounded shapes such as lines or rays. Ex:
      drawPoint3d([50 50 25; 20 70 10], 'ro'); % draw some points
      drawLine3d([X0 Y0 Z0 DX DY DZ]); % clip and draw straight line

      The library is divided into two packages:
      * geom3d for general computation in 3d
      * meshes3d for representation and manipulation of polyhedral meshes

      Several functions require the geom2d package, available on the FEx.

      Delete
    2. hey you get a answer
      my id patelhimani15@gmail.com

      Delete
  3. Is simulink a better option or using GUI in matlab is better to get results for cognitive radio networks?

    ReplyDelete
    Replies
    1. This program is of optimization in Cognitive radio in spectrum sensing (total error rate, spectrum sensing, cognitive radio)
      http://2013matlab.blogspot.in/2015/11/optimization-in-cognitive-radio-network.html

      Delete
  4. i'm new for using matlab, i want to use it to simulate some WSN protocol (two level clustering using Leach ), would you like to tell me from where i can start? and once more, i have searched framework for simulating wsn in matlab and i've found a framework named Simulink, are mostly wsn simulations in matlab use it, and what about your code, are they simulate with this framework?

    ReplyDelete
  5. use this code to study

    http://2013matlab.blogspot.in/2015/11/wsn-protocol-implementation-leach.html

    ReplyDelete
  6. Thank you so much sir its working well can you help me to send a code for data transmission between nodes thanks for advance

    ReplyDelete
  7. Can u help me how to create nodes and Field of View in visual sensor networks

    ReplyDelete
  8. yes sir how to create a WSN and communicate with each other using Cluster head

    ReplyDelete
  9. hai, may i ask how did you determine this

    netXloc = rand(1,noOfNodes)*L;
    netYloc = rand(1,noOfNodes)*L;

    what is rand?

    ReplyDelete