| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Neural Network Toolbox |
| Contents | Index |
Manhattan distance weight function
mandist is the Manhattan distance weight function. Weight functions apply weights to an input to get weighted inputs.
mandist(W,P) takes these inputs,
| W |
S x R weight matrix |
| P |
R x Q matrix of Q input (column) vectors |
and returns the S x Q matrix of vector distances.
mandist('deriv') returns '' because mandist does not have a derivative function.
mandist is also a layer distance function, which can be used to find the distances between neurons in a layer.
mandist(pos) takes one argument,
| pos |
S row matrix of neuron positions |
and returns the S x S matrix of distances.
Here you define a random weight matrix W and input vector P and calculate the corresponding weighted input Z.
Here you define a random matrix of positions for 10 neurons arranged in three-dimensional space and then find their distances.
You can create a standard network that uses mandist as a distance function by calling newsom.
To change a network so an input weight uses mandist, set net.inputWeight{i,j}.weightFcn to 'mandist'. For a layer weight, set net.layerWeight{i,j}.weightFcn to 'mandist'.
To change a network so a layer's topology uses mandist, set net.layers{i}.distanceFcn to 'mandist'.
In either case, call sim to simulate the network with dist. See newpnn or newgrnn for simulation examples.
The Manhattan distance D between two vectors X and Y is
| Provide feedback about this page |
![]() | mae | mapminmax | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |