Code: Selecteer alles
x = [0, 0, 2];
y = [0, 1, 0];
N = length(x);
xx = ones(N,1) * x;
yy = ones(N,1) * y;
d = sqrt((xx - xx').^2 + (yy - yy').^2);
dMean = sum(sum(d)) / (N * (N - 1));
dVar = sum(sum(tril((d - dMean).^2, -1))) / ((N * (N - 1) / 2) - 1);
dStd = sqrt(dVar);