# absorbDelay

Replace time delays by poles at z = 0 or phase shift

## Syntax

```sysnd = absorbDelay(sysd) [sysnd,G] = absorbDelay(sysd) ```

## Description

`sysnd = absorbDelay(sysd)` absorbs all time delays of the dynamic system model `sysd` into the system dynamics or the frequency response data.

For discrete-time models (other than frequency response data models), a delay of `k` sampling periods is replaced by `k` poles at z = 0. For continuous-time models (other than frequency response data models), time delays have no exact representation with a finite number of poles and zeros. Therefore, use `pade` to compute a rational approximation of the time delay.

For frequency response data models in both continuous and discrete time, `absorbDelay` absorbs all time delays into the frequency response data as a phase shift.

```[sysnd,G] = absorbDelay(sysd)``` returns the matrix `G` that maps the initial states of the `ss` model `sysd` to the initial states of the `sysnd`.

## Examples

collapse all

Create a discrete-time transfer function that has a time delay.

```z = tf('z',-1); sysd = (-0.4*z -0.1)/(z^2 + 1.05*z + 0.08); sysd.InputDelay = 3```
```sysd = -0.4 z - 0.1 z^(-3) * ------------------- z^2 + 1.05 z + 0.08 Sample time: unspecified Discrete-time transfer function. ```

The display of `sysd` represents the `InputDelay` as a factor of `z^(-3)`, separate from the system poles that appear in the transfer function denominator.

Absorb the time delay into the system dynamics as poles at `z`= 0.

`sysnd = absorbDelay(sysd)`
```sysnd = -0.4 z - 0.1 ------------------------- z^5 + 1.05 z^4 + 0.08 z^3 Sample time: unspecified Discrete-time transfer function. ```

The display of `sysnd` shows that the factor of `z^(-3)` has been absorbed as additional poles in the denominator.

Verify that `sysnd` has no input delay.

`sysnd.InputDelay`
```ans = 0 ```

Create a discrete-time polynomial model.

`m = idpoly(1,[0 0 0 2 3]);`

Convert `m` to a transfer function model.

`sys = tf(m)`
```sys = z^(-2) * (2 z^-1 + 3 z^-2) Sample time: unspecified Discrete-time transfer function. ```

The numerator of the transfer function, `sys`, is `[0 2 3]` and the transport delay, `sys.IODelay`, is 2. This is because the value of the B polynomial, `m.B`, has 3 leading zeros. The first fixed zero shows lack of feedthrough in the model. The two zeros after that are treated as input-output delays.

Use `absorbDelay` to treat the leading zeros as regular `B` coefficients.

```m2 = absorbDelay(m); sys2 = tf(m2)```
```sys2 = 2 z^-3 + 3 z^-4 Sample time: unspecified Discrete-time transfer function. ```

The numerator of `sys2` is `[0 0 0 2 3]` and transport delay is `0`. The model `m2` treats the leading zeros as regular coefficients by freeing their values. `m2.Structure.B.Free(2:3)` is `TRUE` while `m.Structure.B.Free(2:3)` is `FALSE`. 