1
$\begingroup$

I want to find specific shape in accelerometer data. I have specific shape signal and accelerometer data, I want to see if they are similar. I was thinking of using DTW algorithm, to see how similar they are. I am trying it out on matlab, but with some test signals to just understand how it works. I used Abhishek Mishra - Time Series Similarity Using Dynamic Time Warping Explained as a tutorial. First I tried it out on excel doing all the algorithm by hand and got normilised distance of 4.5.

enter image description here

After doing it on matlab I got answer of 9. As I understood function DWT returns dist, but why it is 2x my calcualted distance ? Also, as I understood, this distance is the similarity of two signals, so the smaller it is the better?

enter image description here

$\endgroup$
1
  • $\begingroup$ Could you share the signals as CSV or MAT? $\endgroup$
    – Royi
    Commented May 10 at 16:17

2 Answers 2

1
$\begingroup$

It is the distance, so smaller the better. There is a nice tutorial on DTW: Abdullah Mueen, Eamonn Keogh - Extracting Optimal Performance from Dynamic Time Warping.

If you need to do this fast, the UCR suite lets you compute DTW on fast moving streams.

There are a few variants of DTW.. For example, some people forgo the sqrt root step, in the "sqrt root of the sum of squared distances", since they are only looking for the nearest neighbor, and the nearest neighbor is the same if you take the sqrt root or not

$\endgroup$
0
$\begingroup$

So I managed to find the answer. Matlab returns overall distance or cost of signal alignment. We can find individual cost of each point of 1 signal to each point of 2 signal (example x(1) cost to align with y(1) is 1). As we progress further with matrix, we get a sum cost of current point and previous points. Overall sum of costs or overall cost to align these two sequences are calculated at the last cell (7,7) and it is 9. Matlab returns overall cost which is 9. larger the number is, the more expensive it is to align two signals, ideal result is 0, where two signals are the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.