den(nframe) = N/S;
nframe=nframe+1;
SS(nframe) = S;
NN(nframe) = sum(sum(mtx1));
if mtx1(x(nframe),y(nframe)) == 1
mtx(x(nframe),y(nframe) = 0;
mtx1(x(nframe),y(nframe)) = mtx1(x(nframe),y(nframe))-1;
else
mtx1(x(nframe),y(nframe)) = mtx1(x(nframe),y(nframe))-1;
end
end
end
dens = mean(den);
end
Листинг 5. Тексликдаги икки нуқта оралиғидаги масофа.
functiondist=distance2d(x1,y1,x2,y2)
dist=sqrt((x1-x2)^2+(y1-y2)^2);
end
Листинг 6. Нуқталар орасидаги масофа матрицасини қуриш.
functionds=distanceSpace(x,y,H)
N=length(x);ds=[];
forh=1:H
forn=1:N-H
ds(n,h)=distance2d(x(n),y(n),x(n+h),y(n+h));
end
end
end
Do'stlaringiz bilan baham: |