Assignment No 3 1. Solve the difference equation given in p.79, 2-10 by using the z-transform method following the method discussed in class. Note: ignore questions (a), (b) and (c) asked by 2-10. x(k)-3x(k-1)+2x(k-2) = e(k) e(k)=1 k=0,1 e(k)=0 k>=2 x(-2)=x(-1)=0 Solution: We take the z-transform on each side of the difference equations, on the left side using the ‘m’ step delay with u(k) property (class slide pp. 9-10) Z[x(k)] = X(z) Z[x(k-1)] = z-1X(z)+x(-1) Z[x(k-2)] = x-2X(z)+x(-2)+x(-1)z-1 On the right side, we simply apply the definition of a z-transform Z [e(k )] e(k ) z k 1 z 1 k 0 Then X(z)(1-3z-1+2z-2) = 1+z-1 We decompose X(z) into partial fractions X ' ( z) X ( z) 1 ( z 1) 1 z 1 z z 1 3z 1 2 z 2 ( z 2)( z 1) c1 ( z 2) X ' ( z ) |z 2 X ( z) (2 1) 3 (2 1) c2 ( z 1) X ' ( z ) |z 1 3z 2z ( z 2) ( z 1) The sequence x(k) is finally: Z-1[X(z)]=x(k)=(3(2)k-2)u(k) k=0,1,2,… (1 1) 2 (1 2) 2. Solve the difference equation given in p.80, 2-13 by using the z-transform method. Read this question as [x(k+2) + 3x(k+1) + 2x(k)]u(k) = e(k)u(k). Then, you need to apply the right shift properties (time advance), i.e. Z{x(k+1)u(k)}=zX(z)-x(0)z and Z{x(k+2)u(k)}=z^2 X(z)-x(0)z^2 -x(1)z. Note that the left shift property (time lag) was used in 2-10 above. x(k+2)+3x(k+1)+2x(k)=e(k) e(k)=1 k=0 e(k)=0 otherwise x(0)=1 x(1)=-1 Solution: We take the z-transform on each side of the difference equations, on the left side using the right shift property just indicated in the question, Z[x(k)] = X(z) Z[x(k+1)] = zX(z)-x(0)z = zX(z)-z Z[x(k+2)] = z2X(z)-x(0)z2-x(1)z =z2X(z)-z2+z On the right side, we simply apply the definition of a z-transform Z [e(k )] e(k ) z k 1 k 0 Then X(z)(z2+3z+2)-z2+z-3z = 1 X(z)(z2+3z+2) = z2+2z+1 We decompose X(z) into partial fractions X ' ( z) X ( z) 1 z 2 2z 1 ( z 1)( z 1) ( z 1) 2 z z z 3z 2 z ( z 1)( z 2) z ( z 2) c1 zX ' ( z ) | z 0 X ( z) (0 1) 1 (0 2) 2 c2 ( z 2) X ' ( z ) |z 2 z z 2 z 2( z 2) The sequence x(k) is finally: Z-1[X(z)] = x(k) = 0.5(d(k)+(-2)k)u(k) k=0,1,2,... (2 1) 1 2 2 3. Textbook p.85 2-22 For the difference equation given in (c), (i) write its transfer function, (ii) draw a simulation diagram based on the canonical form discussed in class, then (iii) derive a state equation based on the simulation diagram obtained in (ii). Note: ignore the questions asked by 2-22. y(k+2)+6y(k+1)+5y(k) = 3e(k+2)+e(k+1)+2e(k) Solution: (i) To obtain the transfer function we apply the z-transform to each side of this difference equation, we need to use the right shift property explained in the previous question. Z[y(k)] = Y(z) Z[y(k+1)] = zY(z)-y(0)z Z[y(k+2)] = z2Y(z)-y(0)z2-y(1)z Z[e(k)] = E(z) Z[e(k+1)] = zE(z)-e(0)z Z[e(k+2)] = z2E(z)-e(0)z2-e(1)z To eliminate the terms y(0), y(1), e(0) and e(1) we can assume the sequences are causal, i.e. they have no value for k<0. Using this we evaluate the difference equations for k=-2 and k=-1 y(-2+2) +6y(-2+1)+5y(-2) = 3e(-2+2)+e(-2+1)+2e(-2) y(0) = 3e(0) y(-1+2)+6 y(-1+1)+5y(-1) = 3e(-1+2)+e(-1+1)+2e(-1) y(1)+6y(0) = 3e(1)+e(0) Then the difference equation becomes Y(z)(z2+6z+5)-(y(1)+6y(0))z-y(0)z2 = E(z)(3z2+z+2)-(3e(1)+e(0))z-e(0)z2 And the transfer function is obtained Y ( z ) 3z 2 z 2 3 z 1 2 z 2 E ( z ) z 2 6 z 5 1 6 z 1 5 z 2 (ii) Canonical form (iii) State equation w1(n 1) 6 5 w1(n) 1 e( n ) w2(n 1) 1 0 w2(n) 0 w1(n) y (n) (1 6 3) (2 5 3) 3e(n) w2(n) 4. Read textbook p.87 2-36 to understand a MATLAB function tf2ss(num,den). Confirm your solution of (iii) in the previous question by this MATLAB function. You use num and den of (ii) to get the solution (iii). If two state equations do not match, explain the difference between them. Solution: >> [a,b,c,d]=tf2ss([3,1,2],[1,6,5]); >> a a = -6 -5 1 0 >> b b = 1 0 >> c c = -17 -13 >> d d = 3 This result matches our previous solution of problem 3. W(n+1) = [a]W(n) + [b]E(n) Y(n) = [c]W(n) + [d]E(n)