<< padding Image_Processing_Tool_3 rot90 >>

Image_Processing_Tool_3 >> Image_Processing_Tool_3 > pdist

pdist

It computes pairwise distance for feature vectors.

Calling Sequence

y = pdist(x)
y = pdist(x,dtype)
y = pdist(x,dtype,p)

Arguments

x

An 2-d array representing a matrix of feature vectors.

dtype

A string of three or more characters representing the name of the distance type to be applied. By default its value is 'euc' for Euclidean distance.

p

An integer used mainly for Minkowski distance. By default, its value is 2 correspoding to Euclidean distance.

y

A vector of length n*(n-1)/2 for an input array of feature vectors having n rows.

Description

It computes pairwise distance between rows of an input array representing a matrix of feature vectors. The type of the distance measure used in computing pairwise distance is specified in the second argument given as a string of three or more characters. Following is the list of possible values of the second parameter dtype. Value of dtype Distance Measure 'che' Chebyshev distance 'cit' City block distance ( Manhattan distance) 'cor' Correlation 'cos' Cosine distance 'euc' Euclidean distance 'ham' Hamming distance 'jac' Jaccard distance 'mah' Mahalanobis distance 'min' Minkowski distance 'seu' Standardized Eulcidean distance The third parameter p is mainly used for minkowski distance. If p==1, it becomes City Block distance and if p=2 (default) it becomes Eculidean distance. For larger and larger values of p, it approaches to Chebyshev distance.

Examples

// Random array
x=rand(6,2);
// Pairwise Equildean distance measure
y=pdist(x), y=pdist(x,'euc')

// Eculidean distance using Minkowski ditance

y=pdist(x,'min',2)

// standard Euclidean measure
y1=pdist(x,'seu')

See Also

Authors

<< padding Image_Processing_Tool_3 rot90 >>