I have an algorithm attached below and I have to write a matlab code from that algorithm. Can anyone please help me??

3 views (last 30 days)
Define N global variable
Get N (total number of nodes in the network)
Get border_lines (Left_line, Right_line, Top_line, Bottom_line)
Divide_Network_to_Four_Zones (Zl, Zr,Zu, Zw)
for all zones i do
Nz[i] <- Get
Number_of_nodes_per_zone[i]
dz[i]^ Nz/N
if dz[i]>0.25 then
density_factor[i] <- High
else if 0.25 > density_factor[i] > 0.15
then
density_factor[i] <- Midium
else if 0.15 > density_factor[i]
density_factor[i] <- Low
end if
Broadcast density_factor[i]
if density_factor[i] <- High then
Devide_Zone_to_Four_Clusters[i]
for all Clusters j do
for all nodes k do
Node_Membership[i] [j] [k]
if No_Membership [j ] [i] [k] then
Delete_Cluster
end if
end for
end for
else if density_factor[i] <- Medium
then
Devide_Zone_to_Two_Clusters[i]
for all Clusters j do
for all nodes k do
Node_Membership[i] [j] [k]
if No_Membership[j][i][k] then
Delete_Cluster
end if
end for
end for
else if density_factor[i] <- Low then
Devide_Zone_to_One_Clusters[i]
for all Clusters j do
for all nodes k do
Node_Membership[j] [i] [k]
if No_Membership [j ] [i] [k] then
Delete_Cluster
end if
end for
end for
end if
end for
  1 Comment
Ankit
Ankit on 19 Nov 2019
It is better to try yourself in MATLAB first and try to post the questions when you face problem. I would recommend you to first go through the MATLAB Onramp course.

Sign in to comment.

Answers (0)

Categories

Find more on WSNs 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!