CH 05
CH 05
CH 05
input output
sequence sequence
notation:
y[n] = T {x[n]}
ex:
y[n] = x[n] (identity system)
y[n] = αx[n] where α ∈ R (scaling system)
y[n] = αx[n] + β α, β ∈ R
y[n] = x[n − no] no ∈ Z (ideal delay system)
y[n] = |x[n]| (absolute value system)
y[n] = (x[n])2 (squaring system/squarer)
y[n] = min(x[n − 1], x[n])
..
2
Discrete-Time (Digital) System
Digital Filtering
3
Rockland Digital Filter (1971)
For the price of a small house, you could have one of these.
4
Digital Cell Phone (ca. 2000)
5
We will start with averaging filters.
When/Why do we perform averaging?
Suppose we have N items xi to average.
These could be students’ grades, temperature, stock
market values, exchange rates on different days, etc.
We can perform simple averaging:
N
1 X
xav = xi
N i=1
where each item is assigned equal importance or weight
(wi = N1 ) or weighted averaging where the items
have different weights wi:
XN XN
xav = wixi where wi = 1
i=1 i=1
Averaging is used when data fluctuate and must be
smoothened prior to interpretation.
Filtered Stock Signal
INPUT
OUTPUT
50-pt averager
6
We will look at running (moving) average fil-
ters where the average of two or more consecutive
values of the input sequence are taken to produce a
new sequence of output values.
Consider 3-point averaging where each value of
the output sequence is the sum of three consecutive
input sequence values divided by three:
1
y[n] = (x[n] + x[n + 1] + x[n + 2]) −∞ < n < ∞
3
Such an equation relating the output sequence of the
filter to its input sequence is called a difference equa-
tion. It provides a complete description of the system
(the filter).
1
for n = 0: y[0] = 3 (x[0] + x[1] + x[2])
1
for n = 1: y[1] = 3 (x[1] + x[2] + x[3])
1
for n = 2: y[2] = 3 (x[2] + x[3] + x[4])
1
for n = 3: y[3] = 3 (x[3] + x[4] + x[5])
..
7
Consider the following sequence which we will use
as the input sequence to the 3-pt averager:
Discrete-Time Sequence
STEM PLOT
8
3-point Averaging System
add 3 consecutive numbers and divide by 3
repeat this for each “n”
Make a TABLE
n=0
n=1
input sequence
output sequence
9
The output sequence also has finite support:
−2 ≤ n ≤ 4 (seven units).
It has longer duration than the input sequence
(two more non-zero values).
Also, it is smoother than the input sequence.
In general, averaging has two effects:
• smoothening
• spreading out in time
Smoothening is characteristic of the running av-
erage FIR filter.
The choice of the output indexing is arbitrary. In
the above example, y[n] becomes non-zero before the
input starts. This would be undesirable if the input
sequence values came directly from an A-to-D con-
verter, as is common in audio SP applications.
In general, we can include samples of the input from
the past, present, or future. The current indexing
value of n is considered to be the present.
Based on this, we can design causal versus non-
causal filters. The distinction is based on whether
any future value of the input sequence is being used
in the filter’s difference equation or not.
In a causal filter, only the past and/or present
10
values of the input sequence can be used.
In a non-causal filter, at least one future value of
the input sequence is used. Whether the past and/or
present values are being used is irrelevant.
The distinction is important in real-time applications
where we have only access to past and present data,
but not the future.
“n” is TIME
11
causal 3-pt averager:
1
y[n] = (x[n] + x[n − 1] + x[n − 2]) −∞ < n < ∞
3
in expanded form:
filter coefficients:
{bk } = {bo, b1, . . . , bM −1, bM } (constants)
M : order of the filter
L: length of the filter
(same as the no. of filter coefficients)
L=M +1 Is this filter causal?
13
General FIR Filter
x[n-M] x[n]
14
ex: Given the set of filter coefficients
{bk } = {−2, 1, −1, 2, 4}
bo b1 b2 b3 b4
for a causal FIR filter, write the difference equation of
the filter. What is the order and what is the length?
ex:
(
1 2πn π
n
(1.02) + cos
2 8 + 4 for 0 ≤ n ≤ 40
x[n] =
0 otherwise
In this example, the desired component is the slowly
increasing exponential component (the first term).
The undesired component is the sinusoidal interfer-
ence (the second term).
16
Filtering Example
17
Filtering Example
the effect:
removes cosine by making its amplitude (A) much smaller
LONGER OUTPUT
18
Filtered Stock Signal
INPUT
OUTPUT
50-pt averager
OUTPUT
x[n] + y[n]
FILTER FILTER
INPUT +
FILTER
19
Special Input Signals
δ [n]=
UNIT-IMPULSE
{ }
1 n=0
0 n≠0
1
n=3
δ[n] is NON-ZERO
when its argument
is equal to ZERO
20
Decomposition of Input
•
Use shifted & scaled IMPULSES to write x[n]
x [n ]=2δ[n ]+4δ[n−1 ]+6δ[n−2 ]+4δ[ n−3 ]+2δ[n−4 ]
21
General FIR Filter
M M
y [n ]=∑ b k x [ n−k ] h[ n ]= ∑ b k δ [n−k ]
k=0 k=0
22
Hardware Structures
M
x[n]
FILTER
y[n]
y [n ]=∑ b k x [ n−k ]
k=0
Hardware Atoms
y [n ]=x 1 [ n ]+x 2 [ n ]
y [n ]=βx [n ]
y[n]=x [n−1 ]
23
FIR Structure
M
direct form
SIGNAL FLOW GRAPH
y [n ]=∑ b k x [ n−k ]
k=0
System Properties
x[n] y[n]
SYSTEM
time invariance
linearity
causality (“no output prior to input”)
stability
24
Time Invariance
key idea:
time-shifting the input will cause the same
time-shift in the output
equivalently,
we can prove that
the time origin (n=0) is picked arbitrarily
x[n]--->y[n]
x[n-no]--->y[n-no] for all n and all n_o
Testing Time-Invariance
25
Linearity
Testing Linearity
26
Linear Time-Invariant (LTI) Systems
27
Cascade Systems
S1 S2
Cascade Equivalent
S1 S2
S2 S1
28
dconvdemo: MATLAB GUI
29
Convolution Example
(Tabular Method)
h[ n ]=δ [n ]−δ [ n−1 ]+2δ[ n−2]−δ [ n−3 ]+δ [n−4 ]
x [n ]=u[n ]
n −1 0 1 2 3 4 5 6 7
x[n] 0 1 1 1 1 1 1 1 ...
h[n] 0 1 −1 2 −1 1 0 0 0
h[ 0]x[ n] 0 1 1 1 1 1 1 1 1
h[ 1] x[ n−1] 0 0 −1 −1 −1 −1 −1 −1 −1
h[ 2]x[ n−2] 0 0 0 2 2 2 2 2 2
h[ 3]x[ n−3] 0 0 0 0 −1 −1 −1 −1 −1
h[ 4] x[n−4] 0 0 0 0 0 1 1 1 1
y[n] 0 1 0 2 1 2 2 2 ...
30
Exercise
FIR filter is “first difference”
y[n] = x[n] - x[n -1]
express the system output as a convolution
need impulse response
Exercise
u[ n]= { }
1 n≥0
0 n<0
find y[n]
y[n ]=u[ n ]−u [n−1 ]=δ [n ]
31