Assignment No 3

1. Textbook p.79, 2-10 by using the z-transform method. Do only question (a).

Solve the given difference equation for x(k) using: (a) The sequential technique.

x(k)-3x(k-1)+2x(k-2) = e(k)

e(k)=1k=0,1

e(k)=0k>=2

x(-2)=x(-1)=0

Solution:

The sequential technique is presented in Example 2.8 of the textbook. The equation given can be rewritten as:

x(k) = 3x(k-1) - 2x(k-2) + e(k)

The x(k) values are determined then for each value of k as follows:

x(-2) = 0

x(-1) = 0

x(0) = 3(0) – 2(0) + 1= 1

x(1) = 3(1) – 2(0) + 1= 4

x(2) = 3(4) – 2(1) + 0= 10

x(3) = 3(10) – 2(4) + 0= 22

x(4) = 3(22) – 2(10) + 0= 46

x(5) = 3(46) – 2(22) + 0= 94

x(6) = 3(94) – 2(46) + 0= 190

x(7) = 3(190) – 2(94) + 0= 382

x(8) = 3(382) – 2(190) + 0= 766

x(9) = 3(766) – 2(382) + 0= 1534

:

:

2. Textbook p.80, 2-13 by using the z-transform method. Do question (a) and (b).

Given the difference equation

x(k+2)+3x(k+1)+2x(k)=e(k)

where

e(k)=1k=0

e(k)=0otherwise

x(0)=1

x(1)=-1

(a) Solve x(k) as a function of k.

(b) Evaluate x(0), x(1), x(2) and x(3) in part (a)

Solution:

(a) We take the z-transform on each side of the difference equations, on the left side using the right shift property,

Z[x(k)] = X(z)

On the right side, we simply apply the definition of a z-transform

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

The sequence x(k) is finally:

Z-1[X(z)] = x(k) = 0.5(d(k)+(-2)k)u(k)k=0,1,2,...

(b)x(0) = 0.5(1+1) = 1

x(1) = 0.5(0-2) = -1

x(2) = 0.5(0+4) = 2

x(3) = 0.5(0-8) = - 4

3. 3. Textbook p.85 2-22: Do (c) for the control canonical and observer canonical formulations. Also, write the transfer function.

Find two different state-variable formulations that model the system whose difference equation is given by:

(c)y(k+2)+6y(k+1)+5y(k) = 3e(k+2)+e(k+1)+2e(k)

Solution:

(i) The transfer function form is shown in the class notes (p2, Part 3). 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[e(k)] = E(z)

Z[y(k+1)] = zY(z)-y(0)zZ[e(k+1)] = zE(z)-e(0)z

Z[y(k+2)] = z2Y(z)-y(0)z2-y(1)zZ[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-3e(0)z2

And the transfer function is obtained

(ii) The control canonical form is shown in the class notes (left figure, p4, Part3). The corresponding equations are also shown in the class notes (pp5-6, Part3). From the transfer function we obtain:

(iii) The observer canonical form is shown in the class notes (right figure, p8, Part3). The corresponding equations are also shown in the class notes (pp9-10, Part3). Using this method we obtain:

4. 4. Textbook p.87 2-36: Use tf2ss(num, den) to form a state equation, then use dlsim(A, B, C, D, u) to simulate the response.

Section 2.7 gives some standard forms for state equations (simulation diagrams). The MATLAB statement.

[A,B,C,D]=tf2ss(num,den)

generates a standard set of state equations for the transfer function whose numerator coefficients are given in the vector num and denominator coefficients in the vector den.

(a) Use the MATLAB statement given to generate a set of state equation for the transfer function

Solution:

(i) The transfer function is rewritten as:

The state space is then obtained with matlab as follows:

> [a,b,c,d]=tf2ss([3,4],[1,5,6]);

> a

a =

-5 -6

1 0

> b

b =

1

0

> c

c =

3 4

> d

d =

0

The state equation is finally:

W(n+1) = [a]W(n) + [b]X(n)

Y(n) = [c]W(n) + [d]X(n)

(ii) The response for an impulse is obtained using matlab as follows:

> u=zeros(6,1);

> u(1)=1;

> dlsim([3,4],[1,5,6],u)

5. Textbook p.166, 4-14 Repeat only (a) and (b) of 4-13

4-14. Repeat Problem 4-13 for the case that the filter solves the difference equation

m(k + 1) = 0.5e(k + 1) - (0.5)(0.98)e(k) + 0.995m(k)

the sampling rate is 10Hz, and the plant transfer function is given by

(a) Find the system transfer function C(z)/E(z).

(b) Find the system dc gain from the results of part (a).

Solution:

(a)

The filter D(z) can be obtained from the difference equation

M(z)(z - 0.995) = E(z)(0.5)( z - 0.98)

The function G(z) that represents the two blocks D/A and the GP(s) is

where,

And using T=1/10,

G(z)=A(z)B(z)

The system transfer function then is,

(b)

The dc gain is obtained for a step input E(z) = z/(z-1),

= 5