Code covered by the BSD License  

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Continuous Dynamic Time Warping

4.81818
4.8 | 11 ratings Rate this file 64 Downloads (last 30 days) File Size: 4.75 KB File ID: #16350 Version: 1.0
image thumbnail

Continuous Dynamic Time Warping

by

Pau Micó (view profile)

 

13 Sep 2007 (Updated )

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

| Watch this File

File Information
Description

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

Acknowledgements

Dynamic Time Warping inspired this file.

This file inspired Alphonse:Rex Handwriting And Print Expertise.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
23 Apr 2016 Daniele Gamba  
07 Mar 2016 Nan Ye

Nan Ye (view profile)

 
25 Feb 2016 Rig Das  
03 Nov 2015 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.

Comment only
13 Sep 2013 Loïc

Loïc (view profile)

 
25 Apr 2013 Jan Motl

Jan Motl (view profile)

 
18 Nov 2012 Matthew

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

31 Oct 2012 Fatemeh Saki

very very helpful code thank you so much

05 Nov 2011 marco gomez

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

Comment only
02 Aug 2011 Vlad Atanasiu

Vlad Atanasiu (view profile)

 
28 Sep 2008 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

Comment only
30 Mar 2008 jose tabora

Nice code, and nice demo.

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

25 Mar 2008 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.

30 Jan 2008 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.

30 Jan 2008 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?

Comment only
Updates

demo included

Contact us