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.
No products are associated with this question.
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: