distSqrPairwiseM
Pairwise Euclidean distance between two set of vectors
Contents
Syntax
- distMatrix=distPairwise(mat1)
- distMatrix=distPairwise(mat1, mat2)
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=distSqrPairwiseM(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) =
10 17 29 45
1 4 10 20
2 5 9 17