Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Difference Equations
Andrew W. H. House
10 June 2004
b0 b1 b2 bN
y(n) = x(n) + x(n − 1) + x(n − 2) + . . . + x(n − N )
a0 a0 a0 a0
a1 a2 aN
− y(n − 1) − y(n − 2) − . . . − y(n − N )
a0 a0 a0
This last condition means that if, say, x(n) = u(n − 12), then we start y(n) at n = 12, 13, 14,
. . . so we need [y(11) = y(10) = . . . = y(12 − N ) = 0].
We can encapsulate this requirement with the initial rest condition.
Definition of IR (initial rest): If x(n) = 0 for n < no , then y(n) = 0 for n < no . (Note that
IR only describes causal systems).
Where do difference equations come from? There are a number of possible sources.
1. Difference equations can be exact models of DT systems.
yd (n) − yc (n − 1)
yd0 (n) ∼
=
T
Similarly, we can find yd00 (n) using yd0 (n) as the basis.
y 0 (n) − yc0 (n − 1)
yd00 (n) ∼
= d
T
We can likewise also find x0 (n) from x(t) and x0 (t). Substituting the DT
values into our CT equation, we get the following overall difference equation
for the DT system.
yd (n) − 2yd (n − 1) + yd (n − 2) yd (n) − yd (n − 1)
+2 + yd (n)
T2 T
xd (n) − xd (n − 1)
= xd (n) − , IR
T
We can group the like terms to get a more proper-looking difference equation.
1 2 2 1 2
yd (n − 2) − + 2 yd (n − 1) + + + 1 yd (n)
T2 T T T2 T
1 1
= 1+ xd (n) + xd (n − 1) , IR
T T
3. The system
n
X
y(n) = x(k)
k=−∞
so
1
y(n) = x(n) + y(n − 1) , IR
2
and we can implement the difference equation.
3. We can solve difference equations for a given x(n), either in time (recursively or via
formal methods like the CT differential equation) or in frequency (which we’ll cover
later). The recursive solution is an actual system implementation.
Let’s try this for x(n) = δ(n). Again, evaluating recursively from n = 0.
1
y(0) = x(0) + 12 y(0 − 1) = 1 + ·0=1
2
1 1 1
y(1) = x(1) + 2 y(1 − 1) = 0 + ·1=
2 2
1 1 1 1
y(2) = x(2) + 2 y(2 − 1) = 0 + · =
2 2 4
1 1 1 1
y(3) = x(3) + 2 y(3 − 1) = 0 + · =
2 4 8
.. .. ..
. . .
Not surprisingly, we see a trend here, and as expected, this output is the impulse
response of the system.
n
1
y(n) = h(n) = u(n)
2
This means of solution will work for any input x(n). Consider the following x(n).
We see that x(n) = 0 for n < 1, so y(n) = 0 for n < 1 due to IR condition. We
evaluate recursively from n = 1.
1
y(1) = x(1) + 12 y(1 − 1) = 1 + · 0 = 1
2
1 5
y(2) = x(2) + 12 y(2 − 1) = 2 + · 1 =
2 2
1 5 9
y(3) = x(3) + 12 y(3 − 1) = 1 + · =
2 2 4
1 9 1
y(4) = x(4) + 12 y(4 − 1) = −1 + · =
2 4 8
1 1 17
y(5) = x(5) + 12 y(5 − 1) = 1 + · =
2 8 16
1 17 17
y(6) = x(6) + 12 y(6 − 1) = 0 + · =
2 16 32
1 17 17
y(7) = x(7) + 12 y(7 − 1) = 0 + · =
2 32 64
.. .. ..
. . .
There is no overall form to represent this output, but we can see that y(n) for
n > 7 are going to follow the trend of 17/2n−1 that was apparent since n = 5.
We can plot y(n), shown below.
So this recursive method of solutions works for any x(n) so long as we have IR,
and is easily implementable in software or hardware.
That means we have an easy way to visualize difference equations. Furthermore, this graph-
ical representation lends itself to analysis.
Say we had the difference equation
which is represented graphically as shown below. (Note that we can group the input terms
and can represent them as w(n)).
and then we can combine the unit delays to reduce the storage requirements of the imple-
mentation. This, this form of graphical analysis provides tools and techniques allowing more
efficient implementation.
There is some question as to why this swapping of halves of the difference equation imple-
mentation can work. We can consider this in the context of the above sample difference
equation.
We already stated that
y(n) = w(n) − 3y(n − 1) , IR where w(n) = x(n) + 2x(n − 1)
for our initial graphical representation.
For our swapped and reduced version, we have a different intermediate signal, z(n), and we
see the following relationships.
z(n) = x(n) − 3z(n − 1)
y(n) = z(n) + 2z(n − 1)
This y(n) does not look much like our originally defined y(n). However, if we substitute the
value of z(n) into this new equation for y(n) for both z(n) and z(n − 1) we see the following.
y(n) = z(n) + 2z(n − 1)
= [x(n) − 3z(n − 1)] + 2 [x(n − 1) − 3z(n − 2)]
= x(n) − 3z(n − 1) + 2x(n − 1) − 6z(n − 2)
= x(n) + 2x(n − 1) − 3z(n − 1) − 6z(n − 2)
= x(n) + 2x(n − 1) − 3 [z(n − 1) + 2z(n − 2)]
= x(n) + 2x(n − 1) − 3y(n − 1) if we consider y(n) in terms of z(n)
Thus, the new form of the difference equation is still equivalent to the original, but has
allowed us to remove one of the unit delay components and thus provide a more efficient
implementation. This sort of optimization would be difficult to find without using these
graphical techniques.
Signals and Systems, 2E: Chapter 2.4.2–2.4.3, page(s) 121–127.
Signal Processing First: Chapter 5-2, page(s) 103.