-
Notifications
You must be signed in to change notification settings - Fork 2
/
initial_input_mazumdar.m
60 lines (50 loc) · 1.2 KB
/
initial_input_mazumdar.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
xm=100;
ym=100;
%x and y Coordinates of the sink
sink.x=50;
sink.y=0;
%Number of Nodes in the Field
n=100;
%Probability of a node to become cluster head
%p=0.1;
Tc= 20;
Rmax = 30;
%Eelc=Etx=Erx
ETX=50* 10^-9;
ERX=50* 10^-9;
%Transmit Amplifier types
Efs=10* 10^-12;
Emp=0.0013* 10^-12;
%Data Aggregation Energy
EDA=5* 10^-9;
%maximum number of round
rmax = 1000;
%Computation of do
d0 = sqrt(Efs/Emp);
bit = 4000;
fis1 = readfis('dis_Fuzzyfitness1');
fis2 = readfis('dis_Fuzzyfitness2');
fis3 = readfis('Cluster.radius');
%Creation of the random Sensor Network
figure(1);
for i=1:1:n
%Initial Energy
S(i).Initial_energy = 0.5;
S(i).RE = S(i).Initial_energy;
S(i).xd=rand(1,1)*xm;
S(i).yd=rand(1,1)*ym;
%initially there are no cluster heads only nodes
S(i).type = 'N';
S(i).id=i;
S(i).state = 'Initial_State';
S(i).distoBS = norm([S(i).xd-50 S(i).yd-50]);
plot(S(i).xd,S(i).yd,'o','MarkerFaceColor','b');
hold on;
end
S(n+1).xd = sink.x;
S(n+1).yd = sink.y;
plot(sink.x, sink.y, 's', 'MarkerFaceColor', 'red');
text(sink.x, sink.y,' BS','Color','b','FontWeight','b');
hold on;
grid on;
save('mazumdar2.mat');