How to calculate the distance between matrixes

조회 수: 3 (최근 30일)
fathi
fathi 2017년 4월 24일
편집: Jan 2017년 4월 24일
Is it possible to determine the Euclidean distance between two matrices with different lengths?
%//// Ex:
I1 = [4, 3, 5, 2, 4]
I2 = [4, 3, 6]
The length of I1 is 5, but the length of I2 is 3. So is it possible to calculate the Euclidean distance??
Thank you
  댓글 수: 1
Andrew Newell
Andrew Newell 2017년 4월 24일
A Euclidean distance is between two points in the same space. Here we have points in a five-dimensional space and a three-dimensional space. To make the idea of Euclidean distance meaningful, you'd have to do something like add two zeros to I2.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 4월 24일
편집: Jan 2017년 4월 24일
No. The Euclidean distance requires vectors with the same number of elements.
You can define a new distance, which fills elements with zeros (but then decide, if the vector is padded on the left or the right).
Perhaps you want something like FEX: distance2curve or the Levenshtein distance between words.
What is the wanted output for the shown 2 vectors?

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by