ECE602 Fall 2008 Homework Solution September 2, 2008 Solution to Homework Assignment. Consider the two-input two-output system described by D (p)y (t)+d 2 (p)y 2 (t) N (p)u (t)+n 2 (p)u 2 (t) D 2 (p)y (t)+d 22 (p)y 2 (t) N 2 (p)u (t)+n 22 (p)u 2 (t) () where the N ij and the D ij are polynomials in the variable p : d dt. function matrix of this system. Solution: We can rewrite the equations in matrix form as follows: [ D (p) D 2 (p) D 2 (p) D 22 (p) ][ y (t) y 2 (t) Iff the D matrix is invertible, we can then compute ] [ N2 (p) N 22 (p) N (p) N 2 (p) ][ u (t) u 2 (t) Find the transfer ] (2) G(p) D N. (3) Because the D ij are scalar polynomials as opposed to block matrices, if D is nonsingular, we can compute the inverse [ ] D D 22 (p) D 2 (p). (4) D D 22 D 2 D 2 D 2 (p) D (p) Note that the formula or the inverse of a block matrix is somewhat more complicated, see e.g. Kailath, p. 656. The transfer function is now [ ] [ ] D (p) D G(s) 2 (p) N2 (p) N 22 (p) D 2 (p) D 22 (p) N (p) N 2 (p) D D 22 D 2 D2 [ D 22 (p) D 2 (p) Finally, repeating the process for y 3 (t) we find ( Y 3 (s) G(s)R 3 (s) ][ ] D 2 (p) N2 (p) N 22 (p). (5) D (p) N (p) N 2 (p) 30 s 3 +0s 2 +3s +30 )( s 2 ). (6) The denominator factors as (s +2)(s +3)(s +5)s 2. To obtain the partial fraction expansion we use the residue command as follows: >> [r,p,k] residue(30,[ 0 3 30 0 0]) r
ECE602 Fall 2008 Homework Solution September 2, 2008 2 0.2000 -.6667 2.5000 -.0333.0000 p -5.0000-3.0000-2.0000 0 0 k [] Thus 30 Y 3 (s) s 5 +0s 4 +3s 3 +30s 2 /5 s +2 + 5/3 s +3 + 5/2 3/00 + + s +5 s s 2 (7) so inverse transforming we have, to four decimal places, y 3 (t) 5 2 e 2t + 5 3 e 3t + 5 e 5t.0333 + t, t 0. (8) To obtain the plots we use a Matlab script such as the following. (I did the calculations two ways to show the agreement between the results.) %%% %%% Problem, Homework %%% t [0:.0:0] ; %%% First the solutions we calculated analytically. for index :00, ya(index) 0*exp(-2*t(index)) - 5*exp(-3*t(index)) + 5*exp(-5*t(index)); y2a(index) -5*exp(-2*t(index)) + 5*exp(-3*t(index)) - exp(-5*t(index)) + ; y3a(index) 5/2*exp(-2*t(index)) + -5/3*exp(-3*t(index)) +... /5* exp(-5*t(index)) -.0333 + t(index); end
ECE602 Fall 2008 Homework Solution September 2, 2008 3 %%% Next the solutions calculated using Matlab. gnum 30; gden [ 0 3 30]; sys tf(gnum,gden); yb impulse(sys,t); u2 ones(size(t)); y2b lsim(sys,u2,t); %%% or equivalently y2b step(sys,t); g3num 30; g3den [ 0 3 30 0]; sys3 tf(g3num,g3den); y3b step(sys3,t); figure() subplot(2,,) plot(t,ya, b,t,yb, r ) title( Problem Comparison of Analytical and Numerical Solutions ) ylabel( Impulse Response y_ ) legend( Analytical, Numerical ) subplot(2,,2) plot(t,ya-yb ) ylabel( Error (analytical - numerical) ) print -depsc figure figure(2) subplot(2,,) plot(t,y2a, b,t,y2b, r ) title( Problem Comparison of Analytical and Numerical Solutions ) ylabel( Step Response y_2 ) legend( Analytical, Numerical ) subplot(2,,2) plot(t,y2a-y2b ) ylabel( Error (analytical - numerical) ) print -depsc figure2 figure(3) subplot(2,,) plot(t,y3a, b,t,y3b, r ) title( Problem Comparison of Analytical and Numerical Solutions )
ECE602 Fall 2008 Homework Solution September 2, 2008 4 ylabel( Ramp Response y_3 ) legend( Analytical, Numerical ) subplot(2,,2) plot(t,y3a-y3b ) ylabel( Error (analytical - numerical) ) print -depsc figure3 and we obtain the results 2. (Review) Consider an input r(t) t, t 0 applied to a system with transfer function G(s). The corresponding output is y(t) e 3t 2e 2t + e t 2. Find G(s). Solution: We know that G(s) Y (s)/r(s). Thuswe justneed totake Laplace transforms of r(t) and y(t). R(s) L[r(t)] s 2 (9) Y (s) L[y(t)] s +3 2 s +2 + s + 2 s 2 (0) 2(s3 +6s 2 +0s +6) s(s +)(s +2)(s +3) ()
ECE602 Fall 2008 Homework Solution September 2, 2008 5 so G(s) 2s(s3 +6s 2 +0s +6 (s +)(s +2)(s +3). (2) Notice that this is an improper transfer function (order of numerator greater than order of denominator). I used Matlab as shown below to help with some of the algebra. >> [ 3 2 0]-2*[ 4 3 0]+[ 5 6 0] - 2*conv([ 3 2],[ 3]) ans -2-2 -20-2 3. (Review) Consider the initial value problem (IVP) consisting of the differential equation where u(t) is the unit step function, and the initial conditions ÿ +6ẏ +3y u, (3) y(0) 0 and ẏ(0) 0. (4) (a) Find the solution y a (t) analytically. (b) Find the solution y b (t) usingmatlab. (c) Using the subplot command, plot in the upper half of the space y a (t) andy b (t) on the same graph; and plot in the lower half the difference y a (t) y b (t). (This error should be very small.) (d) Remember to properly label the graphs. Solution: (a) Taking the Laplace transform of 3, we obtain Y a (s) G(s)U(s) s(s 2 +6s +3), (5) then factor the denominator so we can do a partial fraction expansion. Using the formula for the roots of a second order equation we find that The partial fraction expansion is then s 2 +6s +3(s +3+ 6)(s +3 6). (6) Y a (s) s(s 2 +6s +3) A s + B s +3+ 6 + C s +3 6 (7) where A /3, B 3/8, and C 0.3708 to four decimal places according to the Matlab calculations shown below. (I could work it out by hand but it would be tedious and not very informative.)
ECE602 Fall 2008 Homework Solution September 2, 2008 6 >> a ; >> b [ 6 3 0]; >> [r,p,k]residue(a,b) r 0.0375-0.3708 0.3333 p -5.4495-0.5505 0 k [] Thus, again rounding to four decimal places, we obtain Y a (s) /3 s + 0.3708 s +0.5505 + 0.375 s +5.4495. (8) Taking the inverse Laplace transform to get y a (t) yields y a (t) 3 0.3708e 0.5505t +0.375e 5.4495t, t 0. (9) Parts (b), (c), and (d) are very similar to what I provided for Problem, so I will not include them here.
ECE602 Fall 2008 Homework Solution September 2, 2008 7 4. (Section 2.3) Suppose that y(r, θ) mr 2 + mlr cos θ ml 2 sin θ. (20) Find the first order linear approximation to y(r, θ) near the operating point (r, θ) (r 0,θ 0 ). Note that the function y is declared to be a function of two variables: r, andθ. Therefore m and l are constants. Solution: Taylor s formula for the linear approximation near the point (r 0,θ 0 )is y(r, θ) y(r 0,θ 0 )+ y (r r 0 )+ y (θ θ 0 ) (2) r θ (r0,θ 0 ) (r0,θ 0 ) The partial derivatives evaluated at the point (r 0,θ 0 )are y r 2mr 0 + ml cos θ 0, (22) (r0,θ 0 ) and Thus y θ mlr sin θ 0 ml 2 cos θ 0. (23) (r0,θ 0 ) y(r, θ) mr 2 0 + mlr 0 cos θ 0 ml 2 sin θ 0 + (2mr 0 + ml cos θ 0 ml 2 sin θ 0 )(r r 0 )+ ( mlr sin θ 0 ml 2 cos θ 0 )(θ θ 0 ). (24) I could simplify this equation further by expanding all of the products and rearranging to obtain y(r, θ) a(r, θ)r + b(r, θ)θ + c where the constants r 0 and θ 0 would be parameters (as opposed to variables) of the functions a, b, and the constant c. I would ordinarily simplify, but in this case I found that the result provided little additional insight.
ECE602 Fall 2008 Homework Solution September 2, 2008 8 5. (Section 2.6) Consider the transfer function blocks that we reduced in lecture on 8/28. (If you have the th edition, the diagram is in Figure 2.26 on p. 75.) Delete block H 2.Add a new negative feedback loop H 4 from the output of G 2 to the leftmost summer. Insert in the forward path from the input to this summer a block G 5. Youaregiventhat G (s) (25) s + s G 2 (s) s 2 (26) +2 G 3 (s) s 2 (27) G 4 (s) (28) G 5 (s) 4 (29) H (s) 50 (30) H 3 (s) s2 +2 s 3 +4 (3) H 4 (s) 4s +2 s 2 +2s +. (32) (a) Find the transfer function from R(s) toy (s). Solution: We can reduce the two inner feedback loops as shown below. Figure : Problem 5: Block diagram and first simplification step. It will be easier to do the final reduction step if we simplify the two large blocks now. Let ( ) G (s)g 2 (s) B (s) (33) +G (s)g 2 (s)h 4 (s) + s (s+)(s 2 +2) (34) s(4s+2) (s+)(s 2 +2)(s+) 2 s(s +) 3 (s 2 +2) (s +)(s 2 +2)((s +) 3 (s 2 +2)+s(4s +2)) (35) s(s +) 2 s 5 +3s 4 +5s 3 +s 2 +8s +2. (36) >> conv([ 3 3 ],[ 0 2]) + [0 0 0 5 2 0]
ECE602 Fall 2008 Homework Solution September 2, 2008 9 ans 3 5 8 2 Similarly let B 2 (s) ( G 3 (s)g 4 (s) ) G 3 (s)g 4 (s)h (s) (37) s 50 (38) s 2 s 2 50. (39) Then the forward path of the last feedback loop has transfer function B (s)b 2 (s) s(s +) 2 (s 2 50)(s 5 +3s 4 +4s 3 +s 2 +8s +2) (40) and feedback path H 3 (s). Finally, Y (s) R(s) G 5 (s)b (s)b 2 (s) (4) +B (s)b 2 (s)h 3 (s) 4s(s +) 2 (s 3 + 4) (s 0+3s 9 45s 8 25s 7 200s 6 77s 5 2344s 4 3485s 3 7668s 2 559s 400) (42). I used Matlab command conv to multiply polynomials >> anum conv(4*[ 2 0],[ 0 0 4]) anum 4 8 4 56 2 56 0 >> test conv(conv([ 5 3 8 2],[ 0-50]),[ 0 0 4]) test Columns through 5 5-47 -225-72 Columns 6 through 0-206 -3746-2088 -7672-5600 Column -400
ECE602 Fall 2008 Homework Solution September 2, 2008 0 >> aden conv(conv([ 5 3 8 2],[ 0-50]),[ 0 0 4]) + [ 0 0 0 0 0 conv([ 2 aden Columns through 5 5-47 -225-72 Columns 6 through 0 Column -205-3744 -2085-7668 -5598-400 >> roots(anum) ans 0.205 + 2.0872i.205-2.0872i -2.40 -.0000 -.0000 >> roots(aden) ans 7.0709-7.076-4.783.2049 + 2.0866i.2049-2.0866i -2.407 0.2760 +.4580i 0.2760 -.4580i -0.3837 + 0.2066i -0.3837-0.2066i
ECE602 Fall 2008 Homework Solution September 2, 2008 We find that the transfer function is Y (s) R(s) s(s +) 2 (s +2.5443)(s 2 0.3789s +3.9583)(s 2 +0.8346s +0.986) (43) (b) Find the closed loop poles and zeros. (Use Matlab if necessary.) Solution: See above. (c) Let H (s) H 3 (s) H 4 (s) 0 and find the transfer function from R(s) toy (s). Solution: The open loop transfer function is just the product of the G i,namely 4s s 2 (s +)(s 2 +2) 4 s(s +)(s 2 +2). (44) (d) Find the poles and zeros of this open loop transfer function. Solution: Clearly the poles are 0,, 2, 2. 6. (Section 2.7) Create a signal flow graph for the closed loop system of the previous problem. Use Mason s formula to compute the transfer function from R(s) toy (s). (If it does not match that you found in the previous problem, you need to find and correct your mistakes.) Figure 2: Problem 6: Signal Flow Graph. Solution: A drawing of the signal flow graph corresponding to the block diagram is given in Figure 2. There is a single path from R(s) toy (s), namely P G G 2 G 3 G 4 G 5.There are three loops: L G G 2 G 3 G 4 H 3 (45) L 2 G G 2 H 4 (46) L 3 G 3 G 4 H. (47) (Any other possible loop would encounter some node twice.) Every loop touches the path so Δ. L 2 and L 3 are non-touching loops so the graph determinant is Δ L L 2 L 3 + L 2 L 3 +G G 2 G 3 G 4 H 3 + G G 2 H 4 G 3 G 4 H. (48) Then the closed loop transfer function is Y (s) R(s) G G 2 G 3 G 4 G 5 (49) +G G 2 G 3 G 4 H 3 + G G 2 H 4 G 3 G 4 H G G 2 H 4 G 3 G 4 H Here s the transcript of a Maple session that shows that the resulting transfer function is identical.