eucilidean distance between two matrix

Respuestas (3)

Walter Roberson
Walter Roberson el 9 de Nov. de 2016

0 votos

It is only possible to find the euclidian distance between two matrices if the matrices are simple scalars or are vectors. If they are, for example, two dimensional histograms then euclidian distance does not apply.

3 comentarios

mukesh gupta
mukesh gupta el 9 de Nov. de 2016
Editada: Walter Roberson el 9 de Nov. de 2016
1.
D = sum(sum(pdist2(Z,queryica,'euclidean')));
a(:,i)=D;
2.
% 2nd program h1 = imhist(queryica)./numel(queryica);
h2=imhist(Z)./numel(Z);
D = sqrt(sum((h1-h2).^2));
3.
%3rd program
D=sqrt(sum(sum((queryica-Z).*(queryica-Z))));
where queryica and Z are 3X256 double matrix
Sir, which one will work as euclidian distance,
if you have other program to find euclidian distance between queryica and Z dimension 3X256.
Walter Roberson
Walter Roberson el 9 de Nov. de 2016
Euclidian distance cannot be used in that situation.
Walter Roberson
Walter Roberson el 9 de Nov. de 2016
What you can do is reshape() the arrays to be vectors, after which the values can act as coordinates that you can apply Euclidean distance to. But it is not clear that would have same meaning as "Euclidean distance between matrices", as the second dimension of the matrices implies a relationship between the components that is not captured by pure component-wise distance measures.
Trying to find the Euclidean distance between matrices is much like trying to sort complex numbers: a complex number is not the same as two numbers together.

Iniciar sesión para comentar.

Image Analyst
Image Analyst el 9 de Nov. de 2016
Not sure what your definition is, but perhaps do you mean the Euclidean distance between each corresponding pair of elements, and then maybe perhaps summing or taking of the mean of all of them?
distances = queryica - Z;
eucDistance = sum(distances); % or....
eucDistance = mean(distances(:));
If not, then maybe you can attach a diagram showing the distances between the matrices or pairs of points.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 9 de Nov. de 2016

Respondida:

el 9 de Nov. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by