Let's consider the simple system having
p=1
p1
and
q=0
q0.
yn
ayn−1+bxn
yn
a
y
n1
b
xn
(1)
To compute the output at some index, this difference equation
says we need to know what the previous output
yn−1
y
n1
and what the input signal is at that moment of time. In more
detail, let's compute this system's output to a unit-sample input:
xn=δn
xn
δn
.
Because the input is zero for negative indices, we start by trying to
compute the output at
n=0
n0.
y0=ay-1+b
y0
a
y
-1
b
(2)
What is the value of
y-1
y-1?
Because we have used an input that is zero for all
negative indices, it is reasonable to assume that the output is also
zero. Certainly, the difference equation would not describe a
linear system if the
input that is zero for
all time did not
produce a zero output. With this assumption,
y-1=0
y-1
0
,
leaving
y0=b
y0
b
.
For
n>0
n0,
the input unit-sample is zero, which leaves us with the
difference equation
∀n,n>0:yn=ayn−1
n
n0
yn
a
y
n1
.
We can envision how the filter responds to this input by making a table.
yn=ayn−1+bδn
yn
a
y
n1
b
δn
(3)
Table 1
|
n
|
x(n)
|
y(n)
|
|
-1
|
0
|
0
|
|
0
|
b
|
b
|
|
1
|
0
|
ba
b
a
|
|
2
|
0
|
ba2
b
a2
|
|
:
|
0
|
:
|
|
n
|
0
|
ban
b
an
|
Coefficient values determine how the output behaves. The
parameter bb can be any value,
and serves as a gain. The effect of the parameter
aa is more complicated (Table 1). If it equals zero, the
output simply equals the input times the gain
bb. For all non-zero values of
aa, the output lasts forever;
such systems are said to be IIR (
Infinite Impulse
Response). The reason for this
terminology is that the unit sample also known as the impulse
(especially in analog situations), and the system's response
to the "impulse" lasts forever. If
aa is positive and less than one,
the output is a decaying exponential. When
a=1a1,
the output is a unit step. If aa
is negative and greater than
-11,
the output oscillates while decaying exponentially. When
a=1
a1,
the output changes sign forever, alternating between
bb and
-bb.
More dramatic effects when
|a|>1
a1;
whether positive or negative, the
output signal becomes larger and larger, growing
exponentially.
Positive values of aa
are used in population models to
describe how population size increases over time. Here,
nn might correspond to
generation. The difference equation says that the number in the next
generation is some multiple of the previous one. If this multiple is
less than one, the population becomes extinct; if greater than one,
the population flourishes. The same difference equation also describes
the effect of compound interest on deposits. Here,
nn indexes the times at
which compounding occurs (daily, monthly, etc.),
aa equals the compound interest rate plus
one, and
b=1
b1 (the bank provides no gain). In signal processing
applications, we typically require that the output remain bounded for
any input. For our example, that means that we restrict
|a|=1
a1 and chose values for it and the
gain according to the application.
Note that the
difference equation,
yn=a1yn−1+…+apyn−p+b0xn+b1xn−1+…+bqxn−q
yn
a1
y
n1
…
ap
y
np
b0
xn
b1
x
n1
…
bq
x
nq
(4)
does not involve terms like
yn+1
y
n1
or
xn+1
x
n1
on the equation's right side. Can such terms also be
included? Why or why not?
Such terms would require the system to know what future
input or output values would be before the current value was
computed. Thus, such terms can cause difficulties.
A somewhat different system has no "a" coefficients. Consider the
difference equation
yn=1qxn+…+xn−q+1
y
n
1
q
x
n
…
x
n
q
1
(5)
Because this system's output depends only on current and previous
input values, we need not be concerned with initial conditions. When
the input is a unit-sample, the output equals
1q
1 q
for
n=0…q−1
n
0
…
q 1
, then equals zero thereafter. Such systems are said to be
FIR (Finite Impulse Response) because their unit
sample responses have finite duration. Plotting this response
(
Figure 2) shows that the
unit-sample response is a pulse of width
qq and height
1q
1 q
. This waveform is also known as a boxcar, hence the name
boxcar filter given to this system. (We'll
derive its frequency response and develop its filtering
interpretation in the next section.) For now, note that the
difference equation says that each output value equals the
average of the input's current and
previous values. Thus, the output equals the running average
of input's previous
qq
values. Such a system could be used to produce the average
weekly temperature (
q=7
q 7
) that could be updated daily.