d=a;
l=size(a,1);
for t=1:l
d(t,t)=0;
for u=1:l
a(t,u) = a(t,u) * sqrt ( (b(t,1)-b(u,1))^2 + (b(t,2)-b(u,2))^2 );
a(t,u) = a(t,u) + 1/a(t,u) - 1/a(t,u);
end
a(t,t)=0;
end
c=0;
while nnz(c~=a)
c=a
for t=1:l % van t
for u=1:l % naar u
for v=1:l % via v
a(t,u)=min(a(t,u),a(t,v)+a(v,u));
end
end
end
end
[u,v]=max(a);
c=find(u==max(u))
c=c(1)
j=v(c)
if d(c,j)==1
c=[c j]
else
while c(end)~=j
for t=1:l
if d(c(end),t)~=0
a(c(end),t)+a(t,j)
max(u)
if a(c(1),t)+a(t,j)==max(u)
c=[c t];
end
end
end
end
end
|