How to deploy sensor nodes in wireless sensor network (3D)
版本 1.0.0 (2.1 KB) 作者:
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
引用格式
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. 检索时间: .
MATLAB 版本兼容性
创建方式
R2021a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |