Control System Toolbox 8.4
Introduction to the Control System Toolbox - 5 - Converting Between Continuous and Discrete Models
In this demo, we'll use the Control System Toolbox to convert between continuous-time and discrete-time systems. We'll use several of the conversion methods the toolbox supports:
- Zero-order hold
- First-order hold
- Tustin approximation (bilinear)
- Tustin with frequency prewarping
- Matched poles and zeros
Contents
Introduction
This diagram the conversion process we will be discussing.
GSC2DConversions_aux(1); % Draw Diagram
Figure 1: Continuous/Discrete Conversions.
Performing Continuous/Discrete Conversions
The function C2D converts TF, ZPK, and SS models from continuous time to discrete time equivalents. Conversely, the function D2C converts these models from discrete time to continuous time equivalents.
We'll use these commands to perform basic zero-order hold conversions:
sysd = c2d(sysc,Ts); % Ts = sampling period in seconds
sysc = d2c(sysd);
We can specify alternative conversion methods with an extra string input
sysd = c2d(sysc,Ts,Method);
sysc = d2c(sysd,Method);
where Method can be 'zoh', 'foh', 'tustin', 'prewarp', or 'matched'.
GSC2DConversions_aux(2); % Draw Diagram
Figure 2: Continuous/Discrete Conversions
Example: Making a Continuous-to-Discrete Conversion
In this code example, we'll discretize a continuous-time model with a 0.1 second sampling time as follows:
sysc = tf([1 0.5 100],[1 5 100]) % Create continuous transfer-function
Transfer function: s^2 + 0.5 s + 100 ----------------- s^2 + 5 s + 100
sysd = c2d(sysc,0.1) % Uses zero-order hold
% to discretize the continuous system
Transfer function: z^2 - 1.181 z + 0.9047 ----------------------- z^2 - 0.8828 z + 0.6065 Sampling time: 0.1
You can compare the step responses of these systems using the step function:
step(sysc,'b',sysd,'r')
Figure 3: Step Response of continuous and discrete verions of a system
Additional Information
For more information on feedback control design with the Control System Toolbox, see the Control System Toolbox product information page.
From here you can download a free 30-day trial, read the documentation and user stories, request more information, and get pricing information. See these additional demos of Control System Toolbox functionality:
Store