How to deploy sensor nodes in wireless sensor network (3D)
Version 1.0.0 (2.05 KB) by
Junaid Qadir
This is a short and simple MATLAB code for deploying the sensor nodes in wireless sensor networks.
% Author: Junaid Qadir (DITEN, UniGe, Italy)
% Department of Electrical, Electronic and Telecommunications Engineering, and Naval Architecture (DITEN)
% University of Genova, Genova, Italy
% Website: https://junaidqadirqau.wixsite.com/junaid
% Email: jqadar@ele.qau.edu.pk // junaid.qadir@edu.unige.it // junaidqadiqau@gmail.com
% Reference: J. Qadir, U. Ullah, B. Sainz-De-Abajo, B. G. Zapirain, G. Marques and I. de la Torre Diez,
%"Energy-Aware and Reliability-Based Localization-Free Cooperative Acoustic Wireless Sensor Networks,"
%in IEEE Access, vol. 8, pp. 121366-121384, 2020, doi: 10.1109/ACCESS.2020.3006194.
clc % clear command window
close all % close other window
clear all % clear variables
total_number_of_sensor_node=50; % The total number of sensor nodes in the network
x=randi([0,50],1,total_number_of_sensor_node); % x coordinate of each sensor node in the network
y=randi([0,50],1,total_number_of_sensor_node); % y coordinate of each sensor node in the network
z=randi([0,50],1,total_number_of_sensor_node); % z coordinate of each sensor node in the network
plot3(x,y,z,'mo',... % Plot all the nodes in 3 dimension
'LineWidth',1.5,... % Size of the line
'MarkerEdgeColor','k',... % The color of the outer surface of the node. Currently it is set to black color. "k" stand for black.
'MarkerFaceColor',[1 1 0],... % The color of the inside of the node. Currently it is set to yellow color. "[1 1 0]" is a code of yellow color
'MarkerSize',10)
box on
xlabel(' Length (m)') % X-label of the output plot
ylabel(' Width (m)') % Y-label of the output plot
zlabel(' Height (m)') % Z-label of the output plot
title(' Random deployment of the sensor nodes in the network') % Title of the plot
grid on % Activate the grid in background of the plot
% Hold figure 1
hold on
%Note: To change the color, just write "r" for red, "g" for green, "b" for %blue, "m" for magenta, "c" for cyan and so on
Cite As
Junaid Qadir (2024). How to deploy sensor nodes in wireless sensor network (3D) (https://www.mathworks.com/matlabcentral/fileexchange/99609-how-to-deploy-sensor-nodes-in-wireless-sensor-network-3d), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2021a
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |