Main Content


Link distance function


d = linkdist(pos)


linkdist is a layer distance function used to find the distances between the layer’s neurons given their positions.

d = linkdist(pos) takes one argument,


N-by-S matrix of neuron positions

and returns the S-by-S matrix of distances.


Here you define a random matrix of positions for 10 neurons arranged in three-dimensional space and find their distances.

pos = rand(3,10);
D = linkdist(pos)

Network Use

You can create a standard network that uses linkdist as a distance function by calling selforgmap.

To change a network so that a layer’s topology uses linkdist, set net.layers{i}.distanceFcn to 'linkdist'.

In either case, call sim to simulate the network with dist.


The link distance D between two position vectors Pi and Pj from a set of S vectors is

Dij = 0, if i == j
     = 1, if (sum((Pi-Pj).^2)).^0.5 is <= 1
     = 2, if k exists, Dik = Dkj = 1
     = 3, if k1, k2 exist, Dik1 = Dk1k2 = Dk2j = 1
     = N, if k1..kN exist, Dik1 = Dk1k2 = ...= DkNj = 1
     = S, if none of the above conditions apply

Version History

Introduced before R2006a

See Also

| | |