# Estimate Transfer Functions with Delays

This example shows how to estimate transfer function models with I/O delays.

The `tfest` command supports estimation of IO delays. In the simplest case, if you specify `NaN` as the value for the `IODelay` input argument, `tfest` estimates the corresponding delay value.

```load iddata1 z1 sys = tfest(z1,2,2,NaN); % 2 poles, 2 zeros, unknown transport delay```

If you want to assign an initial guess to the value of delay or prescribe bounds for its value, you must first create a template `idtf` model and configure `IODelay` using the model's `Structure` property:

```sys0 = idtf([nan nan nan],[1 nan nan]); sys0.Structure.IODelay.Value = 0.1; % initial guess sys0.Structure.IODelay.Maximum = 1; % maximum allowable value for delay sys0.Structure.IODelay.Free = true; % treat delay as estimatable quantity sys = tfest(z1,sys0);```

If estimation data is in the time-domain, the delays are not estimated iteratively. If a finite initial value is specified, that value is retained as is with no iterative updates. The same is true of discrete-time frequency domain data. Thus in the example above, if `data` has a nonzero sample time, the estimated value of delay in the returned model `sys` is 0.1 (same as the initial guess specified for `sys0` ). The delays are updated iteratively only for continuous-time frequency domain data. If, on the other hand, a finite initial value for delay is not specified (e.g., `sys0.Structure.IODelay.Value = NaN` ), then a value for delay is determined using the `delayest` function, regardless of the nature of the data.

Determination of delay as a quantity independent of the model's poles and zeros is a difficult task. Estimation of delays becomes especially difficult for multi-input or multi-output data. It is strongly recommended that you perform some investigation to determine delays before estimation. You can use functions such as `delayest`, `arxstruc`, `selstruc` and impulse response analysis to determine delays. Often, physical knowledge of the system or dedicated transient tests (how long does it take for a step change in input to show up in a measured output?) will reveal the value of transport delays. Use the results of such analysis to assign initial guesses as well as minimum and maximum bounds on the estimated values of delays.

##### Support Get trial now