 function [W] = W_dist(Dmetric,dist_fff) % Distance threshold, Distance matrix
 n1=size(dist_fff,2);
 W=zeros(n1,n1);
for j=1:n1
    for i=1:n1
        if dist_fff(i,j)<=Dmetric; 
           W(i,j)=1;
        else W(i,j)=0;
        end
    end
end