standard euclidean distance, matlab

2 visualizaciones (últimos 30 días)
Tomas
Tomas el 5 de Feb. de 2014
Comentada: Walter Roberson el 6 de Feb. de 2014
Helllo
I need help with standard euclidean distance, knew would someone help with matlab code ?
I can not use, matlab function, pdist, pdist2.
I need standard euclidean distance between two vectors.
Thanks.

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Feb. de 2014
sqrt(sum((v1 - v2).^2))
  6 comentarios
Tomas
Tomas el 5 de Feb. de 2014
if it were arrays, how would it be?
Thank you for your help
Walter Roberson
Walter Roberson el 6 de Feb. de 2014
sqrt(sum((A1 ./ repmat(nanstd(A1), size(A1,1), 1) - A2 ./ repmat(nanstd(A2), size(A2,1), 1)).^2, 2))
This would be for taking the distance for the rows of A1 to the corresponding rows of A2.
I am thinking that possibly it should be different, like this:
sqrt(sum(((A1-A2) ./ repmat( nanstd([A1;A2]), size(A1,1), 1)).^2,2))

Iniciar sesión para comentar.

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by