Accelerating the pace of engineering and science

# d2d

Resample discrete-time model

## Syntax

sys1 = d2d(sys, Ts)
sys1 = d2d(sys, Ts, 'method')
sys1 = d2d(sys, Ts, opts)

## Description

sys1 = d2d(sys, Ts) resamples the discrete-time dynamic system model sys to produce an equivalent discrete-time model sys1 with the new sample time Ts (in seconds), using zero-order hold on the inputs.

sys1 = d2d(sys, Ts, 'method') uses the specified resampling method 'method':

• 'zoh' — Zero-order hold on the inputs

• 'tustin' — Bilinear (Tustin) approximation

sys1 = d2d(sys, Ts, opts) resamples sys using the option set with d2dOptions.

## Examples

### Example 1

Consider the zero-pole-gain model

$H\left(z\right)=\frac{z-0.7}{z-0.5}$

with sample time 0.1 s. You can resample this model at 0.05 s by typing

```H = zpk(0.7,0.5,1,0.1)
H2 = d2d(H,0.05)
Zero/pole/gain:
(z-0.8243)
----------
(z-0.7071)

Sampling time: 0.05
```

The inverse resampling operation, performed by typing d2d(H2,0.1), yields back the initial model H(z).

```Zero/pole/gain:
(z-0.7)
-------
(z-0.5)

Sampling time: 0.1
```

### Example 2

Suppose you estimates a discrete-time model of a sample time commensurate with the estimation data (Ts = 0.1 seconds). However, your deployment application demands a faster sampling frequency (Ts = 0.01 seconds).

```load iddata1
sys = oe(z1, [2 2 1]);
sysFast = d2d(sys, 0.01, 'zoh')

bode(sys, sysFast)```