# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

## Continuous-Discrete Conversion Methods

### Choosing a Conversion Method

The `c2d` command discretizes continuous-time models. Conversely, `d2c` converts discrete-time models to continuous time. Both commands support several discretization and interpolation methods, as shown in the following table.

Discretization MethodUse when:
Zero-Order HoldYou want an exact discretization in the time domain for staircase inputs.
First-Order HoldYou want an exact discretization in the time domain for piecewise linear inputs.
Impulse-Invariant Mapping (`c2d` only)

You want an exact discretization in the time domain for impulse train inputs.

Tustin Approximation
• You want good matching in the frequency domain between the continuous- and discrete-time models.

• Your model has important dynamics at some particular frequency.

Zero-Pole Matching EquivalentsYou have a SISO model, and you want good matching in the frequency domain between the continuous- and discrete-time models.

### Zero-Order Hold

The Zero-Order Hold (ZOH) method provides an exact match between the continuous- and discrete-time systems in the time domain for staircase inputs.

The following block diagram illustrates the zero-order-hold discretization Hd(z) of a continuous-time linear model H(s)

The ZOH block generates the continuous-time input signal u(t) by holding each sample value u(k) constant over one sample period:

`$u\left(t\right)=u\left[k\right],\text{ }\text{ }\text{ }k{T}_{s}\le t\le \left(k+1\right){T}_{s}$`

The signal u(t) is the input to the continuous system H(s). The output y[k] results from sampling y(t) every Ts seconds.

Conversely, given a discrete system Hd(z), `d2c` produces a continuous system H(s). The ZOH discretization of H(s) coincides with Hd(z).

The ZOH discrete-to-continuous conversion has the following limitations:

• `d2c` cannot convert LTI models with poles at z = 0.

• For discrete-time LTI models having negative real poles, ZOH `d2c` conversion produces a continuous system with higher order. The model order increases because a negative real pole in the z domain maps to a pure imaginary value in the s domain. Such mapping results in a continuous-time model with complex data. To avoid this, the software instead introduces a conjugate pair of complex poles in the s domain.

#### ZOH Method for Systems with Time Delays

You can use the ZOH method to discretize SISO or MIMO continuous-time models with time delays. The ZOH method yields an exact discretization for systems with input delays, output delays, or transfer delays.

For systems with internal delays (delays in feedback loops), the ZOH method results in approximate discretizations. The following figure illustrates a system with an internal delay.

For such systems, `c2d` performs the following actions to compute an approximate ZOH discretization:

1. Decomposes the delay τ as $\tau =k{T}_{s}+\rho$ with $0\le \rho <{T}_{s}$.

2. Absorbs the fractional delay $\rho$ into H(s).

3. Discretizes H(s) to H(z).

4. Represents the integer portion of the delay kTs as an internal discrete-time delay zk. The final discretized model appears in the following figure:

### First-Order Hold

The First-Order Hold (FOH) method provides an exact match between the continuous- and discrete-time systems in the time domain for piecewise linear inputs.

FOH differs from ZOH by the underlying hold mechanism. To turn the input samples u[k] into a continuous input u(t), FOH uses linear interpolation between samples:

`$u\left(t\right)=u\left[k\right]+\frac{t-k{T}_{s}}{{T}_{s}}\left(u\left[k+1\right]-u\left[k\right]\right),\text{ }k{T}_{s}\le t\le \left(k+1\right){T}_{s}$`

This method is generally more accurate than ZOH for systems driven by smooth inputs.

This FOH method differs from standard causal FOH and is more appropriately called triangle approximation (see [2], p. 228). The method is also known as ramp-invariant approximation.

#### FOH Method for Systems with Time Delays

You can use the FOH method to discretize SISO or MIMO continuous-time models with time delays. The FOH method handles time delays in the same way as the ZOH method. See ZOH Method for Systems with Time Delays.

### Impulse-Invariant Mapping

The impulse-invariant mapping produces a discrete-time model with the same impulse response as the continuous time system. For example, compare the impulse response of a first-order continuous system with the impulse-invariant discretization:

```G = tf(1,[1,1]); Gd1 = c2d(G,0.01,'impulse'); impulse(G,Gd1)```

The impulse response plot shows that the impulse responses of the continuous and discretized systems match.

#### Impulse-Invariant Mapping for Systems with Time Delays

You can use impulse-invariant mapping to discretize SISO or MIMO continuous-time models with time delay, except that the method does not support `ss` models with internal delays. For supported models, impulse-invariant mapping yields an exact discretization of the time delay.

### Tustin Approximation

The Tustin or bilinear approximation yields the best frequency-domain match between the continuous-time and discretized systems. This method relates the s-domain and z-domain transfer functions using the approximation:

`$z={e}^{s{T}_{s}}\approx \frac{1+s{T}_{s}/2}{1-s{T}_{s}/2}.$`

In `c2d` conversions, the discretization Hd(z) of a continuous transfer function H(s) is:

`${H}_{d}\left(z\right)=H\left({s}^{\prime }\right),\text{ }\text{ }\text{ }{s}^{\prime }=\frac{2}{{T}_{s}}\frac{z-1}{z+1}$`

Similarly, the `d2c` conversion relies on the inverse correspondence

`$H\left(s\right)={H}_{d}\left({z}^{\prime }\right),\text{ }\text{ }\text{ }{z}^{\prime }=\frac{1+s{T}_{s}/2}{1-s{T}_{s}/2}$`

When you convert a state-space model using the Tustin method, the states are not preserved. The state transformation depends upon the state-space matrices and whether the system has time delays. For example, for an explicit (E = I) continuous-time model with no time delays, the state vector w[k] of the discretized model is related to the continuous-time state vector x(t) by:

`$w\left[k{T}_{s}\right]=\left(I-A\frac{{T}_{s}}{2}\right)x\left(k{T}_{s}\right)-\frac{{T}_{s}}{2}Bu\left(k{T}_{s}\right)=x\left(k{T}_{s}\right)-\frac{{T}_{s}}{2}\left(Ax\left(k{T}_{s}\right)+Bu\left(k{T}_{s}\right)\right).$`

Ts is the sample time of the discrete-time model. A and B are state-space matrices of the continuous-time model.

#### Tustin Approximation with Frequency Prewarping

If your system has important dynamics at a particular frequency that you want the transformation to preserve, you can use the Tustin method with frequency prewarping. This method ensures a match between the continuous- and discrete-time responses at the prewarp frequency.

The Tustin approximation with frequency prewarping uses the following transformation of variables:

`${H}_{d}\left(z\right)=H\left({s}^{\prime }\right),\text{ }\text{ }\text{ }{s}^{\prime }=\frac{\omega }{\mathrm{tan}\left(\omega {T}_{s}/2\right)}\frac{z-1}{z+1}$`

This change of variable ensures the matching of the continuous- and discrete-time frequency responses at the prewarp frequency ω, because of the following correspondence:

`$H\left(j\omega \right)={H}_{d}\left({e}^{j\omega {T}_{s}}\right)$`

#### Tustin Approximation for Systems with Time Delays

You can use the Tustin approximation to discretize SISO or MIMO continuous-time models with time delays.

By default, the Tustin method rounds any time delay to the nearest multiple of the sample time. Therefore, for any time delay `tau`, the integer portion of the delay, `k*Ts`, maps to a delay of `k` sampling periods in the discretized model. This approach ignores the residual fractional delay, `tau` `-` `k*Ts`.

You can to approximate the fractional portion of the delay by a discrete all-pass filter (Thiran filter) of specified order. To do so, use the `FractDelayApproxOrder` option of `c2dOptions`.

To understand how the Tustin method handles systems with time delays, consider the following SISO state-space model G(s). The model has input delay τi, output delay τo, and internal delay τ.

The following figure shows the general result of discretizing G(s) using the Tustin method.

By default, `c2d` converts the time delays to pure integer time delays. The `c2d` command computes the integer delays by rounding each time delay to the nearest multiple of the sample time Ts. Thus, in the default case, mi = round(τi /Ts), mo = round(τo/Ts), and m = round(τ/Ts).. Also in this case, Fi(z) = Fo(z) = F(z) = 1.

If you set `FractDelayApproxOrder` to a non-zero value, `c2d` approximates the fractional portion of the time delays by Thiran filters Fi(z), Fo(z), and F(z).

The Thiran filters add additional states to the model. The maximum number of additional states for each delay is `FractDelayApproxOrder`.

For example, for the input delay τi, the order of the Thiran filter Fi(z) is:

order(Fi(z)) = max(ceil(τi /Ts), `FractDelayApproxOrder`).

If ceil(τi /Ts) < `FractDelayApproxOrder`, the Thiran filter Fi(z) approximates the entire input delay τi. If ceil(τi/Ts) > `FractDelayApproxOrder`, the Thiran filter only approximates a portion of the input delay. In that case, `c2d` represents the remainder of the input delay as a chain of unit delays z–mi, where

mi = ceil(τi /Ts) – `FractDelayApproxOrder`.

`c2d` uses Thiran filters and `FractDelayApproxOrder` in a similar way to approximate the output delay τo and the internal delay τ.

When you discretize`tf` and `zpk` models using the Tustin method, `c2d` first aggregates all input, output, and transfer delays into a single transfer delay τTOT for each channel. `c2d` then approximates τTOT as a Thiran filter and a chain of unit delays in the same way as described for each of the time delays in `ss` models.

For more information about Thiran filters, see the `thiran` reference page and [4].

### Zero-Pole Matching Equivalents

The method of conversion by computing zero-pole matching equivalents applies only to SISO systems. The continuous and discretized systems have matching DC gains. Their poles and zeros are related by the transformation:

`${z}_{i}={e}^{{s}_{i}{T}_{s}}$`

where:

• zi is the ith pole or zero of the discrete-time system.

• si is the ith pole or zero of the continuous-time system.

• Ts is the sample time.

See [2] for more information.

#### Zero-Pole Matching for Systems with Time Delays

You can use zero-pole matching to discretize SISO continuous-time models with time delay, except that the method does not support `ss` models with internal delays. The zero-pole matching method handles time delays in the same way as the Tustin approximation. See Tustin Approximation for Systems with Time Delays.

## References

[1] Åström, K.J. and B. Wittenmark, Computer-Controlled Systems: Theory and Design, Prentice-Hall, 1990, pp. 48-52.

[2] Franklin, G.F., Powell, D.J., and Workman, M.L., Digital Control of Dynamic Systems (3rd Edition), Prentice Hall, 1997.

[3] Smith, J.O. III, "Impulse Invariant Method", Physical Audio Signal Processing, August 2007. `http://www.dsprelated.com/dspbooks/pasp/Impulse_Invariant_Method.html`.

[4] T. Laakso, V. Valimaki, "Splitting the Unit Delay", IEEE Signal Processing Magazine, Vol. 13, No. 1, p.30-60, 1996.

## See Also

Was this topic helpful?

Get trial now