dtw
Distance between signals using dynamic time warping
Description
stretches
two vectors, dist
= dtw(x
,y
)x
and y
, onto
a common set of instants such that dist
, the
sum of the Euclidean distances between corresponding points, is smallest.
To stretch the inputs, dtw
repeats each element
of x
and y
as many times
as necessary. If x
and y
are
matrices, then dist
stretches them by repeating
their columns. In that case, x
and y
must
have the same number of rows.
[
returns
the common set of instants, or warping path,
such that dist
,ix
,iy
]
= dtw(x
,y
)x
(ix
) and y
(iy
)
have the smallest possible dist
between them.
The vectors ix
and iy
have
the same length. Each contains a monotonically increasing sequence
in which the indices to the elements of the corresponding signal, x
or y
,
are repeated the necessary number of times.
When x
and y
are matrices, ix
and iy
are
such that x
(:,ix)
and y
(:,iy)
are
minimally separated.
dtw(___)
without output arguments
plots the original and aligned signals.
If the signals are real vectors, the function displays the two original signals on a subplot and the aligned signals in a subplot below the first one.
If the signals are complex vectors, the function displays the original and aligned signals in three-dimensional plots.
If the signals are real matrices, the function uses
imagesc
to display the original and aligned signals.If the signals are complex matrices, the function plots their real and imaginary parts in the top and bottom half of each image.
Examples
Input Arguments
Output Arguments
More About
References
[1] Paliwal, K. K., Anant Agarwal, and Sarvajit S. Sinha. "A Modification over Sakoe and Chiba’s Dynamic Time Warping Algorithm for Isolated Word Recognition." Signal Processing. Vol. 4, 1982, pp. 329–333.
[2] Sakoe, Hiroaki, and Seibi Chiba. "Dynamic Programming Algorithm Optimization for Spoken Word Recognition." IEEE® Transactions on Acoustics, Speech, and Signal Processing. Vol. ASSP-26, No. 1, 1978, pp. 43–49.
Extended Capabilities
Version History
Introduced in R2016a
See Also
alignsignals
| edr
| finddelay
| findsignal
| xcorr