c2d command discretizes continuous-time
d2c converts discrete-time
models to continuous time. Both commands support several discretization
and interpolation methods, as shown in the following table.
|Discretization Method||Use when:|
|Zero-Order Hold||You want an exact discretization in the time domain for staircase inputs.|
|First-Order Hold||You want an exact discretization in the time domain for piecewise linear inputs.|
|Impulse-Invariant Mapping (|
You want an exact discretization in the time domain for impulse train inputs.
|Zero-Pole Matching Equivalents||You have a SISO model, and you want good matching in the frequency domain between the continuous- and discrete-time models.|
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:
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),
a continuous system H(s).
The ZOH discretization of H(s) coincides
The ZOH discrete-to-continuous conversion has the following limitations:
d2c cannot convert LTI models with
poles at z = 0.
LTI models having negative real poles, ZOH
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.
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:
Decomposes the delay τ as with .
Absorbs the fractional delay into H(s).
Discretizes H(s) to H(z).
Represents the integer portion of the delay kTs as an internal discrete-time delay z–k. The final discretized model appears in the following figure:
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:
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 , p. 228). The method is also known as ramp-invariant approximation.
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.
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.
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.
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:
c2d conversions, the discretization Hd(z) of
a continuous transfer function H(s) is:
d2c conversion relies on the
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:
Ts is the sample time of the discrete-time model. A and B are state-space matrices of the continuous-time model.
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:
This change of variable ensures the matching of the continuous- and discrete-time frequency responses at the prewarp frequency ω, because of the following correspondence:
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
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,
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
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.
c2d converts the time delays
to pure integer time delays. The
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)
= F(z) = 1.
If you set
FractDelayApproxOrder to a non-zero
c2d approximates the fractional portion
of the time delays by Thiran filters Fi(z), Fo(z),
The Thiran filters add additional states to the model. The maximum
number of additional states for each delay is
For example, for the input delay τi, the order of the Thiran filter Fi(z) is:
= max(ceil(τi /Ts),
If ceil(τi /Ts) <
the Thiran filter Fi(z)
approximates the entire input delay τi.
FractDelayApproxOrder, the Thiran filter only
approximates a portion of the input delay. In that case,
the remainder of the input delay as a chain of unit delays z–mi,
mi = ceil(τi /Ts)
c2d uses Thiran filters and
a similar way to approximate the output delay τo and
the internal delay τ.
When you discretize
using the Tustin method,
c2d first aggregates
all input, output, and transfer delays into a single transfer delay τTOT for
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
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:
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  for more information.
You can use zero-pole matching to discretize SISO continuous-time
models with time delay, except that the method does not support
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.
 Åström, K.J. and B. Wittenmark, Computer-Controlled Systems: Theory and Design, Prentice-Hall, 1990, pp. 48-52.
 Franklin, G.F., Powell, D.J., and Workman, M.L., Digital Control of Dynamic Systems (3rd Edition), Prentice Hall, 1997.
 Smith, J.O. III, "Impulse Invariant
Method", Physical Audio Signal Processing,
 T. Laakso, V. Valimaki, "Splitting the Unit Delay", IEEE Signal Processing Magazine, Vol. 13, No. 1, p.30-60, 1996.