# delayest

Estimate time delay (dead time) from data

## Syntax

```nk = delayest(Data) nk = delayest(Data,na,nb,nkmin,nkmax,maxtest) ```

## Description

`nk = delayest(Data)` estimates time delay from data. `Data` is an `iddata` object containing the input-output data. It can also be an `idfrd` object defining frequency-response data. Only single-output data can be handled. `nk` is returned as an integer or a row vector of integers, containing the estimated time delay in samples from the input(s) to the output in `Data`.

The estimate is based on a comparison of ARX models with different delays:

`$\begin{array}{l}y\left(t\right)+{a}_{1}y\left(t-1\right)+...+{a}_{na}y\left(t-na\right)=\\ {b}_{1}u\left(t-nk\right)+...+{b}_{nb}u\left(t-nb-nk+1\right)+e\left(t\right)\end{array}$`

`nk = delayest(Data,na,nb,nkmin,nkmax,maxtest)` specifies additional options. The integer `na` is the order of the A polynomial (default 2). `nb` is a row vector of length equal to the number of inputs, containing the order(s) of the B polynomial(s) (default all 2). `nkmin` and `nkmax` are row vectors of the same length as the number of inputs, containing the smallest and largest delays to be tested. Defaults are `nkmin = 0` and `nkmax = nkmin+20`. If `nb`, `nkmax`, and/or `nkmin` are entered as scalars in the multiple-input case, all inputs will be assigned the same values. `maxtest` is the largest number of tests allowed (default 10,000).

Introduced before R2006a