Anda di halaman 1dari 27

ECE 411 Signals, Spectra, and Signal Processing

Solutions to Examples and Exercises (3 DT-LTI Systems)

Convolution
Example:
The impulse response of an LTI system is
h(n) [ 1, 1, 2, 1]

With the input signal being


x(n) [1, 2, 1, 2]

Determine the output y(n).

Solution:
Given the convolution expression

y ( n) x ( k ) h( n k )
k

we replace the time variable n with k to have x(k) and h(k) to suit the expression. We then fold
h(k) to get h(k)
h( k ) [1, 2, 1, 1]

We get the sum of the product sequence for all values of n to get y(n). We shift h(k) to the
right.
At n = 0:

x(k) 1 2 1 2

h(0 k) 1 2 1 1

2 2 1 y(0) = 5

At n = 1:

x(k) 1 2 1 2

h(1 k) 1 2 1 1

1 4 1 2 y(1) = 2

At n = 2:

x(k) 1 2 1 2

h(2 k) 1 2 1 1

2 2 2 y(2) = 2

1
Solutions to Examples and Exercises
(3 DT-LTI Systems)

At n = 3:

x(k) 1 2 1 2

h(3 k) 1 2 1 1

1 4 y(3) = 3

At n = 4:

x(k) 1 2 1 2

h(4 k) 1 2 1 1

2 y(4) = 2

Shifting h(k) past n = 5 produces a product sequence of all zeros since x(k) and h(k) do not
anymore overlap. We then shift h(k) to the left until we have no more overlap with x(k).
At n = 1:

x(k) 1 2 1 2

h(1 k) 1 2 1 1

1 2 y(1) = 1

At n = 2:

x(k) 1 2 1 2

h(2 k) 1 2 1 1

1 y(2) = 1

Finally we collate all the values of y(n).


y (n) [ 1, 1, 5, 2, 2, 3, 2]

Exercise:
Given h(n) [ 1, 1 2] x(n) [1, 0 1]

Find y(n).

Solution:
Obtain h(k): h( k ) [2, 1 1]

Obtain product sequence then take the sum for all values of n:

2
Solutions to Examples and Exercises
(3 DT-LTI Systems)

For positive values of n


At n = 0:

x(k) 1 0 1

h(0 k) 2 1 1

2 0 1 y(0) = 1

At n = 1:

x(k) 1 0 1

h(1 k) 2 1 1

0 1 y(1) = 1

At n = 2:

x(k) 1 0 1

h(2 k) 2 1 1

0 2 y(2) = 2

For negative values of n


At n = 1:

x(k) 1 0 1

h(1 k) 2 1 1

1 0 y(1) = 1

At n = 1:

x(k) 1 0 1

h(2 k) 2 1 1

1 y(2) = 1

y (n) [ 1, 1, 1, 1, 2]

Alternative solution:
A procedure using a shorter solution is presented below:
1. Assume initially that both signals are causal (disregard the arrows pertaining to n = 0).
2. Choose a signal that you will shift. The other signal shall remain static. Let a be the
shifted signal and b the static signal.
*Tip: Choose the longer of the two signals to shift.
3. Make a ((a + b 1) b) matrix.

3
Solutions to Examples and Exercises
(3 DT-LTI Systems)

4. Write the static signal b on the top row horizontally.


b1 b2 b3

5. On the first column, write other signal a (the one to be shifted) below the first vertically.
b1 b2 b3
a1
a2
a3

6. Copy the vertical signal onto the next column by shifting it one row down. Continue
doing this until you reach the last column.
b1 b2 b3
a1
a2 a1
a3 a2 a1
a3 a2
a3

7. Multiply the elements of each row (starting with the second) with the top row then get
their sum. Write the result on the right side of the table in line with the row.
b1 b2 b3
a1 c1 = a1b1
a2 a1
a3 a2 a1
a3 a2
a3

8. Do the same for the succeeding rows.

4
Solutions to Examples and Exercises
(3 DT-LTI Systems)

b1 b2 b3
a1 c1 = a1b1
a2 a1 c2 = (a2b1) + (a1b2)
a3 a2 a1 c3 = (a3b1) + (a2b2) + (a1b3)
a3 a2 c4 = (a3b2) + (a2b3)
a3 c5 = a3b3

9. Read the result c downwards.


10. To determine the location of the arrow (n = 0), count the number of shifts for both
signals the get its sum. This will be the shift on the output signal.

Lets try the solution method for the example:


We let h(n) be static while x(n) will be shifted.
h(n) 1 1 2 1
1 1
2 1 1
1 2 1 5
x(n) 2 1 2 1 2
2 1 2 2
2 1 3
2 2

The output y(n) is therefore


y (n) [ 1, 1, 5 2, 2, 3, 2]
For h(n) the shift is k = 2 (advanced by two units) while for x(n) k = 0. The total shift for
y(n) is therefore (2) + 0 = 2.
y (n) [ 1, 1, 5 2, 2, 3, 2]

Solving the exercise in this way


x(n) 1 0 1
1 1
1 1 1
h(n) 2 1 1 1
2 1 1
2 2

Both signals have a shift of k = 1 giving a total shift of k = 2. The output is therefore
y (n) [ 1, 1, 1, 1, 2]

5
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Example:
Find the response of the system y(n) given
x(n) [2 1 0 4 3 2] h2 (n) [1 0 3 2 1]

h1 (n) [3 2 2 1 1 5] h3 (n) [ 1 1 2 0 1]

x(n) H1

+ y(n)

H2 H3

Solution (with MATLAB):


The output y(n) is defined by the expression
y (n) H 1[ x(n)] H 3 H 2 [ x(n)]
h1 (n) x(n) h3 (n) h2 (n) x(n)
Applying the linearity properties (associative and distributive) we get
y (n) h1 (n) h2 (n) h3 (n) x(n)
We get the convolution of h2(n) and h3(n) first.
h2(n) 1 0 3 2 1
1 1
1 1 1
2 1 1 1
0 2 1 1 1
h3(n) 1 0 2 1 1 10
1 0 2 1 3
1 0 2 1
1 0 2
1 1

The total shift is k = 1 therefore


h23 (n) [ 1 1 1 1 10 3 1 2 1]

We add h23(n) to h1(n)

h1(n) 3 2 2 1 1 5

+ h23(n) 1 1 1 1 10 3 1 2 1

h(n) 2 3 3 2 9 8 1 2 1

6
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Finally we convolve the system impulse response h(n) with the input signal x(n).
x(n) 2 1 0 4 3 2
2 4
3 2 4
3 3 2 9
2 3 3 2 15
9 2 3 3 2 22
8 9 2 3 3 2 18
1 8 9 2 3 3 5
h(n) 2 1 8 9 2 3 39
1 2 1 8 9 2 3
1 2 1 8 9 37
1 2 1 8 11
1 2 1 12
1 2 1
1 2

The total shift is k = 3 (kx = 2, kh = 1) therefore


y (n) [4 4 9 15 22 18 5 39 3 37 11 12 1 2]

MATLAB has a convolve function conv. As with our shorthand solution, conv disregards the
shifts attributed to the signal. The user has the responsibility to note the location of n = 0 (the
arrow) especially when dealing with parallel-connected systems, where the impulse responses
are added together.
Convolve h2(n) and h3(n)
>> h2 = [1 0 3 2 -1];
>> h3 = [-1 1 2 0 1];
>> h23 = conv(h2,h3)
h23 =
-1 1 -1 1 10 3 1 2 -1
Remember that the total shift is k = 1. We now add this to h1(n). To add the two responses we
must align their time indices (aligned at n = 0). Also, matrix addition in MATLAB must have
the same sizes. We pad zeros at the end of h1(n) before adding to h23(n).
>> h1 = [3 2 -2 1 -1 5];
>> h = h23 + [h1 0 0 0]
h =
2 3 -3 2 9 8 1 2 -1
Using conv to get the convolution sum of h(n) and x(n)
>> x = [2 -1 0 4 -3 -2];
>> y = conv(h,x)

7
Solutions to Examples and Exercises
(3 DT-LTI Systems)
y =
Columns 1 to 13
4 4 -9 15 22 -18 5 39 -3 -37 -11 -12 -1
Column 14
2
Numerically the answers are equal. Just note the n = 0 is at 9.

Correlation
Example:
Given x(n) [1 0 1 1 2] y (n) [1 0 1 1 3]

1. Determine the cross-correlation sequence rxy(l). What is the point of maximum relation?
2. Solve for ryx(l) and compare it with rxy(l).

Solution:
Since correlation is similar to convolution, we can use the method solution for convolution but
with the folding step omitted.
We use the shorthand solution but with some slight modifications:
Since the order of the subscripts denote the reference (static) and compared (shifted)
signals, the signals are not interchangeable.
Instead of writing the vertical signal normally (step 5), write its folded version.
To determine l = 0, find the row where the arrows (n = 0) for both signals coincide.

1. For rxy(l), x(n) is static and y(n) is shifted with respect to it.

x(n) 1 0 1 1 2

3 3
1 3 1
1 1 3 4
0 1 1 3 4
y(n) 1 0 1 1 3 7
1 0 1 1 3 l=0
1 0 1 1
1 0 1
1 2

rxy (l ) [ 3 1 4 4 7 3 1 1 2]

The point of maximum relation is the maximum (largest positive) value in the correlation
sequence.
maxrxy (l ) 4 , l 2

8
Solutions to Examples and Exercises
(3 DT-LTI Systems)

2. We interchange x(n) and y(n) to obtain ryx(l).


y(n) 1 0 1 1 3

2 2
1 2 1
1 1 2 1
0 1 1 2 3 l=0
x(n) 1 0 1 1 2 7
1 0 1 1 4
1 0 1 4
1 0 1
1 3

ryx (l ) [2 1 1 3 7 4 4 1 3]

Comparing ryx(l) to rxy(l) it is clear that ryx(l) is the folded version of rxy(l), or ryx(l) = rxy(l).

Autocorrelation
Example:
Determine the autocorrelation sequence of x(n).
x(n) [1 0 1 1 2]

Solution:
We perform correlation on x(n) and x(n).
x(n) 1 0 1 1 2

2 2
1 2 1
1 1 2 3
0 1 1 2 3
x(n) 1 0 1 1 2 7 l=0
1 0 1 1 3
1 0 1 3
1 0 1
1 2

rxx (l ) [2 1 3 3 7 3 3 1 2]

We can see that the autocorrelation rxx(l) function attains its maximum value at l = 0. Also, the
autocorrelation function is an even function

MATLAB has a similar function xcorr for correlation as conv is for convolution.

9
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Solution of LCCDEs: Iterative Method


Example 1:
Determine y(1), y(2), and y(3) for an initially relaxed system defined by
y(n) y(n 1) = x(n)
where: x(n) = nu(n)

Solution:
We start by rearranging the terms in order to solve for y(n).
y(n) = y(n 1) + nu(n)
Since the system is initially relaxed, y(n) = 0 for n < 0.
We solve for the value of y(n) at any time n by substituting n into the equation.
At n = 0: y(0) = y(0 1) + x(0)
= y(1) + (0)u(0)
= 0 + (0)(1)
y(0) = 0

At n = 1: y(1) = y(1 1) + x(1)


= y(0) + (1)u(1)
= 0 + (1)(1)
y(1) = 1

At n = 2: y(2) = y(2 1) + x(2)


= y(1) + (2)u(2)
= 1 + (2)(1)
y(2) = 3

At n = 3: y(3) = y(3 1) + x(3)


= y(2) + (3)u(3)
= 3 + (3)(1)
y(3) = 6

10
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Example 2:
Determine y(4) for a DT system characterized by the LCCDE
2y(n) y(n 1) + y(n 2) = x(n)
where: x(n) = n2u(n)
y(0) = 1
y(1) = 3

Solution:
Again we rearrange the equation, and normalize it by dividing the equation with a0.
y(n) = y(n 1) y(n 2) x(n)
We solve for y(n) iteratively starting at n = 2.
At n = 2: y(2) = y(2 1) y(2 2) x(2)
= y(1) y(0) (22)u(2)
= (3) (1) (4)(1)
y (2) 1

At n = 3: y(3) = y(3 1) y(3 2) x(3)


= y(2) y(1) (32)u(3)
= (1) (3) (9)(1)
y (3) 13 2

At n = 4: y(4) = y(4 1) y(4 2) x(4)


= y(3) y(2) (42)u(4)
= ( 13 2 ) (1) (16)(1)
y (4) 43 4

Solution to LCCDEs: Homogeneous Solution, yh(n)


Example 1:
Determine yh(n) for the DE
y(n) y(n 1) 2y(n 2) = x(n)

Solution:
Since the homogeneous solution yh(n) is a solution homogeneous in the output variable y, we set
the input x(n) = 0.
We substitute the general form of the homogeneous solution yh(n) = Cn into the DE.
n n 1 2n 2 = 0
We factor out n 2 to obtain an expression with positive exponents.
n 2 (2 2) = 0

11
Solutions to Examples and Exercises
(3 DT-LTI Systems)

To solve for , we solve for the roots of the equation using quadratic formula.
(1) (1) 2 4(1)(2)

(2)(1)
1 1 8 1 3

2 2
2, 1
The homogeneous solution is therefore
y h (n) C1 (2) n C 2 (1) n

Example 2:
Determine yh(n) for the DE
y(n) y(n 1) + 2y(n 2) = x(n)

Solution:
The DE looks similar to the previous one, but closer inspection reveals that the coefficients of y
are different. We take the general solution of the DE as
n n 1 + 2n 2 = 0
n 2 (2 + 2) = 0
Solving for
(1) (1) 2 4(1)(2)

(2)(1)
1 1 8 1 j 7

2 2
1 7
j
2 2
We express in polar form
7
2 tan 1 2

1 7
2 1
r
2

2 2 1.2094
0.385
2
2e j 0.385
The homogeneous solution becomes

y h (n) C1 2e j 0.385 C
n
2 2e j 0.385
n

C1 2 e j 0.385 n C 2 2 e j 0.385 n
n n


n

y h (n) 2 C1 e j 0.385 n C 2 e j 0.385 n

12
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Example 3:
Determine yzi(n) for the DE
6y(n) + y(n 1) 2y(n 2) = x(n)
given the initial conditions:
y(2) = 0 and y(1) = 1.

Solution:
The zero-input solution yzi(n) is the output of the system with the input set to zero. In other
words, the output of the system is from a prior excitation (initial condition) and not from an
input signal.
Since we set the input x(n) to zero to obtain the homogeneous solution, therefore yzi(n) is just
yh(n) evaluated using the initial conditions. The homogeneous solution is
y (n) 1 6 y (n 1) 1 3 y (n 2) 0

n 1 6 n1 1 3 n2 0
n 2 (2 1 6 1 3 ) 0

16 16 2 4(1) 13 16 7 6

2(1) 2

2 1
,
3 2
n n
2 1
yh (n) C1 C2
3 2
The zero-input solution yzi(n) is the homogeneous solution yh(n) evaluated at the initial
conditions.
y zi (n) y h (n) I .C .

We evaluate yh(n) using the initial conditions to solve for the arbitrary constants.
At n = 1:
1 1
2 1
y (1) 1 C1 C 2
3 2
3
1 C1 C 2 2 Eq. 1
2
At n = 2:
2 2
2 1
y (2) 0 C1 C 2
3 2
9
0 C1 C2 4 Eq. 2
4

13
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Solving the two equations simultaneously we get


8 3
C1 and C2
21 14
The zero-input solution is therefore
n n
8 2 3 1
y zi (n)
21 3 14 2

Solution to LCCDEs: Particular Solution, yp(n) / Total Solution, yt(n)


Example:
Given
y(n) + 2y(n 1) = x(n)
where: x(n) = 2u(n) + 4nu(n)
y(1) = 1
Solve for y(2) and check using iterative.

Solution:
We start by using the iterative solution to find y(2).
y (n) 2 y (n 1) x(n)

2 y (n 1) 2u (n) 4 n u (n)
At n = 0:

y (0) 2 y (0 1) 2u (0) 4 0 u (0)
2 y (1) (2)(1) (1)(1)
2(1) 3
y (0) 1

At n = 1:

y (1) 2 y (1 1) 2u (1) 41 u (1)
2 y (0) (2)(1) (4)(1)
2(1) 6
y (1) 4

At n = 2:

y (2) 2 y (2 1) 2u (2) 4 2 u (2)
2 y (1) (2)(1) (16)(1)
2(4) 18
y (2) 10

14
Solutions to Examples and Exercises
(3 DT-LTI Systems)

For the total solution, we start with the homogeneous solution yh(n).
y (n) 2 y (n 1) 0

n 2n1 0
n1 ( 2) 0
2

y h (n) C (2) n
For the particular solution, we take a look at the input signal x(n)
x(n) 2u (n) 4 n u (n)
Applying the property of linearity
x(n) x1 (n) x2 (n) y p (n) y1 p (n) y 2 p (n)

We have
y p (n) K1u (n) K 2 4 n u (n)

We substitute yp(n) into the original LCCDE


K u(n) K
1 2
4 n u (n) 2 K1u (n 1) K 2 4 n1 u (n 1) 2u (n) 4 n u (n)
To solve for the arbitrary constants K1 and K2, we then evaluate the equation so that none of the
terms disappear.
At n = 1:
K u(1) K
1 2
41 u (1) 2 K1u (0) K 2 4 0 u (0) 2u (1) 41 u (1)
K1 4 K 2 2K1 K 2 6
3K1 6 K 2 6
K1 2 K 2 2 Eq. 1

At n = 2:
K u(2) K
1 2
4 2 u (2) 2 K1u (1) K 2 41 u (1) 2u (2) 4 2 u (2)
K1 16 K 2 2K1 4 K 2 18
3K1 24 K 2 18
K1 8 K 2 6 Eq. 2
Solving the Eq. 1 and Eq. 2 simultaneously
2 2
K1 and K2
3 3
The particular solution yp(n) is
2 2
y p (n) u ( n ) ( 4 n )u ( n )
3 3

15
Solutions to Examples and Exercises
(3 DT-LTI Systems)

y p ( n)
2
3

1 4 n u ( n)

The total solution is


y t ( n ) y h ( n ) y p ( n)

C (2) n
2
3

1 4 n u ( n)

To solve for C, we evaluate the equation with the value of y(0) taken from the iterative solution.

y (0) 1 C (2) 0
2
3

1 4 0 u (0)

2
C (2)(1)
3
1
C
3
1
3
2

yt (n) (2) n 1 4 n u (n)
3

We check the validity of the solution by substituting n = 2.
1
3
2

yt (2) (2) 2 1 4 2 u (2)
3

(4) 1 16(1)
1 2
3 3
4 34

3 3
30

3
yt(2) = 10

Solutions to LCCDEs: Systems-Oriented Approach


Example:
Solve the previous example using the systems-oriented approach.
y(n) + 2y(n 1) = x(n)
where: x(n) = 2u(n) + 4nu(n)
y(1) = 1

Solution:
We start with the zero-input solution, yzi(n). We take the homogeneous solution from the
previous example and evaluate it using the initial condition.
y zi (n) y h (n) y ( 1)1

16
Solutions to Examples and Exercises
(3 DT-LTI Systems)

1 C (2) 1
1
1 C
2
C 2
y zi (n) 2(2) n
For the zero-state solution yzs(n), we take the total solution yt(n) and evaluate using zero initial
conditions (initially relaxed).
y zs (n) yt (n) y ( 1)0

yt (n) C (2) n
2
3

1 4 n u ( n)

We solve for the zero-state output using the iterative solution with y(n) = 0
At n = 0:

y (0) 2 y (0 1) 2u (0) 4 0 u (0)
2 y (1) (2)(1) (1)(1)
2(0) 3
y (0) 3

y (0) 3 C (2) 0
2
3

1 4 0 u (0)

2
3 C (1) (2)(1)
3
5
C
3
5
3
2

y zs (n) (2) n 1 4 n u (n)
3

The total solution is the sum of yzi(n) and yzs(n).
y zi (n) 6
(2) n
3

y zs (n) 5
3
2

(2) n 1 4 n u (n)
3

y t ( n) 1
3
2

(2) n 1 4 n u (n)
3

It is the same for the classical solution.

17
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Realization of DT-LTI Systems


Example:
Determine the first 15 values of the unit step response of the system defined by LCCDE

y(n) = 1.0368y(n 1) 0.437y(n 2) + 0.114x(n) + 0.1498x(n 1) + 0.114x(n 2)

Draw its Direct Form I implementation and compare the response with the Direct Form II
implementation.

Solution (with MATLAB):


The direct form I (DF1) implementation is pretty straightforward.

0.1498
x(n) + + y(n)

z1 z1
0.1498 1.0368
+ +

z1 z1
0.114 0.437

We interchange the recursive and non-recursive systems, then remove the redundant delays in
the middle for the direct form II (DF2) implementation.

0.1498
x(n) + + y(n)

z1
1.0368 0.1498
+ +

z1
0.437 0.114

To determine the values for the step response, we use Simulink a model-based simulation tool
for MATLAB. For more information on Simulink, you may consult the MATLAB reference.
To start Simulink, enter simulink at the command prompt.

18
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Simulink Library Browser

To create the model we will be using the following:


Math Operations blockset: Gain (multiplier) and Sum (adder)
Discrete blockset: Unit delay or Integer delay (delays)
Sources blockset: Step (unit step input, x)
Sinks blockset: To Workspace (output y)
Start building the DF1 model by clicking on File New Model on the Simulink Library
Browser window. This will bring up a blank model window.
Drag and drop blocks from the library browser window onto the model window and position
them accordingly. To connect the blocks, click on an output terminal (denoted with a > on the
right side of the block) the cursor changes to a crosshair (+) then drag it all the way to the
input terminal of the next block (the > symbol on the left side of the block). (*Tip: You can
also click on the source block to select it then Ctrl+click on the destination block to
automatically connect the two.) To create a node, Ctrl+click on a wire (the cursor turns to +)
then drag to an input of a block.
Double-click on the gain blocks to modify the values. As for a2 (the coefficient of y(n 2)), you
may choose to have it as a negative value, or modify the signs on the summing block (+ on
the parameter window).
Once you have finished with the model, save your work as Ch3ExDF1.mdl.

Finished DF1 model.

Modify the Step Source block by double-clicking on it.

19
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Parameter window for Step Source block.


Change the sample time to 1/1.4 (sec). This will give us 14 samples in ten seconds, plus another
one at t = 0 for a total of 15 samples. Leave the others unchanged. Click Ok.
Double-click on the To Workspace Sink block to modify its parameters.

Parameter window for To Workspace Sink block.


Make the variable name y and change the Save format to Array this will make the output
accessible on MATLAB desktop. Click Ok when youre done.
Modify the simulation settings from the Simulation Configuration Parameters menu.

Model Configuration Parameters window.


20
Solutions to Examples and Exercises
(3 DT-LTI Systems)

In the Solver menu, change the Solver in Solver options section to discrete. Leave the
Simulation Stop time at 10.0 (default). Click on Ok when youre done.
Save the model before proceeding with the simulation.

To simulate the model, click on Simulation Run (or click on the Play button on the menu
bar). When the simulation is done, switch to the MATLAB desktop and view the result by
typing y on the command prompt.
>> y
y =
0.114000000000000
0.381995200000000
0.724046023360000
0.961597214139648
1.058448284014003
1.055077358008106
1.009268149497086
0.963245919684837
0.935544115013962
0.926929996136171
0.930101796144381
0.937153826930602
0.943079613026168
0.946142435799550
0.946728994505841

Repeat the procedure for the DF2 model but change the Variable name of the To Workspace
Sink block to y1. Save your work as Ch3ExDF2.mdl then run the simulation.

Finished DF2 model.

We compare the outputs of the two by typing [y y1] on the MATLAB command prompt.
>> [y y1]
ans =
0.114000000000000 0.114000000000000
0.381995200000000 0.381995200000000
0.724046023360000 0.724046023360000
0.961597214139648 0.961597214139648
1.058448284014003 1.058448284014003
1.055077358008106 1.055077358008106
1.009268149497086 1.009268149497086

21
Solutions to Examples and Exercises
(3 DT-LTI Systems)
0.963245919684837 0.963245919684837
0.935544115013962 0.935544115013962
0.926929996136171 0.926929996136171
0.930101796144381 0.930101796144381
0.937153826930602 0.937153826930602
0.943079613026168 0.943079613026168
0.946142435799550 0.946142435799550
0.946728994505841 0.946728994505841

We can see that the outputs of the two models are exactly the same, and therefore the DF1 and
DF2 structures are similar.

Mathematical solution

For the mathematical solution, we start with yh(n):

y (n) 1.0368 y (n 1) 0.437 y (n 2) 0


n 1.0368n1 0.437n2 0
n2 (2 1.0368 0.437) 0

(1.0368) (1.0368) 2 4(1)(0.4370)



2(1)
1.0368 1.07495 1.748 1.0368 0.67305

2 2
1.0368 j 0.8204

2

0.5184 j 0.4102
0.66106e j 0.21308


y h (n) C1 0.66106e j 0.21308
n

C 2 0.66106e j 0.21308
n


0.66106 C1e j 0.21308 n C 2 e j 0.21308 n
n

For yp(n), since x(n) = u(n) (step response), therefore yp(n) = Ku(n). We substitute this into the
LCCDE.
Ku (n) 1.0368Ku (n 1) 0.437Ku (n 2) 0.114u (n) 0.1498u (n 1) 0.114u (n 2)
Evaluating at n = 2 to solve for K
Ku (2) 1.0368Ku (2 1) 0.437Ku (2 2) 0.114u (2) 0.1498u (2 1) 0.114u (2 2)
Ku (2) 1.0368Ku (1) 0.437Ku (0) 0.114u (2) 0.1498u (1) 0.114u (0)
K (1) 1.0368 K (1) 0.437 K (1) 0.114(1) 0.1498(1) 0.114(1)
0.4002 K 0.3778
K 0.94403
y p (n) 0.94403u (n)

22
Solutions to Examples and Exercises
(3 DT-LTI Systems)

The total solution becomes



yt (n) 0.66106 C1e j 0.21308 n C 2 e j 0.21308 n 0.94403u (n)
n

We evaluate the DE using the step input at zero initial conditions


At n = 0:
y (0) 1.0368 y (1) 0.437 y (2) 0.114u (0) 0.1498u (1) 0.114u (2)
1.0368(0) 0.437(0) 0.114(1) 0.1498(0) 0.114(0)


y (0) 0.114 0.66106 C1e j 0.21308 ( 0) C 2 e j 0.21308 ( 0) 0.94403u (0)
0

0.114 1C1 (1) C 2 (1) 0.94403


0.83003 C1 C 2 Eq. 1

At n = 1:
y (1) 1.0368 y (0) 0.437 y (1) 0.114u (1) 0.1498u (0) 0.114u (1)
1.0368(0.114) 0.437(0) 0.114(1) 0.1498(1) 0.114(0)


y (1) 0.382 0.66106 C1e j 0.21308 (1) C 2 e j 0.21308 (1) 0.94403u (1)
1


0.56203 0.66106 C1e j 0.21308 C 2 e j 0.21308
0.8502 C1e j 0.21308 C 2 e j 0.21308 Eq. 2

Substituting Eq. 1 into Eq. 2


0.8502 0.83003 C 2 e j 0.21308 C 2 e j 0.21308
But
re j r cos j sin

e j 0.21308 cos(0.21308 ) j sin(0.21308 )


0.78419 j 0.62052
Then
0.8502 0.83003 C 2 0.78419 j 0.62052 C 2 0.78419 j 0.62052
0.8502 0.6509 j 0.51505 0.78419C 2 j 0.62052C 2 0.78419C 2 j 0.62052C 2
0.1993 j 0.51505 j1.24104C 2

0.55226e j 0.61752 1.24104e j 0.5 C 2
0.55226e j 0.61752
C2
1.24104e j 0.5
C 2 0.445e j1.11752

C1 C 2 0.445e j1.11752

23
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Since max = , we subtract 2 from the angle


C 2 0.445e j 0.88248
C1 0.445e j 0.88248
Thus the total solution yt(n) is

yt (n) 0.66106 0.445e j 0.88248 e j 0.21308 n 0.445e j 0.88248 e j 0.21308 n 0.94403u (n)
n


0.4450.66106 e j 0.88248
n
e j 0.21308 n
e j 0.88248
e j 0.21308 n
0.94403u (n)
0.4450.66106 e j ( 0.21308 n 0.88248 )

e j ( 0.21308 n0.88248 ) 0.94403u (n)
n

0.4450.66106 2 cos(0.21308 n 0.88248 ) 0.94403u (n)


n

yt (n) 0.890.66106 cos(0.21308 n 0.88248 ) 0.94403u (n)


n

We compare the response from our mathematical solution with our Simulink output.
>> n = (0:14);
>> y2 = 0.89*(0.66106.^n).*cos(0.21308.*pi.*n+0.88248*pi)+0.94403;
>> [y y2]
ans =
0.114000000000000 0.114001447708508
0.381995200000000 0.382000709726754
0.724046023360000 0.724046364628476
0.961597214139648 0.961560135309563
1.058448284014003 1.058337989875235
1.055077358008106 1.054882712824498
1.009268149497086 1.009008362162859
0.963245919684837 0.962956248598765
0.935544115013962 0.935256981119231
0.926929996136171 0.926663444470153
0.930101796144381 0.929858339948219
0.937153826930602 0.936926154117632
0.943079613026168 0.942857823233304
0.946142435799550 0.945919081729676
0.946728994505841 0.946500822785331
The slight differences (error) between the two outputs is due to rounding (truncation) errors.

Mathematical solution using MATLAB

We can also use MATLAB to determine the mathematical solution.


To get the roots of the homogeneous solution, we use the roots function.
>> lambda = roots([1 1.0368 0.437])
lambda =
0.5193 + 0.4091i
0.5193 0.4091i

We write the homogeneous solution as


y h (n) C1 1 C 2 2
n n

24
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Given that our particular solution is yp(n) =Ku(n), we can use solve after substituting yp(n)
into the LCCDE and evaluating at n = 2.
>> K = solve(K-1.0368*K+0.438*K=0.114+0.1498+0.114)
K =
0.94402798600699650174912543728136

You must have the Symbolic Toolbox installed.

The total solution is therefore


yt (n) C1 1 C 2 2 K
n n

Solving the zero-state step response from the LCCDE using an iterative solution we have
y(0) = 0.114
y(1) = 0.382
We write Eq. 1 and Eq. 2 as
0.114 C1 C2 K Eq. 1
0.382 C1 (1 ) C 2 (2 ) K Eq. 2
This system of equations can be written as
b1 a11 a12 C1
b a a 22 C 2
2 21
Therefore
0.114 K 1 1 C1
0.382 K C
1 2 2

Where the solution is in the form


C A 1 B
In MATLAB:
>> C = inv([1 1;lambda(1) lambda(2)])*[0.114-0.94403;0.382-0.94403]
C =
-0.4150 + 0.1601i
-0.4150 0.1601i

We convert and C into polar form using abs and angle.


>> r_lambda = abs(lambda)
r_lambda =
0.6611
0.6611
>> w_lambda = angle(lambda)/pi
w_lambda =
0.2124
-0.2124
>> r_C = abs(C)
0.4448
0.4448

25
Solutions to Examples and Exercises
(3 DT-LTI Systems)
>> w_C = angle(C)/pi
0.8828
-0.8828

We can then write the total solution yt(n) as



yt ( n ) 0.4448 e j 0.8828 0.6611e j 0.2124 0.4448 e
n
0.6611e
j 0.8828
0.94403u (n) j 0.2124 n

0.4448 (0.6611) e n j 0.8828


e e
j 0.2124 n
e 0.94403u (n)
j 0.8828 j 0.2124 n

0.4448 (0.6611) e n j ( 0.8828 0.2124 n )


e 0.94403u (n)
j ( 0.8828 0.2124 n )

0.4448 (0.6611) n 2 cos( 0.8828 j 0.2124 n ) 0.94403 u ( n )

yt (n) 0.8896(0.6611) n cos(0.2124 n 0.8828 ) 0.94403u (n)


We can see that the total solution we get is quite similar to the manual solution.

26
Solutions to Examples and Exercises
(3 DT-LTI Systems)

Appendix

Help description for MATLAB functions used:


CONV Convolution and polynomial multiplication.
C = CONV(A, B) convolves vectors A and B. The resulting vector
is length MAX([LENGTH(A)+LENGTH(B)-1,LENGTH(A),LENGTH(B)]). If A
and B are vectors of polynomial coefficients, convolving them is
equivalent to multiplying the two polynomials.

XCORR Cross-correlation function estimates.

C = XCORR(A,B), where A and B are length M vectors (M>1), returns


the length 2*M-1 cross-correlation sequence C. If A and B are of
different length, the shortest one is zero-padded. C will be a row
vector if A is a row vector, and a column vector if A is a column
vector.

ROOTS Find polynomial roots.


ROOTS(C) computes the roots of the polynomial whose coefficients
are the elements of the vector C. If C has N+1 components, the
polynomial is C(1)*X^N + ... + C(N)*X + C(N+1).

ABS Absolute value.


ABS(X) is the absolute value of the elements of X. When X is
complex, ABS(X) is the complex modulus (magnitude) of the
elements of X.

ANGLE Phase angle.


ANGLE(H) returns the phase angles, in radians, of a matrix with
complex elements.

SOLVE Symbolic solution of algebraic equations.


SOLVE('eqn1','eqn2',...,'eqnN')
SOLVE('eqn1','eqn2',...,'eqnN','var1,var2,...,varN')
SOLVE('eqn1','eqn2',...,'eqnN','var1','var2',...'varN')

The eqns are symbolic expressions or strings specifying


equations. The vars are symbolic variables or strings specifying
the unknown variables. SOLVE seeks zeros of the expressions or
solutions of the equations. If not specified, the unknowns in
the system are determined by SYMVAR. If no analytical solution
is found and the number of equations equals the number of
dependent variables, a numeric solution is attempted.

27

Anda mungkin juga menyukai