Document

advertisement
Digital Signal Processing
Lectures 4 & 5
Discrete-time Linear Systems
Digital Filters
Andreas Spanias
Dept. of Electrical Engineering
Arizona State University
email: spanias@asu.edu
http://www.eas.asu.edu/~spanias
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 1
Discrete-time Linear Systems – Digital Filters
x(n)
h(n)
y(n)
The output is produced by convolving the input with the impulse response
f
y ( n)
¦ h( m) x( n m)
h( m) * x ( m)
m f
This operation can also involve a finite-length impulse response(FIR)
sequence
L
y ( n)
¦ h( m) x( n m)
m 0
An FIR filter is programmed using a multiply-accumulate instruction
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 2
Some Definitions
•A digital filter is linear if it has the property of
generalized superposition
•A digital filter is causal if it non anticipatory,
i.e., the present output does not depend on future
inputs.
•All real-time systems are causal.
• Non-causalities arise in image processing where
the signal indexes are spatial instead of temporal.
• Unless otherwise stated all systems in this
course will be assumed causal
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 3
Some More Definitions
x(n)
x(n)
x(n-1)
T
or
x(n-1)
z
x(n)
bL
1
bL x(n)
;unit delay
;signal scaling by a
filter coefficient
x(n)
x(n)+x(n-1) ;signal addition
¦
x(n-1)
2006
.
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 4
IIR Digital Filter Structure
x n y n ...
T
b1
T
bL
. ..
¦
-
.
-
..
..
T
...
T
T
a1
a2
b0
...
aM
feedback
L
y (n)
M
¦ b x(n i) ¦ a y (n i)
i
i
i 0
2006
i 1
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 5
FIR Digital Filter Structure
xn ...
T
b1
bL
T
.
. ..
y n ¦
..
b0
L
y (n)
¦ b x(n i)
i
i 0
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 6
Two i/p-o/p Equations for Digital Filters
x(n)
y(n)
h(n)
One can compute the output using the convolution sum
y (n)
f
f
m f
m f
¦ h( m) x ( n m) ¦ x( m) h(n m)
or by using the difference equation
L
y (n)
M
¦ b x(n i) ¦ a y (n i)
i
i
i 0
i 1
Remark: The impulse response h(n) can be determined by solving
the difference equation.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 7
Unit Impulse
The analysis of digital filters in the frequency domain is facilitated
using sinusoids. In the time domain a unique input signal is used
for analysis, namely the unit impulse. That is defined as:
G n n
0
G n 2006
^ 10
for
elsewhere
Copyright 2006 ©Andreas Spanias
n 0
Lecture 4&5 - 8
Signal Representation with Unit Impulses
Any discrete-time signal may be represented by a linear combination
of unit impulses
xn 1.5
2
0.5
0
0.5
1
3
2
4
n
5
1
2.5
is represented by:
x ( n ) .5G ( n 2 ) 1.5G ( n 1) 2 G ( n )
G ( n 1) .5G ( n 2 ) 2 .5G ( n 3)
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 9
Impulse Response
The response of a digital filter to a unit impulse is known as
impulse response and is given by
h(n) b0G (n) b1G (n 1) ... bLG (n L) a1h(n 1) a2 h( n 2) ... aM h(n M )
G(n)
2006
h(n)
Copyright 2006 ©Andreas Spanias
h(n)
Lecture 4&5 - 10
Finite-Length Impulse Response (FIR)
If the digital filter has no feedback terms the impulse response is
finite length
h(n) b0G (n) b1G (n 1) ... bLG (n L)
Note that
h(0) b0
Remark: The filter has a finite-length
impulse response and is called FIR. The
values of the impulse response sequence
are the coefficients themselves. The filter
is always stable.
h(1) b1
h(2) b2
..
..
h( L) bL
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 11
Example – The Moving Average Filter
y (n)
h( n)
L
1
¦ x(n i)
L 1 i 0
1
{G (n) G ( n 1) ... G (n L)}
L 1
h( n)
1
L 1
0dndL
Remark: The moving average is essentially a low-pass (smoothing)
filter. Later on we will see that this filter is also optimal in
estimation problems.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 12
Infinite-Length Impulse Response (IIR)
If the digital filter has feedback terms then the impulse response is infinite
length
L
M
¦ b G (n i) ¦ a h(n i)
h(n)
i
i
i 0
i 1
G ( n ) a1 h ( n 1)
Example:
h(n)
h(0) 1 h(1)
a1 h(2)
a1
2
..
..
h( n)
( a1 ) n
Remark: Note that is the coefficient a1 has magnitude larger than
one the the impulse response will go to infinity and hence the filter
would be unstable.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 13
IIR – Another First Order Example
hn
G n
0.2
¦
z 1
0.8
0 . 2G ( n ) 0 . 8 h ( n 1)
h(n)
h( n)
0.2 (0.8) n
nt0
Remark: This particular IIR filter is also a low-pass filter
behaving in similar manner like the the averaging FIR filter.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 14
IIR – Another First Order Example (Plot)
0.2 (0.8) n
h( n)
nt0
0.2
0.18
0.16
0.14
0.12
0.1
0.08
0.06
0.04
0.02
0
0
5
2006
10
15
20
Copyright 2006 ©Andreas Spanias
25
Lecture 4&5 - 15
Impulse Response of M-th Order IIR Filters
We have noticed that for a first order causal IIR filter
x ( n ) a1 y ( n 1)
y (n)
is
h(n) ( a1 ) n
nt0
For an M-th order causal IIR filter the impulse response
L
y (n)
M
¦ b x(n i) ¦ a y (n i)
i
i 0
i
i 1
the impulse response, assuming distinct roots, is
h(n)
c1 p1n c2 p 2n ... c M p Mn
nt0
Remark: c1, c2, .. are constants. p1., p2,… are the poles of the
filter. Note that if all the poles have magnitude less than one
then the filter is stable.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 16
Impulse Response and Causality
A digital filter is causal if the output depends on present and past
samples, as opposed to dependence on future samples.
L
y (n)
M
¦ b x(n i) ¦ a y (n i)
i
i
i 0
i 1
A causal digital filter is described by a causal impulse response, i.e.,
h(n)
for
0
therefore
n<0
f
¦ h( m) x (n m)
y (n)
m 0
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 17
Impulse Response and Stability
For the causal digital filter
f
¦ h( m) x (n m)
y (n)
m 0
Bounded Input Bounded Output (BIBO) stability is defined as
f
¦
k
h (k ) f
0
The condition above is guaranteed if
p
2006
i
1
for all
i = 1, 2, . . . , M
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 18
Transient and Steady State Response of Digital Filters
•Digital Filters have memory and hence they have
transient and a steady-state response
•An FIR filter has L memory elements keeping
past data. Therefore it will take L samples to
reach steady state
•For an IIR filter the transient state is determined
by solving the difference equation.
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 19
Example of Transient and Steady State Response
yn
un
u ( n) 1 n t 0
y ( n)
y tr (n) y ss ( n)
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
2006
0
0.2
¦
0.8 (0.8) n 1
z 1
0.8
Spanias
0 2Copyright
4 2006
6 ©Andreas
8 10 12
14 16 18 20Lecture 4&5
- 20
Transient Response of IIR Filters
The transient response for an IIR filter is of the form:
y tr ( n )
c1 p1n c2 p 2n ... c M p Mn
ci , i = 1, 2, . . . , m are constants evaluated using initial conditions
pi , i = 1, 2, . . . , m are the poles of the filter which are determined
by solving the equation below
p M a1 p M 1 a 2 p M 2 ... a M 1 p a M
2006
Copyright 2006 ©Andreas Spanias
0
Lecture 4&5 - 21
Steady-State Sinusoidal Response of
Digital Filters
A special case of interest is the steady-state response to input sinusoids
and is formulated as follows. For the IIR filter
L
y (n)
M
¦ b x(n i) ¦ a y (n i)
i
i 0
i
i 1
The frequency response function is given by:
b0 b1e j: b2e j 2: ... bL e jL:
H (e )
1 a1e j: a2e j 2: ... aM e jM:
j:
2006
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 22
Steady-State Sinusoidal Response of
Linear Discrete Systems (Cont.)
The frequency response function is periodic and an example of the
steady state sinusoidal response is given below
if:
sin( n: )
x(n)
then:
H (e j: ) sin( :n ‘H (e j: ))
y ss ( n )
2Sf
fs
:
2006
;normalized frequency
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 23
Example of Steady State Sinusoidal Response
yn
xn
0.2
¦
z 1
H ( e j: )
0.8
0 .2
1 0.8e j:
The filter is excited by a 500 Hz sinusoid and the
Sampling rate is 2000Hz.
x(n)
y ss (n) |
2006
sin( 2Sn500 / 2000 ) sin(
Sn
2
)
0.2
0.2
Sn
| sin(
))
arg(
1 0.8 j
2
1 0.8 j
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 24
Frequency Response Plot
H ( e j: )
1
0 .2
1 0.8e j:
``
0.5
0.1
0
2006
1000 Hz
Copyright 2006 ©Andreas Spanias
Lecture 4&5 - 25
Download