File Exchange

Continuous Dynamic Time Warping

version 1.0 (4.75 KB) by

A version of the DTW algorithm. The CDTW calculates the similarity between 2 vectors

4.81818
11 Ratings

Updated

If you pass in 2 vectors it returns the unnormalized distance between the vectors, the accumulated distance between them, the length of the warping path (the normalizing factor), the warping path points and both warped input vectors.
You can plot the results too if select the pflag=1

Daniele Gamba

Nan Ye

Rig Das

Céldor

Céldor (view profile)

Thanks for the file.

In your dtw.m code, in line 49
[values,number]=min([D(m-1,n),D(m,n-1),D(m-1,n-1)]);

could be changed to [~,number] = ...

to avoid MATLAB warning.

Also, size of your matrix w changes with every iteration. Have you considered, allocating space before and then reduce its size to minimum when the loop is over? I think the max number of possible iteration is M + N, or even M+N-2 -- the worst case when each step would be non-diagonal.

Loïc

Jan Motl

Matthew

Matthew (view profile)

Hi! any one know how to modify the script if two vectors are in different length?

Fatemeh Saki

Fatemeh Saki (view profile)

very very helpful code thank you so much

marco gomez

marco gomez (view profile)

I don't understand the followig lines:

w=[m n; w];

% warped waves
rw=r(w(:,1));
tw=t(w(:,2));

Could you explain to me? please.
Thanks

Harish Kumar

hi,

This refers to 2 vectors. What if this were to be used for polyline to polyline comparison?

Appreciate your replies. Thanks & Regards,
Harish

jose tabora

Nice code, and nice demo.

Also thanks to Darryl Wallace for providing the needed correction to the div error.

Ahmed Bderhman

I think this is a good working and had help me more.

I have this question: i like to change euclidean distance{d=(repmat(Test',1,N)-repmat(Ref,M,1)).^2;} with mahalanobis distance is it possipole? if yes how can i do that?

because i like to test the efficiency of my system when i use euclidean distance and when i used mahalnobis distance.

Darryl Wallace

Ok yeah so I wrote a div function that is just

%% Start div function
q = div(num,den)
q = floor(num/den);
%% End div function.

and it appears to be working properly now.

Darryl Wallace

It looks good. And the portion from the original dtw.m file by Timothy Felty works. But it stops for me at when calling the function 'div'. I'm not entirely certain what this will do so I have been reluctant to change it. But if I had to guess, would it be an integer division? i.e. div(11,2) => 11/2 = 5?