Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Simulation of ad hoc network in matlab

Status
Not open for further replies.

athinap7

Newbie level 1
Joined
Jun 28, 2009
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
simulation of ad hoc network using matlab

Hi I have the following problem for my msc project.

I have to plot in Matlab a network with 15 nodes distributed randomly. Then i have to calculate the euclidean distance between the nodes and connect with a line the nodes which their distance is less than a threshold (lets say 350 m)

I have written the following code which will calculate the distance and check if it is less than 350m

for k=1:N;
for j=1:15;
if k~=j;
d(k,j)=((nodesX(k)-nodesX(j))^2+(nodesY(k)-nodesY(j))^2)^0.5;
if d<350;
line(nodesX,nodesY);
end;
end;
end;

end;

But i think that the use of the function line is wrong. How can I plot the lines between the nodes where d<350?

help pleaseeeee
 

Re: simulation of ad hoc network using matlab

Hi I have the following problem for my msc project.

I have to plot in Matlab a network with 15 nodes distributed randomly. Then i have to calculate the euclidean distance between the nodes and connect with a line the nodes which their distance is less than a threshold (lets say 350 m)

I have written the following code which will calculate the distance and check if it is less than 350m

for k=1:N;
for j=1:15;
if k~=j;
d(k,j)=((nodesX(k)-nodesX(j))^2+(nodesY(k)-nodesY(j))^2)^0.5;
if d<350;
line(nodesX,nodesY);
end;
end;
end;

end;

But i think that the use of the function line is wrong. How can I plot the lines between the nodes where d<350?

help pleaseeeee

use hold on command before line(nodesX,nodesY);

the new codes is like this:


for k=1:N
for j=1:15
if k~=j
d(k,j)=((nodesX(k)-nodesX(j))^2+(nodesY(k)-nodesY(j))^2)^0.5;
if d<350
hold on;
line(nodesX,nodesY);
end
end
end

end
 
Hi can you send us the rest of the code?
or at least help tp know how we are going to start a matlab code to generate random base station and nodes then find its locations (for now)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top