Creating discrete-time models
This example shows how to create linear models with discrete time.
Definition of discrete-time models
The ControlSystems library.jl allows you to create both continuous and discrete systems. The syntax for creating discrete-time models is similar to that used for continuous systems, but the sampling step (the sampling interval in seconds) must be passed in the input data to the function.
For example, to set the transfer function of a discrete system:
With a sampling period .
Pkg.add(["ControlSystems"])
using ControlSystems
num = [1, -1];
den = [1, -1.85, 0.9];
H = tf(num,den,0.1)
Similarly, you can define a model of a discrete system in the state space.:
With a sampling period .
sys = ss(.5,1,.2,0,0.1)
Recognition of discrete-time systems
There are several ways to determine whether a linear model is discrete. For example, sys.Ts
or H.Ts
a non-zero value is returned if the model is discrete.
H.Ts
It can also be determined by the graph of the transition function. The system's response to a single step-by-step effect will have the form of a "ladder".
using Plots
plot(step(H,8))
Thus, it is possible to obtain a model of a discrete system. For more information about creating linear systems, see Building Systems.