6.003: Signals and Systems Discrete Approximation of Continuous-Time Systems September 29, 2011 1 Mid-term Examination #1 Wednesday, October 5, 7:30-9:30pm, No recitations on the day of the exam. Coverage: CT and DT Systems, Z and Laplace Transforms Lectures 1–7 Recitations 1–7 Homeworks 1–4 Homework 4 will not collected or graded. Solutions will be posted. Closed book: 1 page of notes (8 12 × 11 inches; front and back). No calculators, computers, cell phones, music players, or other aids. Designed as 1-hour exam; two hours to complete. Review sessions during open office hours. Conflict? Contact before Friday, Sept. 30, 5pm. Prior term midterm exams have been posted on the 6.003 website. 2 Concept Map Today we will look at relations between CT and DT representations. Delay → R Block Diagram X + + Delay DT System Functional Y Y 1 = H(R) = X 1 − R − R2 Delay Unit-Sample Response index shift h[n] : 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, . . . Difference Equation CT System Function Y (z) z2 = 2 X(z) z −z−1 y[n] = x[n] + y[n−1] + y[n−2] H(z) = Delay → R Block Diagram + X R − + R − System Functional 1 2 1 T D Y 2A2 = X 2 + 3A + A2 Y Impulse Response ẋ(t) R x(t) h(t) = 2(e−t/2 − e−t ) u(t) CT Differential Equation 2ÿ(t) + 3ẏ(t) + y(t) = 2x(t) System Function Y (s) 2 = 2 X(s) 2s + 3s + 1 3 Discrete Approximation of CT Systems Example: leaky tank r0 (t) h1 (t) r1 (t) R X AX Block Diagram + X − 1 τ System Functional R A Y = X A+τ Y Impulse Response ẋ(t) R x(t) h(t) = τ1 e−t/τ u(t) Differential Equation System Function Y (s) 1 = X(s) 1 + τs τ ṙ1 (t) = r0 (t) − r1 (t) H(s) = Today: compare step responses of leaky tank and DT approximation. 4 Check Yourself (Practice for Exam) What is the “step response” of the leaky tank system? u(t) s(t) =? Leaky Tank 1 1 1. 2. τ t τ 1 t 1 3. 4. τ t τ 5. none of the above 5 t Check Yourself What is the “step response” of the leaky tank system? de: τ ṙ1 (t) = u(t) − r1 (t) t < 0: r1 (t) = 0 t > 0: r1 (t) = c1 + c2 e−t/τ ṙ1 (t) = − cτ2 e−t/τ Substitute into de: τ − cτ2 e−t/τ = 1 − c1 − c2 e−t/τ → c1 = 1 Combine t < 0 and t > 0: r1 (t) = u(t) + c2 e−t/τ u(t) c2 ṙ1 (t) = δ(t) + c2 δ(t) − e−t/τ u(t) τ Substitute into de: c2 τ (1 + c2 )δ(t) − τ e−t/τ u(t) = u(t) − u(t) − c2 e−t/τ u(t) τ r1 (t) = (1 − e−t/τ )u(t) 6 → c2 = −1 Check Yourself Alternatively, reason with systems! δ(t) δ(t) δ(t) A A+τ h(t) = τ1 e−t/τ u(t) u(t) A A+τ s(t) =? A A+τ s(t) =? u(t) A A A+τ Z t h(t) A s(t) = −∞ t 1 I 1 −tI /τ ' ' u(t )dt = e e−t /τ dt' = (1 − e−t/τ ) u(t) −∞ τ 0 τ t s(t) = h(t0 )dt0 7 Check Yourself What is the “step response” of the leaky tank system? u(t) s(t) =? Leaky Tank 1 2 1 1. 2. τ t τ 1 t 1 3. 4. τ t τ 5. none of the above 8 t Forward Euler Approximation Approximate leaky-tank system using forward Euler approach. Approximate continuous signals by discrete signals: xd [n] = xc (nT ) yd [n] = yc (nT ) Approximate derivative at t = nT by looking forward in time: y [n+1] − yd [n] ẏc (nT ) = d T yc (t) yd [n+1] yd [n] nT (n+1) T 9 t Forward Euler Approximation Approximate leaky-tank system using forward Euler approach. Substitute xd [n] = xc (nT ) yd [n] = yc (nT ) yc (n + 1)T − yc nT y [n + 1] − yd [n] ẏc (nT ) ≈ = d T T into the differential equation τ ẏc (t) = xc (t) − yc (t) to obtain τ y [n + 1] − yd [n] = xd [n] − yd [n] . T d Solve: T T yd [n + 1] − 1 − yd [n] = xd [n] τ τ 10 Forward Euler Approximation Plot. 1 T τ = 0.1 T τ = 0.3 t 1 t 1 T τ =1 t 1 T τ = 1.5 t 1 T τ τ =2 t Why is this approximation badly behaved for large Tτ ? 11 Check Yourself DT approximation: T T yd [n] = xd [n] yd [n + 1] − 1 − τ τ Find the DT pole. T τ τ 3. z = T 2. z = 1 − 1. z = 4. z = − 5. z = 1 1 + Tτ 12 τ T T τ Check Yourself DT approximation: T T yd [n] = xd [n] yd [n + 1] − 1 − τ τ Take the Z transform: T T Yd (z) = Xd (z) zYd (z) − 1 − τ τ Solve for the system function: T Y (z) τ H(z) = d = Xd (z) z− 1− T τ Pole at z = 1 − T . τ 13 Check Yourself DT approximation: T T yd [n] = xd [n] yd [n + 1] − 1 − τ τ Find the DT pole. 2 T τ τ 3. z = T 2. z = 1 − 1. z = 4. z = − 5. z = 1 1 + Tτ 14 τ T T τ Dependence of DT pole on Stepsize z 1 t T τ = 0.1 T τ = 0.3 z 1 t z 1 T τ t =1 z 1 T τ t = 1.5 z 1 τ T τ t =2 The CT pole was fixed (s = − τ1 ). Why is the DT pole changing? 15 Dependence of DT pole on Stepsize Dependence of DT pole on T is generic property of forward Euler. Approach: make a systems model of forward Euler method. CT block diagrams: adders, gains, and integrators: X A Y ẏ(t) = x(t) Forward Euler approximation: y[n + 1] − y[n] = x[n] T Equivalent system: X T + R Y Forward Euler: substitute equivalent system for all integrators. 16 Example: leaky tank system Started with leaky tank system: + X − 1 τ R Y Replace integrator with forward Euler rule: X + − 1 τ + T R Write system functional: T R TR TR Y τ τ = τ 1−R = = R X 1 − R + Tτ R 1 + Tτ 1−R 1 − 1 − Tτ R Equivalent to system we previously developed: T T yd [n] = xd [n] yd [n + 1] − 1 − τ τ 17 Y Model of Forward Euler Method Replace every integrator in the CT system X A Y with the forward Euler model: X T + Substitute the DT operator for A: T 1 TR T A= → = z 1 = z−1 s 1−R 1− z z−1 . T Or equivalently: z = 1 + sT . Forward Euler maps s → 18 R Y Dependence of DT pole on Stepsize Pole at z = 1 − Tτ = 1 + sT . z 1 t T τ = 0.1 T τ = 0.3 z 1 t z 1 T τ t =1 z 1 T τ t = 1.5 z 1 τ T τ t 19 =2 Forward Euler: Mapping CT poles to DT poles Forward Euler Map: → s 0 1 − T1 0 − T2 −1 s 1 T − T1 − T2 z = 1 + sT z z → 1 + sT −1 1 DT stability: CT pole must be inside circle of radius T1 at s = − T1 . − 2 1 <− <0 τ T → T <2 τ 20 Backward Euler Approximation We can do a similar analysis of the backward Euler method. Approximate continuous signals by discrete signals: xd [n] = xc (nT ) yd [n] = yc (nT ) Approximate derivative at t = nT by looking backward in time: y [n] − yd [n−1] ẏc (nT ) = d T yc (t) yd [n] yd [n−1] (n−1)T nT 21 t Backward Euler Approximation We can do a similar analysis of the backward Euler method. Substitute xd [n] = xc (nT ) yd [n] = yc (nT ) yc nT − yc (n − 1)T y [n] − yd [n − 1] = d T T into the differential equation ẏc (nT ) ≈ τ ẏc (t) = xc (t) − yc (t) to obtain τ yd [n] − yd [n − 1] = xd [n] − yd [n] . T Solve: T T 1+ yd [n] − yd [n − 1] = xd [n] τ τ 22 Backward Euler Approximation Plot. 1 T τ = 0.1 T τ = 0.3 t 1 t 1 T τ =1 t 1 T τ = 1.5 t 1 T τ =2 τ This approximation is better behaved. Why? 23 t Check Yourself DT approximation: T T yd [n] − yd [n − 1] = xd [n] 1+ τ τ Find the DT pole. T τ τ 3. z = T 2. z = 1 − 1. z = 4. z = − 5. z = 1 1 + Tτ 24 τ T T τ Check Yourself DT approximation: T T 1+ yd [n] − yd [n − 1] = xd [n] τ τ Take the Z transform: T T 1+ Yd (z) − z −1 Yd (z) = Xd (z) τ τ Find the system function: Tz Y (z) τ H(z) = d = T Xd (z) 1+ z−1 τ Pole at z = 1 . 1 + Tτ 25 Check Yourself DT approximation: T T yd [n] = xd [n] yd [n + 1] − 1 − τ τ Find the DT pole. 5 T τ τ 3. z = T 2. z = 1 − 1. z = 4. z = − 5. z = 1 1 + Tτ 26 τ T T τ Dependence of DT pole on Stepsize z 1 t T τ = 0.1 T τ = 0.3 z 1 t z 1 T τ t =1 z 1 T τ t = 1.5 z 1 τ T τ t =2 Why is this approximation better behaved? 27 Dependence of DT pole on Stepsize Make a systems model of backward Euler method. CT block diagrams: adders, gains, and integrators: X A Y ẏ(t) = x(t) Backward Euler approximation: y[n] − y[n − 1] = x[n] T Equivalent system: X T + Y R Backward Euler: substitute equivalent system for all integrators. 28 Model of Backward Euler Method Replace every integrator in the CT system X A Y with the backward Euler model: X T + Y R Substitute the DT operator for A: 1 T T A= → = s 1−R 1 − z1 Backward Euler maps z → 1 . 1 − sT 29 Dependence of DT pole on Stepsize Pole at z = 1 1+ Tτ 1 . = 1−sT z 1 t T τ = 0.1 T τ = 0.3 z 1 t z 1 T τ t =1 z 1 T τ t = 1.5 z 1 τ T τ t 30 =2 Backward Euler: Mapping CT poles to DT poles Backward Euler Map: s → 1 z = 1−sT 0 1 − T1 1 2 1 3 − T2 s 0 z 1 z → 1−sT −1 1 The entire left half-plane maps inside a circle with radius 12 at z = 12 . If CT system is stable, then DT system is also stable. 31 Masses and Springs, Forwards and Backwards In Homework 2, you investigated three numerical approximations to a mass and spring system: • forward Euler • backward Euler • centered method x(t) y(t) 32 Trapezoidal Rule The trapezoidal rule uses centered differences. Approximate CT signals at points between samples: 1 y [n] + yd [n − 1] yc (n− )T = d 2 2 Approximate derivatives at points between samples: 1 y [n] − yd [n − 1] ẏc (n− )T = d 2 T 1 yd [n] + yd [n−1] T = 2 2 1 y [n] − yd [n−1] ẏc n− T = d 2 T yc n− yc (t) yd [n] yd [n−1] (n−1)T 33 nT t Trapezoidal Rule The trapezoidal rule uses centered differences. ẏ(t) = x(t) Trapezoidal rule: y[n] − y[n − 1] x[n] + x[n − 1] = T 2 Z transform: Y (s) T 1 + z −1 T z+1 H(z) = = = 2 z−1 X(s) 2 1 − z −1 Map: A= 1 T → s 2 z+1 z−1 Trapezoidal rule maps z → 1 + sT 2 . 1 − sT 2 34 Trapezoidal Rule: Mapping CT poles to DT poles Trapezoidal Map: s → z= 1+ sT 2 1− sT 2 0 1 − T1 1 3 − T2 0 −∞ −1 jω 2+jωT 2−jωT s 0 z z → 2+sT 2−sT −1 1 The entire left-half plane maps inside the unit circle. The jω axis maps onto the unit circle 35 Mapping s to z: Leaky-Tank System Forward Euler Method s z 1 T − T2 − T1 z → 1 + sT −1 1 Backward Euler Method s 0 1 z → 1−sT −1 z 1 Trapezoidal Rule s 0 z → 2+sT 2−sT 36 −1 z 1 Mapping s to z: Mass and Spring System Forward Euler Method s z 1 T − T2 − T1 z → 1 + sT −1 1 Backward Euler Method s 0 1 z → 1−sT −1 z 1 Trapezoidal Rule s 0 z → 2+sT 2−sT 37 −1 z 1 Mapping s to z: Mass and Spring System Forward Euler Method s z 1 T − T2 − T1 z → 1 + sT −1 1 Backward Euler Method s 0 1 z → 1−sT −1 z 1 Trapezoidal Rule s 0 z → 2+sT 2−sT 38 −1 z 1 Concept Map Relations between CT and DT representations. Delay → R Block Diagram + X + Delay DT + − 1 τ R T D Y A = X A+τ Y x(t) h(t) = τ1 e−t/τ u(t) CT Differential Equation τ ṙ1 (t) = r0 (t) − r1 (t) System Function Y (z) z2 = 2 X(z) z −z−1 H(z) = AX Impulse Response ẋ(t) h[n] : 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, . . . Difference Equation System Functional R Delay y[n] = x[n] + y[n−1] + y[n−2] Block Diagram X Y 1 = H(R) = X 1 − R − R2 Unit-Sample Response index shift CX T R System Functional Y System Function Y (s) 1 H(s) = = X(s) 1 + τs 39 MIT OpenCourseWare http://ocw.mit.edu 6.003 Signals and Systems Fall 2011 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.