3.5 Discrete-Time Models of Continuous-Time Systems
If an analog system is to be analyzed in the discrete-time domain, the problem arises of finding a discrete-time representation of the system such that the output variables sampled at times suitably approximate the ones of the original system. A possible way to make such a conversion is to apply the function ToDiscreteTime to a continuous-time system. ToDiscreteTime operates on all control objects. Note that the built-in functions LaplaceTransform and ZTransform can, in principle, perform similar task. However, the procedures in Control System Professional use the state-space approach and so the conversion is, as a rule, more efficient.
Finding discrete-time equivalents of continuous-time systems.
Consider a simple continuous-time system.
This is a possible discrete-time approximation. As noted previously, the formal internal variable (in this case s) does not indicate the domain, but the Sampled option does.
Should the need arise, it is easy to rename the formal variable.
Consider a state-space continuous-time system.
This is its discrete-time approximation. The result is still a StateSpace object that is in the discrete-time domain as indicated by the option Sampled.
Here is the same system in TraditionalForm.
The default value for the option Sampled in ToDiscreteTime is the global variable $SamplingPeriod. This variable also provides a fallback where some functions retreat in situations when the sampling period does not evaluate to a number, but the numeric value is needed to perform the task (for example, to simulate the transient behavior of a system). Thus, $SamplingPeriod must never be set to anything that has no numeric value. If it is desirable for ToDiscreteTime to use a symbolic sampling period T by default, this can be easily achieved by using the standard Mathematica mechanism, say with a command .
It is worth emphasizing that the "conversion" from an analog to a sampled system is merely an approximation, the quality of which depends on the method used and the sampling period. The time-domain response functions described later in Chapter 4 can make the difference between the original and approximated system readily apparent.
This is the analog output response of the original system to the sinusoidal input signal.
Here is a piece of that curve on the time interval from 0 to 10 seconds.
This plots the simulated response of the discrete-time system for the sampling period of 0.5 seconds over the same time interval. For reference, we include the analog response from the previous plot (structurally, the line is the first element of the Graphics object returned by the previous command and is extracted with First).
We can see that the sampled values systematically lag behind corresponding points on the analog curve, which is typical for the default ZeroOrderHold method. Choosing smaller values for can make the lag less noticeable.
3.5.1 The Conversion Methods
The conversion from the continuous-time domain to the discrete-time domain can be performed using the following methods (see Franklin et al. (1990), Section 4). The method can be selected with the Method option.
Hold equivalence methods—zero- and first-order (triangle) hold, implemented with ZeroOrderHold and FirstOrderHold, respectively
Numerical integration methods—forward and backward rectangular rules, implemented with ForwardRectangularRule and BackwardRectangularRule, respectively, and bilinear (Tustin) transformation with and without prewarping, implemented with BilinearTransform
Zero-pole mapping, implemented with ZeroPoleMapping
Options related to continuous- to discrete-time conversion.
This is the result of conversion with the forward rule of the transfer function system tf defined earlier in this chapter.
This is the conversion of the same transfer function using the backward rule.
This conversion uses the bilinear transformation.
This uses the zero-pole mapping.
This is the first-order-hold equivalent of the transfer function .
Yet another example, which uses a lag network, illustrates the effect of the option CriticalFrequency on accuracy of the conversion.
Here is the Bode plot for the network for some set of parameters.
This is the network after the bilinear transformation.
This computes the Bode plots for continuous and sampled lag networks—and displays them together using a utility function DisplayTogetherGraphicsArray (see Section 12.5). The responses coincide for the low frequencies but differ somewhat near the Nyquist frequency.
We again use BilinearTransform, this time with frequency prewarping at some critical frequency .
We have achieved a perfect match at that frequency at the expense of less accurate behavior at other frequencies.
Except for zero-pole mapping, which naturally operates on ZeroPoleGain objects, the conversion from the continuous- to the discrete-time domain is implemented with state-space algorithms. Therefore, the transformation to and from StateSpace objects can be avoided if the system is represented in StateSpace in the first place.
This is our lag system as a StateSpace object.
This converts the system to discrete time using the bilinear transformation.