S&S S&S S&S Signals Systems (-96) Spring Semester, 2009 Department of Electrical Computer Engineering SOLUTION OF DIFFERENTIAL AND DIFFERENCE EQUATIONS Note: These notes summarize the comments from the lecture on January 25, 2009 concerning the solution of linear constant-coefficient differential difference equations. Introduction Differential equations difference equations are a complementary way of characterizing the response of LTI/LSI systems (along with their impulse responses various transfm-based characterizations that we will discuss later in the semester). In these notes we review how they are solved using two relatively simple examples in continuous time discrete time. I. Linear constant-coefficient differential equations In general, differential equations can be expressed as N d k yt () a k k k 0 M d l xt () b l - l l 0 Recall that the solution to all differential equations is the sum of two solutions, the homogenous solution y h () t the particular solution y p () t : yt () y h () t + y p () t We consider the specific second-der equation yt () with dy() t d2 yt () 2 xt () dx () t xt () e t ut () The homogenous solution ( natural response transient response) reflects characteristics of the system itself, independently of the input to the system. The particular solution ( fced response steady-state response) is dependent only on the characteristics of the input. The homogeneous solution. The homogeneous solution y h () t is obtained by assuming solutions of the fm y h () t Ae st solving the iginal equation with the input xt () equal to zero:
-96 Notes on Differential Difference Equations-2- Spring, 2009 y h () t dy h () t d2 y h () t - 2 0 Ae st saest s 2 Ae st 0 Dividing by the common term Ae st s s 2 0 solving f s we obtain the characteristic equation which solves to ( s + ) ( s 2) 0 s 2 s The most general fm of the solution would be a linear combination of the two terms: y h () t A e t + A 2 e 2t f t > 0 The particular solution. The particular solution is obtained by assuming an output that is proptional to the input, at least f exponential inputs. (Remember also that a constant input is a special case of the exponential input.) In our example we would have Plugging this s 2 + 2s 0 y p () t Ke t y p () t y p () t into our equation, we obtain dy p () t d2 y p () t - 2 xt () dx () t Ke t ( )Ke t 9 ( )Ke t e t ( )e t Dividing both sides by the common fact e t we obtain K 9 + + 9 + K 2-5 Completing the solution. Combining our results, we now have yt () y h () t + y p () t A e t A 2 e 2t 2 t + + -e 5 We obtain values f the remaining coefficients A A 2 by invoking the conditions of initial rest that are necessary f the system to be linear time invariant. This means that at the instant befe the input is applied ( t 0 in our case), yt () all its derivatives must equal zero:
-96 Notes on Differential Difference Equations Spring, 2009 yt () t 0 dy - t 0 0 This produces 2 A + A 2 + - 0 f yt () 5 A + 2A 2 2-0 5 f dy - Solving the system of equations (with the help of MATLAB) produces A 7 A 2. yt () 7e t.e 2t 2 + -e t ut () 5 II. Linear constant-coefficient difference equations x[n] h[n] y[n] Introduction. Difference equations in discrete-time systems play the same role in characterizing the timedomain response of discrete-time LSI systems that differential equations play f continuous-time LTI systems. In the most general fm we can write difference equations as N M a k yn k b m xn [ m] k 0 m 0 where (as usual) xn [ ] represents the input yn [ ] represents the output. Since we can set a 0 equal to 0 without any loss of generality, we can rewrite this as N yn [ ] a k yn [ k] + b m xn [ m] k M m 0 In this representation we characterize the present output of an LSI system as a linear combination of past outputs combined with a linear combination of the present previous inputs. As befe, the difference equations alone do not uniquely specify the system. Initial conditions are needed as well. Nmally we
-96 Notes on Differential Difference Equations Spring, 2009 assume initial rest (i.e. the output is zero befe the input is applied). Otherwise the system would be neither linear n shift-invariant, as was discussed in Problem Set. Difference equations can be solved analytically, just as in the case of dinary differential equations. As befe, the solution involves obtaining the homogenous solution ( the natural frequencies) of the system, the particular solution ( the fced response). In this hout we consider the specific example of the simple difference equation yn [ ] y[ n ] y[ n 2] xn [ ] x[ n ], yn [ ] y[ n ] + y[ n 2] + x[ n] x[ n ] Solution by iteration. Let s first obtain the solution of this equation via iteration. This can be done by setting up a table of variables, entering the known entries f xn [ ] xn [ ] f all n, plus the initial conditions yn [ ] yn [ 2] 0 f n 0 yn [ 2] 0 f n, then filling in the remaining entries row by row:: n x[ n] xn [ ] yn [ 2] yn [ ] yn [ ] 0 0 0 0 / 0 2 /9 / 7/2 /27 /9 7/2 etc. / /27 7/2 We see, f example, that y[ 0] y[ ]. The homogeneous solution. As befe, the homogeneous solution is obtained by assuming solutions of an exponential fm, although this time we will use solved with the input y h [ n] xt () y h [ n ] Aα n Aαn equal to zero: y h [ n 2] 0 Aα n 2 0. Again, the iginal equation is Dividing by the common term Aα n solving f α we obtain the characteristic equation α α 2 0 y h [ n] y h [ n] Aα n
-96 Notes on Differential Difference Equations-5- Spring, 2009 α 2 α 0 which solves to α + α 0 α 2 α 2 The most general fm of the solution would be a linear combination of the two terms: y h [ n] A f n + A 2 2 n n > 0 The particular solution. As befe, particular solution is obtained by assuming an output that is proptional to the input. Here we would have Unftunately, the initial conditions can not be applied as easily f the case of discrete-time systems as they are f continuous-tome systems.in the case of the differential equations, the initial conditions are that the output all its derivitatives are zero when the input is applied. In the case of the difference equations the constraints are that all values of the output are zero when the input is applied. (Actually it is only necessary f the previous N values to be zero. In the example given, N 0 so the initial conditions are yn [ ] yn [ 2] 0. The problem arises because the total system input is (i.e. the right side of the difference equation) is This is an issue because while the first term is valid f n 0, the second term is valid only f n. Hence a single set of initial conditions cannot be applied at n 0. There are at least two ways of wking around this problem. SOLUTION I y p [ n] Kβ n n un [ ] n un [ ] In this method (which is the one discussed in the lecture) we first solve f a simple exponential input then obtain the solution we really want via superposition. Specifically, we solve the equation vn [ ] v[ n ] v[ n 2] n un [ ] The solution to our iginal equation is then obtained via superposition: yn [ ] v[ n] v[ n ] Note that vn [ ] v h [ n] + v p [ n] v h [ n] y h [ n] which we have already obtained.
-96 Notes on Differential Difference Equations-6- Spring, 2009 The particular solution can be easiliy obtained by letting v p [ n] K n Plugging in to the iginal equation we obtain v p [ n] v p [ n ] v p [ n 2] n un [ ] K n K n K n 2 n Dividing through by the common fact n we obtain K ( )K K 9 9 ( )K 7 v p [ n] 7 n Hence, the total solution is vn [ ] A + A 2 2 7 n Now we can apply the initial conditions v[ ] v[ 2] 0. Solving f n n 2 in turn, we obtain A A 2 2 + 7 0 A 2 A 2 2 2 + 7 2 0... A + 2A 2 6A + A 2 2-7 72-7 Solving this system of equations yields A A. 7 2 2
-96 Notes on Differential Difference Equations-7- Spring, 2009 So the complete solution f vn [ ] is vn [ ] n 2 7 2 n + 7 n un [ ] And now we can (finally) obtain our iginal solution as yn [ ] v[ n] v[ n ] yn [ ] n 2 7 2 n 7 n + un [ ] n 2 7 2 n 7 n + un [ ] Note that y[ 0] y[ ] as obtained iginally by iteration. This is a lot of wk! We will be able to obtain the same result much me easily later in the semester via transfm techniques. SOLUTION 2 The second approach (which probably is easier) is to use the iginal equation solve f the undetermined coefficients applying the initial conditions f values of n that occur after all inputs have been applied. These values would nmally be obtained by iteration. Details on this approach will be added later.