Euclidean distance dist function

조회 수: 5 (최근 30일)
Nesrider da Silva
Nesrider da Silva 2012년 9월 26일
Hi, I tried to calculate euclidean distance between two vectors, their dimensions are different, one is somethingx12 another is somethingx12, but these two somethings are different. im calculating the dtw - dinamic time warping, and i wrote the line dist(s(i,:),t(j,:)); but matlab tells me that there is an error. that ":" in this line means that i want to calculate euclidean distance between line "i" vector from s matrix(which has 12 columns) and line "j" vector from t matrix(which has 12 columns as well), and there is an error, can You find any solution? i got an error like that: "Error in ==> dist>apply at 244 z(i,:) = sum((w(:,i+copies)-p).^2,1);
Error in ==> dist at 127 out1 = apply(in1,in2,in3);
Error in ==> dtw at 18 cost = dist(s(i,:),t(j,:);
dtw is my function of dynamic time warping, dist is calculatin euclidean distance between two vectors, 1x12, something is wrong here and i cant figure it out...
  댓글 수: 6
Image Analyst
Image Analyst 2012년 9월 27일
No we can't. That is not one of the base MATLAB functions. Type "which dist" on the command line and tell us what it says. Maybe you're meant norm().
Star Strider
Star Strider 2012년 9월 28일
... or pdist2.

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

채택된 답변

Greg Heath
Greg Heath 2012년 9월 27일
You used dist incorrectly.
The input is a single I x N matrix consisting of N I-dimensional column vectors.
The output is a single symmetric N x N matrix consiting of N*(N-1) unique distances.
Hope this helps.
Thank you for formally accepting my answer.
Greg

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by