Information Technology Reference
In-Depth Information
modules implementing the above concept, together with the CA simulator
ca_sim.m presented in the previous chapter:
function y=dif_filter(x0)
% implements a diffusive filter assuming that
x0 is in the
% range 0 1
[m, n]=size(x0);
i=1:m; j=1:n;
jl=[n, 1:n-1]; jr=[2:n,1];
iu=[m, 1:m-1]; id=[2:m,1];
if m==1
y=1-0.5*abs(x0(jl)+x0(jr)-2*x0);
else
y=1-0.25*abs(x0(i,jl)+x0(i,jr)+x0(iu,j)+x0(id,j)-
4*x0);
end
% compute_clus.m
% compute the clustering coefficient during
% each CA iteration
df=dif_filter(x0);
if dim==1
C=[C mean(df)];
elseif dim==2
C=[C mean(mean(df))];
end
The function dif_filter.m is a diffusive filter implementing (4.3) for either one-
dimensional and two-dimensional CAs. This function is called from com-
pute_clus.m, which has to be included into the main loop of the CA simulator.
Before the loop one should include an initialization of C to a void vector. At the
end of the main loop the entire time sequence of clustering coefficients is avail-
able as a vector C with a size T.
To calculate the transient length Tr the following are applied to the time se-
quence
^
` T
C
t
:
t
1
,..
x The sequence is smoothed, for instance using a FIR filter defined as:
10
1
tzf
(
t
)
¦
C
(
t
k
)
10
k
1
x The admissible variance ' is computed based on the last 20% of the samples
T
2
of tzf(t) :
'
¦
tzf
(
t
)
mean
(
tzf
)
t
0
.
T
x Tr is decremented from T to 1 and its value is outputted when
'
tzf
(
Tr
)
tzf
(
T
)
!
x An average clustering coefficient Clus is computed as an average over the
time steps of the
sequence after the transient period:
C
t
1
T
Clus
C
(
f
)
¦
C
(
t
)
T
trans
t
trans
1
In addition to the defined measures of emergence ( Tr , and Clus ) another meas-
ure, the variance Var is determined. It is inspired from other works [73-75] where
 
Search WWH ::




Custom Search