distPairwiseM

Pairwise Euclidean distance between two set of vectors

Contents

Syntax

Description

distPairwise(mat1, mat2) returns the distance matrix between two set of column vectors mat1 and mat2.

The element at row i and column j of the return matrix is the Euclidean distance between column i of mat1 and column j of mat2.

Example

mat1=[1 3 3;2 3 4];
mat2=[4 5 6 7;3 3 4 5];
fprintf('mat1 =\n'); disp(mat1);
fprintf('mat2 =\n'); disp(mat2);
out=distPairwiseM(mat1, mat2);
fprintf('distPairwise(mat1, mat2) =\n'); disp(out);
mat1 =
     1     3     3
     2     3     4

mat2 =
     4     5     6     7
     3     3     4     5

distPairwise(mat1, mat2) =
    3.1623    4.1231    5.3852    6.7082
    1.0000    2.0000    3.1623    4.4721
    1.4142    2.2361    3.0000    4.1231


Top page   Next: distPairwise.m   Prev:distSqrPairwise.m