Borrar filtros
Borrar filtros

How to perform DTW or EDR with 3 vectors?

38 visualizaciones (últimos 30 días)
Hüseyin Eken
Hüseyin Eken el 30 de Jul. de 2019
Comentada: Julian Ilham el 17 de Nov. de 2021
Hello all! I haven't worked on these stuff before and my knowledge about them only comes from internet, so I'd be happy if you could help me with my problem.
I have trajectories (in 3D) of some markers obtained from a MOCAP system. During the experiment, each subject performed several movements, and for each, we captured it 3 times. So, I have 3 trials for one movement, and I would like to average them (or create one time-series in general terms). Moreover, I am thinking to fill the missing points that are occured during only in some of those trials. However, I need to perform a "temporal normalization" first, since the events of the movement occured at slightly different instances due to patients' velocities. I came across with DTW(Dynamic Time Warping) and EDR(Edit Distance on Real Signals), but they both are used with two signals at a time. I would to use them for all 3 signals in order to obtain a common time-warped or edited signal.
Since I can't use 3 of them at the same time, I tried with pairs of them, for example:
[d1,ix1,iy1] = dtw(trial1,trial2);
[d2,ix2,iy2] = dtw(trial1,trial3);
But the new trial1 vectors i.e. trial1(ix1) and trial1(ix2) are different from each other.
Is there any way that I can use all three of my signal in DTW and/or EDR? (Maybe utilizing in a way the pairs of signals or anchoring one signal etc.)
Thanks in advance
Also, I have another question regarding to DTW (How to set proper maxsamp value in Dynamic Time Warping) with only 2 signals.
  2 comentarios
Vaughn Chambers
Vaughn Chambers el 5 de Feb. de 2020
Did you ever find a solution to this problem? I am having the same issue currently.
Hüseyin Eken
Hüseyin Eken el 8 de Feb. de 2020
Regarding Vaughn Chambers' comment: I am afraid I didn't. I have discarded the idea since DTW didn't work for my precise alignment problem.
However, if I had continued I would try the construct the matrix in 3D and adjust the cost/DTW value functions myself. You can follow a similar option or check file exchange maybe somebody did it already.

Iniciar sesión para comentar.

Respuestas (2)

Eamonn el 30 de Jul. de 2019
"Is there any way that I can use all three of my signal in DTW "
Yes, there are two ways DTWd and DTWi. As explained in [a].
See also a tutorual on DTW [b]
  1 comentario
Hüseyin Eken
Hüseyin Eken el 31 de Jul. de 2019
First of all, thanks. I have checked those but I believe what they mentioned is a bit different from what I wanted to do. In the articles you have provided, they are using DTW as a classification/clustering algorithm based on the resulting distances/dtw scores I assume. I am not interested in clustering, classifying or the distances between them- at least not directly. All I want is to align my three signals of the same movement altogether and repeat for other types of movements.
For both DTWd and DTWi, they used multi-dimensional time-series but still in pairs. My signals are 1D if I focus only one component or 3D if I work with all of the coordinate dimensions, but they are 3 different signals. I have tried to use them like in this example from [a].
For example, I have aligned (best I could I have still problems on that because I need to choose a proper maxsamp value for constraint) 1st and 2nd signals, as a result, I have 2 new versions of those signals as time-warp versions of those let's call them signal1_tw and signal2_tw. And then I have performed another dtw in the same way as before but this time with 1st and the 3rd signal so I have another pair of time-warped signal signal1_tw2 (not to confuse with the other one) and signal3_tw.
When I plot signal1_tw and signal1_tw2, I see that they are different so they have been modified with respect to the second signal (so I understand that there is no fixing one signal and warping only the other one). Therefore, could I perform one dtw for all 3 of my signals like in the code below if it was supported?
[dist12 dist13 dist23 i1 i2 i3] = dtw(signal1, signal2, signal3, maxsamp);

Iniciar sesión para comentar.

ISHEEKA DASGUPTA el 22 de Jun. de 2020
Hi, Did you find a solution to this problem?i am facing a similar issue
  2 comentarios
Hüseyin Eken
Hüseyin Eken el 23 de Jun. de 2020
Unfortunately, I haven't. As I explained, I disgarded the idea but if I were to continue I was thinking to build the cost matrix (and of course the rules) myself, in 3D. Last time I checked the file exchange, such work didn't exist but it was a year ago so you may want to check that again.
In addition, if you are interested in classification or the distance between the time-series maybe you would be pleased by this comment. If you are interested in temporal normalization as I was, I would suggest you to use simply resampling instead of DTW.
Julian Ilham
Julian Ilham el 17 de Nov. de 2021
I dont know whether you have found this solution yourself. I use DTW code from: for 3 temporal signals vs 3 temporal signals

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by