-
Notifications
You must be signed in to change notification settings - Fork 1
/
fitness.m
61 lines (37 loc) · 1 KB
/
fitness.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
61
clear all
% plots fitness for each strain
num_files=28469;
for j=1:1:num_files %419 % number of lines in the file "fitness"
filename=['line',int2str(j)];
a=load(filename);
%{
figure(1)
plot( a(2:end) , '--rs','LineWidth',2, 'MarkerEdgeColor','k', 'MarkerFaceColor','g', 'MarkerSize',10)
%}
time(j)=a(1);
meanfitness(j)=a(2);
s=1;
clear nonzero_fitness
for i=3:1:length(a)
if(a(i)~=0)
nonzero_fitness(s)=a(i);
s=s+1;
end
end
fittest(j)=max( nonzero_fitness );
end
figure
plot(time,fittest,'r');%, '--rs','LineWidth',1, 'MarkerEdgeColor','k', 'MarkerFaceColor','g', 'MarkerSize',2 )
hold on
nn=sum(fittest)/length(fittest)
line([time(1) time(end)],[nn nn])
xlabel('t (years)')
ylabel('maximum fitness')
figure
plot(time,meanfitness,'k');%, '--rs','LineWidth',1, 'MarkerEdgeColor','k', 'MarkerFaceColor','g', 'MarkerSize',2 )
hold on
mm=sum(meanfitness)/length(meanfitness)
line([time(1) time(end)],[mm mm])
xlabel('t (years)')
ylabel('mean fitness')
%title('\chi(d)=1 \forall d')