Neural Network Toolbox Previous page   Next Page
dist

Euclidean distance weight function

Syntax

Z = dist(W,P)

df = dist('deriv')

D = dist(pos)

Description

dist is the Euclidean distance weight function. Weight functions apply weights to an input to get weighted inputs.

dist (W,P) takes these inputs,

and returns the S x Q matrix of vector distances.

dist('deriv') returns '' because dist does not have a derivative function.

dist is also a layer distance function, which can be used to find the distances between neurons in a layer.

dist(pos) takes one argument,

and returns the S x S matrix of distances.

Examples

Here we define a random weight matrix W and input vector P and calculate the corresponding weighted input Z.

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

Network Use

You can create a standard network that uses dist by calling newpnn or newgrnn.

To change a network so an input weight uses dist, set net.inputWeight{i,j}.weightFcn to 'dist'.

For a layer weight set net.inputWeight{i,j}.weightFcn to 'dist'.

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

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

See newpnn or newgrnn for simulation examples.

Algorithm

The Euclidean distance d between two vectors X and Y is:

See Also

sim, dotprod, negdist, normprod, mandist, linkdist


Previous page  display dlogsig Next page

© 1994-2005 The MathWorks, Inc.