Question: How can I go from a continuous time linear ODE to a discrete time representation?

From FBSwiki
Jump to navigation Jump to search
Chapter(s) System Modeling
Author(s) Lars Cremean
Date 2023/10/08

MATLAB has functions built-in to the Control Systems Toolbox that handle conversion between continuous and discrete time using various methods. You can represent your continuous time system (written in standard first order form) with the "sys" command

 sysc = sys(A,B,C,D)

and convert it to discrete-time with the function "c2d":

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

There are a couple of good references for the mathematics behind these conversions. Franklin, Powell and Enami-Naeni has a section on this, and Mathworks has some excellent material on manipulating linear time-invariant (LTI) systems in their help files.

1 Jan 2024 (RMM): The Python Contorol Systems Toolbox has similar functionality via the sample_system() function.