## euclidean distance of two vectors,

on 9 Mar 2011

### Jan Simon (view profile)

Euclidean distance of two vector. I have the two image values G=[1x72] and G1 = [1x72]. I need to calculate the two image distance value.

## Products

No products are associated with this question.

### Jan Simon (view profile)

on 9 Mar 2011

Do you know the definition of the Euclidean distance?

```G  = rand(1, 72);
G2 = rand(1, 72);
D  = sqrt(sum((G - G2) .^ 2));
```

A more efficient method, but this matters only for much larger vectors:

```V = G - G2;
D = sqrt(V * V');
```

Or a Matlab command:

```D = norm(G - G2);
```

A good ide is to search in the documentation before asking in MATLAB Answers:

```docsearch euclidean
```

Joel

### Joel (view profile)

on 13 Mar 2013

Do you currently have this project with you? I want to compare two vector which totals 27 feature vectors for each image.

dali elite

on 16 May 2013

thanks a lot

Jan Simon

### Jan Simon (view profile)

on 17 May 2013

@dali elite: Setting a flag is thought for calling the admin, such that they delete improper messages like spam or rudeness.

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