Documente Academic
Documente Profesional
Documente Cultură
Name: Date:
Section: Rating:
Exercises #04
The Difference Equation
Introduction:
A linear, time-invariant discrete-time system can be described by a linear constant coefficient difference
equation of the form
N M
∑ a k y(n − k ) = ∑ b k x(n − k )
k =0 k =0
If aN ≠ 0, then the difference equation is of the order N. This equation describes a recursive approach for
computing the current output, given the input values and previously computed output values. In practice,
this equation is computed forward in time, from n = -∞ to n = ∞. The solution of this equation is of the form
y (n) = y c (n) + y p (n)
where yc(n) is the complementary solution and yp(n) is the particular solution.
1
Impulse response
1
0.8
0.6
0.4
0.2
y(n)
-0.2
-0.4
-0.6
-0.8
-1
-20 0 20 40 60 80 100 120
time index n
1.5
y(n)
0.5
0
-20 0 20 40 60 80 100 120
time index n
1. For each of the systems defined by difference equations, determine and plot the impulse and
step response. Use the Copy figure function of the MATLAB to plot the output in a separate sheet
of paper. Label each plots accordingly.
a. y(n) = 0.6y(n − 1) − 0.08 y(n − 2) + x(n)
2
Part 2 – Response to any arbitrary input
To determine the response of a system defined by a difference equation to any arbitrary input, just
generate the input signal sequence, assign it to x and use the filter()function to determine the output.
2. A “simple” digital differentiator is given by
y (n) = x(n) − x (n − 1)
which computes a backward first-order difference of the input sequence. Implement the
differentiator on the following sequences and plot the results on a separate sheet. Comment on
the appropriateness of this simple differentiator.
a. x (n) = 5[u(n) − u(n − 20 )]
πn
c. x(n) = sin [u(n ) − u(n − 100 )]
25
Part 3 – Convolution vs. filtering
3. Given the sequence
y(n) − 3 y(n − 1) − 4 y(n − 2 ) = x(n ) + 2x(n − 1)
a. Determine the first 30 terms of its impulse response. Plot it on a separate sheet of paper.
b. Obtain the first 30 terms of the sequence
x(n) = (0.5 )n
Use MATLAB.
c. Obtain the convolution sum of the sequences produced in (a) and (b). Plot the resulting
sequence.
d. Use the filter() function to determine the output of the above difference equation to the
input given in (b). Plot the resulting sequence.
e. Comment on the similarities and differences in the plots obtained in items (c) and (d).