Lecture From Continuous-Time to Discrete-Time Outline. Continuous and Discrete-Time Signals and Systems................. What is a signal?................................2 What is a system?............................. 3.2 Discretizing a CT Signal by Uniform Sampling................. 3.3 Generating a CT Signal from a DT Signal using the Zero-Order Hold..... 4.4 Discretization of CT Systems........................... 4.4. CT, no-input state equations and solution................ 5.4.2 Exact discretization............................ 7. Continuous and Discrete-Time Signals and Systems.. What is a signal? A signal is a function of time that represents a physical quantity such as a force, position, or voltage. Continuous-time (CT) signals x(t) : t is continuous, t R (the set of real numbers) x(t) takes on continuous values x(t) t Updated: September 28, 27
Discrete-time (DT) signals x[n] : n is discrete, an integer, n Z (the set of integer numbers, Z {...,,,,...}) x[n] can take continuous or discrete values x[n] 2 2 2 3 4 n In this class, we focus on DT signals: CT signals were treated extensively in Control Systems & 2. In DT the math is simpler, which allows us to focus on concepts. Integrals are replaced by sums, differentiation is replaced by finite differences, and the Dirac delta function is replaced by the unit impulse. Algorithms are implemented in discrete time on computers. We focus on discrete-time signals with the signal x[n] taking on continuous values: Assuming continuous values simplifies the math. This is a good approximation: On modern computers the double data type stores numbers using 8 bytes ( 64 bits) and hence allows for 2 64 2 different values. x[n] can be a vector, however we mainly deal with scalar signals in this class. x[n] can be a complex number: x[n] x [n] + jx 2 [n], x [n], x 2 [n] R, j 2 A word on notation A sequence is a DT signal. The terms are used interchangeably. x denotes a signal. It is a function of time. x[n] indicates the value of x at the discrete time n. x(t) indicates the value of x at the continuous time t. {x[n]} refers to the entire sequence. It is the same as x for DT signals. Motivated by the above, {x(t)} refers to the entire CT signal. It is the same as x for CT signals. 2
Signal representations In this class, you will encounter three different representations of DT signals: Graph: x[n] 2 4 8 2 2 3 n Rule: Sequence: x[n] : { ( 2 )n n n < {x[n]} {...,,, 2, 4,... }, where the arrow indicates the value at n. If an arrow is absent, the first value of the sequence is assumed to occur at time n...2 What is a system? A system G operates on the input signal u to produce the output signal y, an operation denoted as y Gu and illustrated as: u Input G y Output Note that, depending on G, the output y could depend on past, current, and future values of the input u..2 Discretizing a CT Signal by Uniform Sampling Sampling a CT signal {x(t)} at uniformly-spaced points in time results in the DT sequence {x[n]}, where x[n] x(nt s ) for all integers n, and where T s is the sampling period. The variable f s T s frequency. is the sampling x[n] 2 3 4 n 3
.3 Generating a CT Signal from a DT Signal using the Zero- Order Hold A CT signal {x(t)} can be obtained from a DT signal {x[n]} by holding the value of the DT signal constant for one sampling period T s, such that: This is known as the zero-order hold. x(t) x[n] nt s t < (n + )T s. x(t) T s 2T s 3T s 4T s t Alternative methods exist to obtain a CT signal from a DT signal, such as the first-order hold: x(t) T s 2T s 3T s 4T s t However, in this class we will exclusively work with zero-order hold, which we will simply call hold..4 Discretization of CT Systems To interact with a CT (eg. real-world ) system G c from a DT environment (eg. a computer), we need to convert a DT signal into a CT signal, and vice versa. To capture this formally, we employ the previously-introduced hold and sample operators, respectively. {u[n]} {u(t)} {y(t)} {y[n]} H G c S By defining the DT system G d : SG c H, the previous figure can be replaced by: {u[n]} G d {y[n]} 4
In the following, we consider the case where G c is a CT linear time-invariant (LTI) system with a state-space description q(t) A c q(t) + B c u(t) y(t) C c q(t) + D c u(t). (.) This type of continuous-time system has been covered in other classes (E.g. Control Systems ). The solution to the differential equation is q(t) e Act q() + t e Ac(t τ) B c u(τ)dτ. The goal is to find a description for the DT LTI system G d SG c H. To this end, we calculate the output of G c at time t nt s, y(nt s ), exactly for a zero-order held input as defined above..4. CT, no-input state equations and solution It turns out that we can simplify the state equations in (.), since the input is constant during a sampling period, due to the zero-order hold assumption. In particular, we will show in Section.4.2 that we can rewrite the system as a zero-input (or homogeneous) system of the type Such a system has the straightforward solution where e Mt is the matrix exponential: ṙ(t) Mr(t). (.2) r(t) e Mt r(), (.3) e Mt : I + Mt + (Mt)2 2 + + (Mt)k k! (Mt) k +. k! k Note that, when M is a scalar (matrix of dimension ), we recover the standard definition of the exponential. Furthermore, it can be shown that the power series defining the matrix exponential converges for all real (or complex) square matrices. Proof that the solution (.3) satisfies the differential equation (.2). Let It follows that r(t) e Mt r(). ṙ(t) demt r(). dt 5
For convergent power series, the derivative can be evaluated as: de Mt dt d dt (Mt) k k k! km k t k k! k k M km k t k k M k t k (k )! M l Me Mt. k k! M k t k (k )! M l t l with the substitution l : k l! ṙ(t) Me Mt r() Mr(t). Example (double integrator with zero input) Consider the system described by the differential equation ÿ(t) with initial conditions ẏ() v, y() y. We can immediately write the solution: ẏ(t) v, y(t) y + v t. The solution can also be derived using the matrix exponential: Let [ ] [ ] r (t) y(t) r(t) : r 2 (t) ẏ(t) [ ] y r(). Then ] [ṙ (t) ṙ 2 (t) v [ ] r2 (t) Note that the matrix M is nilpotent because and therefore [ r (t) r 2 (t) M 2 [ ] }{{} M e Mt I + Mt ] [ ] [ t y 6 v [ ] r (t). r 2 (t) ].
Remark (relation to the Euler forward method) When t is very small, the matrix exponential can be approximated by and therefore e Mt I + Mt r(t) r() + tmr(). The Euler forward method, a method of approximating a function s derivative, is defined as For small t, and with ṙ() r(t) r(). t ṙ(t) Mr(t) we have r(t) r() Mr(), t r(t) r() + tmr(). We find that the Euler forward method gives the same result as a first-order approximation to the matrix exponential..4.2 Exact discretization The original problem was, for the first time step q(t) A c q(t) + B c u(t), u(t) u[] t < T s q() q[], where u is constant over the sampling interval due to the zero-order hold device and we set the initial state q() to its discrete-time counter-part q[]. We can rewrite these equations as the zero-input system (.2) [ ] q(t) u(t) [ ] Ac B c }{{} : M [ ] q(t) u(t) by including the input in the state of this adapted system. Therefore, the solution at time T s, just before the sampling time, is [ ] q(t s ) u(ts F ) [ ] q() u() with [ ] F F F 2 e MTs. F 2 F 22 7
It is easy to show that F 2 and F 22 I, since M k [ ] for any integer k. This result is expected, since u is constant over the sampling interval and thus u(t s ) u(). Let Then A d F, B d F 2 C d C c, D d D c. q[] A d q[] + B d u[] y[] C d q[] + D d u[]. We can do this for any time period, since the CT system is time invariant, and thus obtain: q[n + ] A d q[n] + B d u[n] y[n] C d q[n] + D d u[n] which is the description of the DT system G d SG c H that we were looking for. Comments: This is the exact solution to the differential equation, there are no discretization errors. While it is exact, information is still lost by the discretization: The inter-sample behavior. 8
Example (mass-spring-damper system) Consider a mass-spring-damper system with the differential equation p(t) + ṗ(t) + p(t) f(t) and compare the Euler discretization to the exact discretization, with sampling times of.s and.5s. The input to the continuous and discretized models is a pulse with a width of.5 seconds, identical to the longest sampling time used. 2.5 continuous T s.s T s.5s Input (N).5 2 3 4 5 6 7 8 9 Time (s) When discretizing using the Euler discretization, the output strongly depends on the discretization time, and differs from the continuous-time output even for small sampling times (remember that the Euler discretization is identical to a first-order approximation of the matrix exponential the errors seen here stem from this approximation): Euler Discretization.8.6 continuous T s.s T s.5s Position (m).4.2.2.4 2 3 4 5 6 7 8 9 Time (s) 9
The exact discretization has no discretization errors. The discrete-time output coincides with the continuous-time output at the sampling times:.6.4 Exact Discretization continuous T s.s T s.5s Position (m).2 2 3 4 5 6 7 8 9 Time (s)