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. Several conversion methods are supported, including:
You can use these commands to perform basic zero-order hold conversions:
>> sysd = c2d(sysc,Ts); % Ts = sampling period in seconds
>> sysc = d2c(sysd);
You 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'.
For example, you can discretize the continuous-time model
sysc = tf([1 0.5 100],[1 5 100]);
with a 0.1 sec sampling time as follows:
sysd = c2d(sysc,0.1); % uses zero-order hold
You can compare the step responses of these systems using the STEP command:
step(sysc,'b',sysd,'r')
Run the "Notch Filter Discretization" demo for a detailed illustration of the effect of various discretization methods on the conversion of this continuous-time model to its discrete time equivalent:
>> notchdemo