Continuous/Discrete Conversions of LTI Models

Supported Conversion Functions and Methods

The function c2d discretizes continuous-time TF, SS, or ZPK models. Conversely, d2c converts discrete-time TF, SS, or ZPK models to continuous time. Several discretization/interpolation methods are supported, including zero-order hold (ZOH), first-order hold (FOH), Tustin approximation with or without frequency prewarping, and matched poles and zeros.

The syntax

sysd = c2d(sysc,Ts);     % Ts = sampling period in seconds
sysc = d2c(sysd);

performs ZOH conversions by default. To use alternative conversion schemes, specify the desired method as an extra string input:

sysd = c2d(sysc,Ts,'foh');	% use first-order hold
sysc = d2c(sysd,'tustin');	% use Tustin approximation

Zero-Order Hold

Zero-order hold (ZOH) devices convert sampled signals to continuous-time signals for analyzing sampled continuous-time systems. The zero-order-hold discretization of a continuous-time LTI model is depicted in the following block diagram.

The ZOH device generates a continuous input signal u(t) by holding each sample value u[k] constant over one sample period.

The signal is then fed to the continuous system , and the resulting output is sampled every seconds to produce .

Conversely, given a discrete system , the d2c conversion produces a continuous system whose ZOH discretization coincides with . This inverse operation has the following limitations:

The next example illustrates the behavior of d2c with real negative poles. Consider the following discrete-time ZPK model.

hd = zpk([],-0.5,1,0.1)
Zero/pole/gain:
   1
-------
(z+0.5)
 
Sampling time: 0.1

Use d2c to convert this model to continuous-time

hc = d2c(hd)

and you get a second-order model.

Zero/pole/gain:
   4.621 (s+149.3)
---------------------
(s^2 + 13.86s + 1035)

Discretize the model again

c2d(hc,0.1) 

and you get back the original discrete-time system (up to canceling the pole/zero pair at z=-0.5):

Zero/pole/gain:
 (z+0.5)
---------
(z+0.5)^2
 
Sampling time: 0.1

First-Order Hold

First-order hold (FOH) differs from ZOH by the underlying hold mechanism. To turn the input samples into a continuous input , FOH uses linear interpolation between samples.

This method is generally more accurate than ZOH for systems driven by smooth inputs. Due to causality constraints, this option is only available for c2d conversions, and not d2c conversions.

Impulse Invariance

The impulse invariant mapping matches the discretized impulse response to that of the continuous time system. For example:

n=1;d=[1 1]; % Simple 1st order continuous system 
sc=ss(tf(n,d)); % state space representation 
sd1=c2d(sc,0.01,'imp'); % Convert to discrete system via impulse
                        % invariant 
impulse(sc,sd1) % Plot both impulse responses 

Note that the impulse responses match. The frequency responses do not match, however, because of scaling factor Ts, the sample time. For example,

bode(sc,0.01*sd1) % scaled by Ts 

Although the impulse invariant transform is ideal when you are interested in matching the impulse response, it may not be a good choice if you are interested in matching the frequency response of the continuous system, because it is susceptible to aliasing. For example,

sd2=c2d(sc,0.2,'imp'); 
sd3 = c2d(sc,0.5,'imp'); 
bode(sc,0.01*sd1, 0.2*sd2, 0.5*sd3)

As the sampling time increases, you can see the effects of aliasing. In general, if you are interested in matching the frequency response of the continuous system, a bilinear transform (such as Tustin Approximation) is a better choice. For example, using the tustin bilinear transform for the same example,

bode(sc,c2d(sc,0.01,'tustin'))
c2d(sc,0.2,'tustin')
c2d(sc,0.5,'tustin'))

you can see that aliasing is no longer an issue.

See any standard text in digital signal processing for a discussion of impulse invariance scaling issues and aliasing.

Tustin Approximation

The Tustin or bilinear approximation uses the approximation

to relate s-domain and z-domain transfer functions. In c2d conversions, the discretization of a continuous transfer function is derived by

Similarly, the d2c conversion relies on the inverse correspondence

Tustin with Frequency Prewarping

This variation of the Tustin approximation uses the correspondence

This change of variable ensures the matching of the continuous- and discrete-time frequency responses at the frequency .

Matched Poles and Zeros

The matched pole-zero method applies only to SISO systems. The continuous and discretized systems have matching DC gains and their poles and zeros correspond in the transformation

See [2] for more details.

Discretization of Systems with Delays

You can also use c2d to discretize SISO or MIMO continuous-time models with time delays. If Ts is the sampling period used for discretization:

For example, to discretize the transfer function

using zero-order hold on the input, and a 10 Hz sampling rate, type

h = tf(10,[1 3 10],'inputdelay',0.25);
hd = c2d(h,0.1)

This produces the discrete-time transfer function

Transfer function:
         0.01187 z^2 + 0.06408 z + 0.009721
z^(-3) * ----------------------------------
             z^2 - 1.655 z + 0.7408
 
Sampling time: 0.1

Here the input delay in amounts to 2.5 times the sampling period of 0.1 seconds. Accordingly, the discretized model hd inherits an input delay of two sampling periods, as confirmed by the value of hd.inputdelay. The residual half-period delay is factored into the coefficients of hd by the discretization algorithm.

The step responses of the continuous and discretized models are compared in the figure below. This plot was produced by the command

step(h,'--',hd,'-')

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS