Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
what distance metric is this?

Subject: what distance metric is this?

From: shahnaz fatima

Date: 27 Jun, 2010 14:22:06

Message: 1 of 4

v=double(x)*double(x');
d(i,j)=sqrt(v(i,i)+v(j,j)-2*v(i,j)); %%%% what is this distance metric called?????

can anybody explain.

Subject: what distance metric is this?

From: Roger Stafford

Date: 27 Jun, 2010 15:22:04

Message: 2 of 4

"shahnaz fatima" <shahnaz1981fat@gmail.com> wrote in message <i07mqe$i8e$1@fred.mathworks.com>...
> v=double(x)*double(x');
> d(i,j)=sqrt(v(i,i)+v(j,j)-2*v(i,j)); %%%% what is this distance metric called?????
>
> can anybody explain.
- - - - - - - - -
  It looks very much like the Euclidean metric in R^n between the rows of x where n is the number of columns in x.

Roger Stafford

Subject: what distance metric is this?

From: John D'Errico

Date: 27 Jun, 2010 15:32:05

Message: 3 of 4

"shahnaz fatima" <shahnaz1981fat@gmail.com> wrote in message <i07mqe$i8e$1@fred.mathworks.com>...
> v=double(x)*double(x');
> d(i,j)=sqrt(v(i,i)+v(j,j)-2*v(i,j)); %%%% what is this distance metric called?????
>
> can anybody explain.

Euclidean distance.

But done very poorly, because it uses a doubly nested
loop to do work that is far better done with no explicit
loops at all.

Even worse, it is inaccurate and subject to numerical
problems in some cases.

A better tool can be found here:

http://www.mathworks.com/matlabcentral/fileexchange/18937

John

Subject: what distance metric is this?

From: Faraz Afzal

Date: 27 Jun, 2010 16:03:06

Message: 4 of 4

"shahnaz fatima" <shahnaz1981fat@gmail.com> wrote in message <i07mqe$i8e$1@fred.mathworks.com>...
> v=double(x)*double(x');
> d(i,j)=sqrt(v(i,i)+v(j,j)-2*v(i,j)); %%%% what is this distance metric called?????
>
> can anybody explain.

Hi

This look to me like a Euclidean metric in the nth space. Mapping v's for the given xs.
If you have a Square matrix data use Chebyshev distance for much efficiency.

I hope it answers the question. Let us know what you are trying to achieve?

Regards,
Faraz Afzal

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us