ECE 381: Laboratory 10 |
Winter 2006 |
Discrete Time difference equation and convolution. |
April |
|
|
|
Assignment |
|
I. Numerical
solutions of Discrete-time Difference Equations using MATLAB
1.
Solve the
following difference equation numerically using MATLAB. Show the stem plot for the result for n=-5:1:10
y[n] -1.1y[n-1] +0.3y[n-2]=0; y[-1]=9, y[-2]=49/3
Refer to Computer Example C3.3 on page
274 of the course textbook for help.
2.
Because the
difference equation in (1) has no input, the output y[n] is also
the zero-input response.
The zero-input response to this equation
was derived in class as
y[n]=(2.*(.5).^n+3.*(0.6).^n).*u[n]
Show this result on a stem plot also to
show that this equation matches the result found for part (1). Note, however, that the closed form expression of y[n] that is given here only applies for n>=0, so you must append values to y to also account for
values of n in -5<=n<=-1.
II. The MATLAB filter
function
3. MATLAB includes a "filter" function that allows one to provide the a and b coefficients from a difference equation and produce the filtered output of x[n] that results from using that transfer function. Recall that the a coefficients would come from Q(E) in
1.
Q(E)y[n]=P(E)x[n] and b's from P(E).
The form of filter is
"h = filter(b,a,x(n))" where b and a are vectors of coefficients b = [b0 b1 b2 ...] and a
= [1 a1 a2 ...]. Use "help
filter" in MATLAB if more information is needed.
Show the output of the MATLAB filter
function for the following difference equation.
y[n] - 0.6y[n-1]
-0.16y[n-2] = 5x[n]
x = inline('n==0') which means x is the DT impulse function
2.
Using the
approach you used in problem (1), show the output of the difference equation in
problem (3) and show
that the results
are the same.
III. Convolution using MATLAB
3.
Refer to
Computer Example C3.7 in the course textbook in page 299. This describes the DT convolution function
that is available in MATLAB. Show a stem
plot for the convolution of the following two signals. Make sure to appropriately label the time
axis n.
x[n] = (0.8).^n.*(u[n] - u[n-20])
h[n] = u[n-3]-u[n-20]
4.
Refer to the
lecture notes for Section 3.8 were a convolution
example very similar to this was given.
An error was made in the computation, so the answer should really have
been -5.*((0.8).^(n-2)-1).*u[n-3]. Plot that
result that for 0<=n<=40 and compare it to the plot for problem (5). Explain where and why the plots are similar
and where and why the plots are different.
IV. Using MATLAB to Find the Zero-state Response
5.
Now as a final
exercise we wish to use MATLAB to find the zero-state response of a
system. This involves (1) finding the
impulse response, and (2) finding yzs[n] as the
convolution of h[n] and x[n]. Find and
show the stem plot for zero-state response of the following difference
equation.
y[n] - 5y[n-1] +6y[n-2] =
x[n-1] + 5x[n-2]
x[n] = (3.*n+5).*(n>=0)
(a) Show the stem plot for the impulse response.
(b) Show the stem plot for the zero-state response yzs[n] = x[n] *
h[n]
6.
Produce the
result for (7) using the MATLAB filter command.