finddelay
Estimate delay(s) between signals
Description
Examples
Input Arguments
Output Arguments
Tips
The calculation of the vector of estimated delays,
d
, depends onx
,y
, andmaxlag
as shown in the table.maxlag
X
Y
D
Integer-valued scalar Row or column vector or matrix Row or column vector or matrix Cross-correlation of the columns of X
andY
over a range of lags from –maxlag
tomaxlag
.Integer-valued row or column vector Row or column vector of length LX ≥ 1 Matrix of size MY-by-NY (MY > 1, NY > 1) Cross-correlation of X
and column j ofY
over a range of lags from –maxlag
(j) tomaxlag
(j), for j = 1, …, NY.Integer-valued row or column vector Matrix of size MX-by-NX (MX > 1, NX > 1) Row or column vector of length LY ≥ 1 Cross-correlation of column j of X
andY
over a range of from lags –maxlag
(j) tomaxlag
(j), for j = 1, …, NX.Integer-valued row or column vector Matrix of size MX-by-NX (MX > 1, NX > 1) Matrix of size MY-by-NY (MY > 1, NY = NX > 1) Cross-correlation of column j of X
and column j ofY
over a range of lags from –maxlag
(j) tomaxlag
(j), for j = 1, …, NY.If you wish to treat a row vector
x
of length LX as comprising one sample from LX different channels, you need to append one or more rows of zeros tox
so that it appears as a matrix. Then each column ofx
will be considered a channel.For example,
x = [1 1 1 1]
is considered a single channel comprising four samples. To treat it as four different channels, each channel comprising one sample, define a new matrixxm
:Each column of
xm
corresponds to a single channel, each one containing the samples1
and0
.xm = [1 1 1 1; 0 0 0 0];
Algorithms
The finddelay
function uses the xcorr
function to
determine the cross-correlation between each pair of signals at all possible lags specified by
the user. The normalized cross-correlation between each pair of signals is then calculated.
The estimated delay is given by the negative of the lag for which the normalized
cross-correlation has the largest absolute value.
If more than one lag leads to the largest absolute value of the cross-correlation, such as in the case of periodic signals, the delay is chosen as the negative of the smallest (in absolute value) of such lags.
Pairs of signals need not be exact delayed copies of each other. However, the estimated delay has a useful meaning only if there is sufficient correlation between at least one pair of the delayed signals.
Extended Capabilities
Version History
Introduced in R2007aSee Also
alignsignals
| dtw
| edr
| findsignal
| xcorr