Create a Simple Scenario of WSNs

In the previous post, we have discussed about the various input parameters and their use to define a WSNs. Here, we will begin to design a simulation environment using the input parameters. First, we will see all four types of deployment scenarios in the consecutive posts.

Random Distribution with Static Sensor and Static Anchor Deployment Scenario.

clc
clear all
close all

%% Deployment of the nodes and anchor nodes

N=100;   % Total Number of  Sensors
A=10;    % Total Number of Anchors
X=100;   % Area length
Y=100;   % Area width
R=20;     % Transmission radius (m)

[s_x,s_y, a_x a_y]=create_distribution(N,A,X,Y);

plot(s_x,s_y,'bo');        % plot the sensor distribution
hold on
plot(a_x,a_y,'mo'); % plot the anchor distribution
hold on
grid on


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Create Distribution Function (Create a new file and paste the below code and saved the file as create_distribution.m)

function[s_x,s_y,a_x,a_y]=create_distribution(N,A,X,Y)

     s_x = rand(1,N)*X;  % sensor random distribution
     s_y = rand(1,N)*Y;

     a_x = rand(1,A)*X;  % anchor random distribution
     a_y = rand(1,A)*Y;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This code shows the random distribution of the nodes as given below.....
Random deployment of static sensors and static anchors

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Get the above code using the link given below.........

https://drive.google.com/drive/folders/0B2O8tJ9QXc-3WFF1d3VteDVzTU0?usp=sharing

Comments

Popular posts from this blog

Types of Algorithm and Its Complexity Analysis

First Step of Problem Solving Using Data Structure and Algorithm

Asymptotic Notations