Draw a line between nodes which are conected.
조회 수: 2 (최근 30일)
이전 댓글 표시
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
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
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!