| Control System Toolbox™ | ![]() |
Convert from continuous- to discrete-time models
sysd = c2d(sys,Ts)
sysd = c2d(sys,Ts,method)
sysd = c2d(sys,Ts) discretizes the continuous-time LTI model sys using zero-order hold on the inputs and a sample time of Ts seconds.
sysd = c2d(sys,Ts,method) gives access to alternative discretization schemes. The string method selects the discretization method among the following:
| 'zoh' | Zero-order hold. The control inputs are assumed piecewise constant over the sampling period Ts. |
| 'foh' | Triangle approximation (modified first-order hold, see [1], p. 151). The control inputs are assumed piecewise linear over the sampling period Ts. |
| 'imp' | Impulse-invariant discretization |
| 'tustin' | |
| 'prewarp' | Tustin approximation with frequency prewarping. You must specify the critical frequency Wc (in rad/s) as a fourth input as in sysd = c2d(sysc,ts,'prewarp',Wc) |
| 'matched' | Matched pole-zero method. See [1], p. 147. |
Refer to Continuous/Discrete Conversions of LTI Models for more detail on these discretization methods.
c2d supports MIMO systems (except for the 'matched' method) as well as LTI models with delays with some restrictions for 'matched' and 'tustin' methods.
For state-space systems,
[sysd,G] = c2d(sys,Ts,method)
returns a matrix G that maps the continuous
initial conditions
and
to their discrete
counterparts
and
according to

Consider the system
![]()
with input delay
second. To discretize this system
using the triangle approximation with sample time
second, type
H = tf([1 -1],[1 4 5],'inputdelay',0.35)
Transfer function:
s - 1
exp(-0.35*s) * -------------
s^2 + 4 s + 5
Hd = c2d(H,0.1,'foh')
Transfer function:
0.0115 z^3 + 0.0456 z^2 - 0.0562 z - 0.009104
---------------------------------------------
z^6 - 1.629 z^5 + 0.6703 z^4
Sampling time: 0.1
The next command compares the continuous and discretized step responses.
step(H,'-',Hd,'--')

For most LTI systems, the ZOH, FOH, and IMP methods produce exact discretizations in the time domain. In this context, exact means that the time responses of the continuous and discretized models match exactly for the following classes of input signals:
Staircase inputs for ZOH
Piecewise linear inputs for FOH
Impulse trains for impulse IMP
This exact match makes these discretization methods well suited for time-domain simulations.
LTI models with exact discretizations include:
Linear systems without delays
Linear systems with delays at the inputs and outputs of the form

For systems with delays in feedback loops, similar to the system in the following figure, the ZOH and FOH methods result in approximate discretizations.

For such systems, c2d uses the following steps to compute an approximate ZOH or FOH discretization:
The delay
is
decomposed as
with
.
The fractional delay
is
absorbed into H(s). Then, H(s) is discretized to H(z).
The discretized model is assembled as shown in the following figure:

For more information on time delays, see Time Delays in the Control System Toolbox™ documentation.
The Tustin and Matched methods typically perform better in the frequency domain because they introduce less gain and phase distortion near the Nyquist frequency. The Tustin method uses a bilinear transformation to compute the discretized model. This method rounds fractional delays to the nearest integer multiple of the sampling period.
[1] Franklin, G.F., J.D. Powell, and M.L. Workman, Digital Control of Dynamic Systems, Second Edition, Addison-Wesley, 1990.
[2] L.F. Shampine and P. Gahinet, "Software for Modeling and Analysis of Linear Systems with Delays," American Control Conference, 2004.
![]() | bodeplot | canon | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |