How to end the transmission from particular nodes?

1 vue (au cours des 30 derniers jours)
Durgaprasad Srinivasa
Durgaprasad Srinivasa le 26 Mar 2020
clc;
clear all
close all
global Nodes
global txrange
Nodes = 35;
txrange = 15;
global savedtransmission
global xn
global yn
xn = [6.75 48 8.25 50.625 30.37 4.75 7 2.25 14.75 8.25 13.225 15.25 27 20.15 40.5 30.375 48.25 42.5 45 45.25 45.25 53.25 57 51.25 34.5 27 50.15 58 15.25 4.75 12.75 45.5 1.25 57 33.75];
yn = [40.1 39.42 6.57 6.57 20.12 13.26 22.995 39.42 33.24 33.24 13.14 3.67 40.46 19.71 26.28 33.24 21.1 21.1 29.46 39.42 32.41 32.41 22.9 13.41 13.14 33.46 45.71 1.37 26.28 33.46 40.1 18.61 22.9 13.58 41.21];
%xt = [6.75 48 8.25 50.625];
%yt = [40.1 39.42 6.57 6.57];
distancematrix = zeros(Nodes,Nodes);
for i=1:Nodes;
for j=1:Nodes;
distance(i,j)= sqrt((xn(i)-xn(j))^2 + (yn(i)-yn(j))^2);
end
end
global condition
condition = (distance < txrange);
global testpoints
testpoint = 1;
global endnodes
endnodes = [2,3,6,7,17,19,27,29,31];
%testpoint1 = [xt(1),yt(1)];
%testpoint2 = [xt(2),yt(2)];
%tesrpoint3 = [xt(3),yt(3)];
%testpoint4 = [xt(4),yt(4)];
global reachednodes
reachednodes = zeros(1,Nodes);
figure(1)
plot(xn,yn,'*');
%text(xt(1),yt(1),'T1'); text(xt(2),yt(2),'T2'); text(xt(3),yt(3),'T3'); text(xt(4),yt(4),'T4');
text(xn(1),yn(1),'T1'); text(xn(2),yn(2),'T2'); text(xn(3),yn(3),'T3'); text(xn(4),yn(4),'T4'); text(xn(5),yn(5),'1'); text(xn(6),yn(6),'2'); text(xn(7),yn(7),'3'); text(xn(8),yn(8),'4'); text(xn(9),yn(9),'5'); text(xn(10),yn(10),'6');
text(xn(11),yn(11),'7'); text(xn(12),yn(12),'8'); text(xn(13),yn(13),'9'); text(xn(14),yn(14),'10'); text(xn(15),yn(15),'11'); text(xn(16),yn(16),'12'); text(xn(17),yn(17),'13'); text(xn(18),yn(18),'14'); text(xn(19),yn(19),'15'); text(xn(20),yn(20),'16');
text(xn(21),yn(21),'17'); text(xn(22),yn(22),'18'); text(xn(23),yn(23),'19'); text(xn(24),yn(24),'20'); text(xn(25),yn(25),'21'); text(xn(26),yn(26),'22'); text(xn(27),yn(27),'23'); text(xn(28),yn(28),'24'); text(xn(29),yn(29),'25'); text(xn(30),yn(30),'26');
text(xn(31),yn(31),'27'); text(xn(32),yn(32),'28'); text(xn(33),yn(33),'29'); text(xn(34),yn(34),'30'); text(xn(35),yn(35),'31');
reachednodes(testpoint)=1;
DFS(testpoint);
return;
%DFS
function [] = DFS(r)
global condition
global xn
global yn
global reachednodes
global floodProb
global savedtransmission
global endnodes
wait_time = 2000000000;
neighborNodes = find(condition(r, :) == 1);
neighborNodes = intersect(neighborNodes, find(reachednodes(:) == 0));
for k = 1:length(neighborNodes),
line([xn(r) xn(neighborNodes(k))], [yn(r) yn(neighborNodes(k))]);
end;
drawnow;
for k = 1:length(neighborNodes),
if (reachednodes(neighborNodes(k)) == 0),
reachednodes(neighborNodes(k)) = 1;
for i=1:wait_time j=i;
end
floodProb = 9 / length(neighborNodes);
p = 1;
if p <= floodProb,
% broadcast again;
DFS(neighborNodes(k));
for e = 1:length(endnodes);
floodProb(e) = 1 / length(neighborNodes);
end
end;
end;
end;
end
I am trying like this to end the transmission at endnodes, please anyone help me with this. the picture is displayed below.
above highlited are the methods I tried to terminate transmission.

Réponses (0)

Catégories

En savoir plus sur Construction dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by