MATLAB Function Reference |

delay

Estimates the delay of y with respect to x using the information theoretic delay criterion

**Syntax**

[lag,criterion] = delay(x,y) [lag,criterion] = delay(x,y,shift) [lag,criterion] = delay(x,y,shift,order) [lag,criterion] = delay(x,y,shift,order,base)

**Description**

Some primitive delay estimation algorithms are implemented in time-domain; for example the cross-correlation method. Most advanced time delay estimation algorithms are implemented in frequency-domain; for example the generalized cross-correlation method. The spectral estimation in case of short signal segments is the most important weakness of the frequency-domain implementations. Amongst other reasons R. Moddemeijer searched in his thesis for a time-domain implementation of an advanced delay estimation algorithm and found the "information theoretic delay criterion".

After publication of the thesis there has not been any further research in this direction. On the other hand the proposed method deserves further investigations. The main advantage of the method is the proven unambiguity of the criterion for a large enough order. Therefore the method is a suitable delay-estimation method in case of for quasi-periodic processes.

In theory the criterion as proposed is only valid for an x and y signal
which have a common multidimensional normal distribution. Like the
cross-correlation function the information theoretical delay criterion can
be applied as a general purpose method in a much wider context.
For `order=1`

the criterion reduces to ```
-1/2
log(1-rho^2)
```

where `rho`

is the correlation coefficient.

It can be proven that the criterion is a time-domain implementation of the maximum likelihood delay estimation algorithm as publiced by Knapp and Carter.

The `shift`

is in absolute value the maximum relative shift of
the two signals. As a consequence the estimated delay `lag`

is
bounded `-shift <= lag <= shift`

. The resulting
`criterion`

is computed from a lag of `-shift`

at
index `1`

to a lag of `shift`

at index `2*shift+1`

.

The `order`

determines the computational effort, the effort is
appproximately quadratic in the `order`

and linear in
`length(x)`

. For `order=1`

the method is equivalent
with the cross-correlation method. For larger orders the method is better
capable of including the dependancies of subsequent samples into the
estimate. For large enough order the criterion has in theory no local
minima; as a consequence the criterion has only one maximum. The order
should be choosen large enough; the criterion may not show any local
minima. The information criterions measures the mutual informations of two
signal segments of x resp. y of size `order`

.

The `base`

of the logarithm determines the unit of
measurement of the information criterion. Default base e (nats) is used, alternative choises are 2 (bit)
and 10 (Hartley).

Note: the implementation is computationally intensive; an improved less intensive implementation is possible. If there is an application of the method, the author will provide this improved implementation.

**Example**

The standard delay-model; a common signal and independent noises added to
the x- resp. the y-signal. As common signal we have choosen for 2nd order
AR-filtered noise.

```
r=31/32;
```

theta=pi/16;

a=[1,(-2 * r * cos(theta)), r^2];

b=[1];

signal=(filter(b,a,normrnd(0,1,1,100)));

x=signal+8*normrnd(0,1,1,100);

y=8*normrnd(0,1,1,100);

y(4:100)=y(4:100)+signal(1:97);

[lag,criterion]=delay(x,y);

lag = 3

criterion = Columns 1 through 7

0.2026 0.2178 0.2413 0.3085 0.3504 0.2992 0.3209

Columns 8 through 14

0.3368 0.3331 0.3514 0.2804 0.2794 0.2333 0.1915

Columns 15 through 21

0.1934 0.2351 0.3108 0.4260 0.5890 0.7917 0.9486

Columns 22 through 28

1.2224 1.4508 1.4732 1.2399 1.0223 0.7930 0.6299

Columns 29 through 35

0.4734 0.3699 0.3041 0.2302 0.2114 0.2082 0.2017

Columns 36 through 41

0.2354 0.2721 0.2491 0.2363 0.2434 0.2193

**See Also**

none

**Literature**

Moddemeijer, R.,
*An information theoretical delay estimator,*
Ninth Symp. on Information Theory in the Benelux,
May 26-27, 1988, Mierlo (NL),
pp. 121-128,
Ed. K.A. Schouwhamer Immink,
Werkgemeenschap Informatie- en
Communicatietheorie, Enschede (NL),
ISBN: 90-71048-04-7,
abstract ,
BibTeX ,

Moddemeijer, R.,
*Delay-Estimation with Application to Electroencephalograms in Epilepsy (Phd-thesis),*
Universiteit Twente,
1989,
Enschede (NL),
ISBN: 90-9002668-1,
abstract ,
BibTeX ,

Knapp, C.H. and Carter, C.,
*The generalized correlation method for estimation of time delay,*
IEEE Transactions on ASSP, 24, pp 320-327,

**Source code**

MATLAB Function Reference |