Exercise 1: ECE 413 - Digital Signal Processing Home Assignment 1 Solutions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

University of Waterloo

Department of Electrical and Computer Engineering


3 – Digital Signal Processing
ECE 413
Spring 2017

Home Assignment 1 Solutions

Exercise 1
Compute the output y[n] of an LTI system when the input x[n] and the impulse response h[n] are
given by: (
1 0nN 1
x[n] =
0 otherwise
(
an 0  n  M 1
h[n] =
0 otherwise
Discuss no overlap, partial overlap, and full overlap case. Find y[n] when M < N and M > N .

Solution
Case M < N :

1
Figure 1: Example with N=6 and M=4

Case M > N :

No Overlap: when n < 0, hence, y[n] = 0


Pn 1 an+1
Partial Overlap (left): when 0  n < N 1, hence, y[n] = k=0 ak = 1 a
Pn N +1) 1 aN
Full Overlap: when N  n  M 1, hence, y[n] = k=n N +1 ak = a(n 1 a

Partial Overlap (right): when M  n  N + M 2, hence,


PM 1 N +1) 1 aN +M n 1
y[n] = k=n N +1 ak = a(n 1 a

2
Exercise 2
A discrete time system is described by the following di↵erence equation

y[n] =1.15y[n 1] 1.5y[n 2] + 0.7y[n 3] 0.25y[n 4] + 0.18x[n]


+ 0.1x[n 1] + 0.3x[n 2] + 0.1x[n 3] + 0.18x[n 4]

with zero initial conditions.

Solution
0.18 + 0.1z 1 + 0.3z 2 + 0.1z 3 + 0.18z 4
Y (z) =
1 1.15z 1 + 1.5z 2 0.7z 3 + 0.25z 4
1. Compute and plot the impulse response h[n], 0  n  100 using the function
h = impz(b, a, N ).

Matlab Code
xn = ones(1,101);
num = [0.18 0.1 0.3 0.1 0.18];
den = [1 -1.15 1.15 -0.7 0.25];
hn = impz(num, den, 101);
stem([0:100], hn);

2. Compute and plot the output y[n], if x[n] = u[n], 0  n  100 using the function
y = f ilter(b, a, x).
Matlab Code
xn = ones(1,101);
num = [0.18 0.1 0.3 0.1 0.18];
den = [1 -1.15 1.15 -0.7 0.25];
yn = filter(num,den,xn);
stem([0:100], yn);

3
3. Compute and plot the output y[n], if x[n] = u[n], 0  n  100 using the function
y = conv(h, x).
Matlab Code
xn = ones(1,101);
num = [0.18 0.1 0.3 0.1 0.18];
den = [1 -1.15 1.15 -0.7 0.25];
hn = impz(num, den, 101);
yc = conv(hn(1:101),xn);
stem([0:200], yc);

4
4. Compute and plot the output y[n], if x[n] = u[n], 0  n  100 using the function
y = f ilter(h, 1, x).
Matlab Code
xn = ones(1,101);
num = [0.18 0.1 0.3 0.1 0.18];
den = [1 -1.15 1.15 -0.7 0.25];
hn = impz(num, den, 101);
yf = filter(hn,1,xn);
stem([0:100], yf);

Exercise 3
Determine the z-transform and sketch the pole-zero plot with the ROC for each of the following
sequences:

Solution
1 n
1. x[n] = 2
(u[n] u[n 10])
1
X 1 n n
x[n] , (u[n] u[n 10])z
n= 1
2
X9
1 n n 1 ( 12 )10 z 10
x[n] , z =
n=0
2 1 12 z 1

j 2⇡k
Pole at z = 12 and Zeros at zk = 12 e 10 , k 2 {0, ..., 9}. The pole and zero at z = 1
2
will
cancel each other =) ROC : |z| > 0

5
1 |n|
2. x[n] = 2

X1 X1
1 n n 1 n n
x[n] , z + z
n=0
2 n= 1
2
1 n 1 n
=) x[n] = u[n] + u[ n 1]
2 2
1 n 1 1
u[n] , , ROC : |z| > | |
2 1 1/2z 1 2
1
2n u[ n 1] , , ROC : |z| < |2|
1 2z 1
1 1 1
x[n] , 1
, ROC : | | < |z| < |2|
1 1/2z 1 2z 1 2

Poles at z = 12 , 2 and Zero at z = 0.

3. x[n] = 5|n|

1
X X1
n n
x[n] , 5nz 5nz
n=0 n= 1

=) x[n] = 5nu[n] 5nu[ n 1]


z 1 z 1
x[n] , 5 + 5 , ROC : |z| > 1 \ |z| < 1 = ;
(1 z 1 )2 (1 z 1 )2
1 n
4. x[n] = 2
cos(⇡n/3)u[n]

1 12 cos(⇡/3)z 1 1
X(z) = , ROC : |z| >
1 cos(⇡/3)z 1 + 14 z 2 2
1
1 4
z 1
= 1 1 + 1z 2
1 2
z 4

6
Exercise 4
Use the method of partial fraction expansion to determine the sequences corresponding to the
following z-transforms:

Solution
1
1 z 1
1. X(z) = (1 z
3
1 )(1+2z 1) , all possible ROCs.

A1 A2
X(z) = 1
+ 1
1 z 1 + 2z
2
A1 = (1 z 1 )X(z) |z=1 =
9
7
A2 = (1 + 2z 1 )X(z) |z= 2 =
9
2/9 7/9
1
+ X(z) =
1 z 1 + 2z 1
2 7
ROC: |z| < 1 \ |z| < 2 = |z| < 1 =) x[n] = u[ n 1] ( 2)n u[ n 1]
9 9
2 7
ROC: |z| > 1 \ |z| < 2 = 2 < |z| < 1 =) x[n] = u[n] ( 2)n u[ n 1]
9 9
2 7
ROC: |z| > 1 \ |z| > 2 = |z| > 2 =) x[n] = u[n] + ( 2)n u[n]
9 9

1 z 1
2. X(z) = 1 1 z 1 , x[n] is causal.
4

1 z 1
X(z) = , ROC : |z| > 0.25
1 0.25z 1 1 0.25z 1
x[n] = (0.25)n u[n] (0.25)n 1 u[n 1]
1
3. X(z) = (1 0.5z 1 )(1 0.25z 1) , x[n] is absolutely summable.

A1 A2
X(z) = 1
+
1 0.5z 1 0.25z 1
A1 = (1 0.5z 1 )X(z) |z=0.5 = 2
0.25z 1 )X(z) |z=0.25 =
A2 = (1 1
2 1
X(z) = 1
, ROC : |z| > 0.5
1 0.5z 1 0.25z 1
=) x[n] = 2(0.5)n u[n] (0.25)n u[n]

7
Exercise 5
The response of a LTI system to the input x[n] = u[n] is y[n] = 2(1/3)n u[n].

Solution
1. Find the impulse response h[n] of the system.

Y (z)
H(z) =
X(z)
1
X(z) = , ROC : |z| > 1
1 z 1
2 1
Y (z) = 1 , ROC : |z| >
1 3z 1 3
2(1 z 1 ) 1
=) H(z) = 1 1
, ROC : |z| >
(1 3 z ) 3
4
H(z) = 6
(1 13 z 1 )
✓ ◆n
1
=) h[n] = 6 [n] 4 u[n]
3

2. Find the output y[n] for the input x[n] = (1/2)n u[n].

1 1
X(z) = 1 , ROC : |z| >
1 2
z 1 2
1
2(1 z ) 1
H(z) = 1 , ROC : |z| >
(1 3
z 1) 3
Y (z) = H(z)X(z)
6 8
Y (z) = 1 +
1 2z 1 1 13 z 1
✓ ◆n ✓ ◆n
1 1
=) y[n] = 6 u[n] + 8 u[n]
2 3

3. Check the results in 1 and 2 using the MATLAB function filter.


Matlab Code
n = 0 : 100;
xn = (1/2). ˆn
yn = filter([2 -2],[1 -1/3],xn);
stem(yn);

You might also like