Page 185 - MATLAB Recipes for Earth Sciences
P. 185
180 7 Spatial Data
of the lag matrix D zeros with NaN·s, otherwise the minimum distance will
be zero:
D2 = D.*(diag(x*NaN)+1);
lag = mean(min(D2))
lag =
8.0107
While the estimated variogram values tend to become more erratic with
increasing distances, it is important to define a maximum distance which
limits the calculation. As a rule of thumb, the half maximum distance is
suitable range for variogram analysis. We obtain the half maximum distance
and the maximum number of lags by:
hmd = max(D(:))/2
hmd =
130.1901
max_lags = floor(hmd/lag)
max_lags =
16
Then the separation distances are classifi ed and the classical variogram es-
timator is calculated:
LAGS = ceil(D/lag);
for i = 1:max_lags
SEL = (LAGS == i);
DE(i) = mean(mean(D(SEL)));
PN(i) = sum(sum(SEL == 1))/2;
GE(i) = mean(mean(G(SEL)));
end
where SEL is the selection matrix defined by the lag classes in LAG, DE is
the mean lag, PN is the number of pairs, and GE is the variogram estimator.
Now we can plot the classical variogram estimator (variogram versus mean
separation distance) together with the population variance:
plot(DE,GE,'.' )
var_z = var(z)
b = [0 max(DE)];
c = [var_z var_z];
hold on
plot(b,c, '--r')