Code covered by the BSD License  

Highlights from
TDMA basd MANET

image thumbnail
from TDMA basd MANET by Pankaj Joshi
This file is used to analysis for TDMA based mobile ad-hoc network

[cluster_heads,cluster_loc]=cluster_head_find(number_nodes,num_of_trans,xm,ym,zm)
function [cluster_heads,cluster_loc]=cluster_head_find(number_nodes,num_of_trans,xm,ym,zm)
%% Writter:Pankaj Joshi India
%function
%[cluster_heads,cluster_loc]=cluster_head_find(number_nodes,num_of_trans,xm
%,ym,zm) is return cluster_head and location of cluster head location
%according to
%number_nodes= total number of nodes in the network
%num_of_trans= total number of cluster in network
%xm,ym,zm= maximum x,y,z coordinates in the network over which nodes are
%placed
%for ex:
% number_nodes =50;
% num_cluster_head=5;
%xm=500;ym=500;zm=10;
%[head,loc]=function
%[cluster_heads,cluster_loc]=cluster_head_find(number_nodes,num_cluster,xm,
%..ym,zm);
%% find the location each node
for k=1:number_nodes
    [x(k),y(k),z(k)]=locate_node(xm,ym,zm);
end
%% find location of cluster head and id of cluster head
for k=1:number_nodes
    loc(k,1:3)=[x(k),y(k),z(k)];
end
for k=1:num_of_trans
    cluster_heads(k)=randi(number_nodes,1,1);
    cluster_loc(k,1:3)=loc(k,:);
end
end

Contact us