フィルターのクリア

Draw a line between nodes which are conected.

3 ビュー (過去 30 日間)
priyanka
priyanka 2014 年 11 月 26 日
回答済み: Junaid Qadir 2021 年 11 月 9 日
num1 = input('Enter the no of nodes you want to consider in your WSN');
radius = 30;
i=num1;
Adj = zeros(i,i);
for i= 1:num1
X = randi([0 200],1,num1);
Y = randi([0 200],1,num1);
end
X
Y
plot(X1,Y1,'gx','LineWidth',4,'MarkerSize',15)
can we give numbering to nodes and create a line to show that they are connected. Let assume all nodea are connected
  1 件のコメント
Junaid Qadir
Junaid Qadir 2021 年 11 月 9 日
Find the attached code below
total_number_of_nodes = 10;
for i=1:1:total_number_of_nodes
S(i).xd=rand(1,1)*500;
S(i).yd=rand(1,1)*500;
S(i).ID=i;
plot3(S(i).xd,S(i).yd, 0 ,'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
text(S(i).xd+0.01, S(i).yd+0.01, 0+0.01,["Node", num2str(i)]); % To show ID number of each node
end

サインインしてコメントする。

回答 (1 件)

Junaid Qadir
Junaid Qadir 2021 年 11 月 9 日
Also refer to the link below
https://it.mathworks.com/matlabcentral/fileexchange/99609-how-to-deploy-sensor-nodes-in-wireless-sensor-network-3d

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by