- ZigBee
- Bluetooth
- Bluetooth Low Energy
- audio (sound is wireless!)
- ultrasonic
- infrasound
- standard radio
- WiFi
- software defined radio (USRP)
- infrared transmission
- visible light communication
- manipulation of entangled particles
- MASER
- pulsed X-Ray
- gamma-ray modulation
- Z-Ray
- Gambler's Intuition
Implement communication between the nodes for data transmission
24 views (last 30 days)
Show older comments
Hello all,
I need help to implement or establish the communication link of the node with its neighbours. Although I have created the link in the network based on distance (i.e. R=50m). But there is no communication taking place in the network (wireless connection between the nodes for data transmission).
Can anyone please help with the coding to establish wireless connection for data transmission?
I've attached the code of mine below.
%Code to create node manually.
BeconX=400;
BeconY=400;
%axis on;
%gcf;
hold on;
hbecon=plot(BeconX,BeconY,'s');
set(hbecon,'color','red','LineWidth',19);
%Basic part of code is to randomly place the sensor nodes in the given
%space then connecting each two nodes if the distance between them less than or equal to the communication radius.
% clear;
noOfNodes = 100;
%rand('state', 6);
figure(1);
clf;
hold on;
L = 400;
R = 50; % maximum range;
netXloc = rand(1,noOfNodes)*L;
netYloc = rand(1,noOfNodes)*L;
for i = 1:noOfNodes
plot(netXloc(i), netYloc(i), '.');
text(netXloc(i), netYloc(i), num2str(i));
for j = 1:noOfNodes
distance = sqrt((netXloc(i) - netXloc(j))^2 + (netYloc(i) - netYloc(j))^2);
if distance <= R
matrix(i, j) = 1; %#ok % there is a link;
line([netXloc(i) netXloc(j)], [netYloc(i) netYloc(j)], 'LineStyle', '-');
nbr(i,j) = 1; %neighbour link;
% disp(nbr(i,j));
else
matrix(i, j) = inf;
end
end
end
0 Comments
Answers (1)
Walter Roberson
on 6 Mar 2020
Okay, so it is wireless. But I do not see anywhere in your code where you create a connection to a device that does one of:
Without a connection to a hardware device, you cannot send anything.
3 Comments
Walter Roberson
on 6 Mar 2020
In order to simulate transmitting data between things that you have drawn as a plot, you will need to manipulate the UserData property of the graphics object representing the nodes. Or alternatively but more obscurely, you can setappdata() for any graphics object, not just figure objects.
However, I do not recommend either of these approaches. I recommend that you create data structures representing the nodes and that you simulate moving data between the structures.
https://www.mathworks.com/matlabcentral/answers/472096-broadcasting-a-packet-in-wireless-sensor-networks
https://www.mathworks.com/matlabcentral/answers/37726-wireless-sensor-networks
See Also
Categories
Find more on System-Level Simulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!