lecture_22

ECE
8443
– PatternContinuous
Recognition
EE
3512
– Signals:
and Discrete
LECTURE 22: FOURIER ANALYSIS OF DT SYSTEMS
• Objectives:
Frequency Response
Response of a Sinusoid
DT MA Filter
Filter Design
DT WMA Filter
Difference Equations
• Resources:
Wiki: Fourier Analysis
Wiki: Moving Average
USU: The Discrete-Time FT
DSPGuide: Moving Average Filters
Logix4u: MA Demo
URL:
Fourier Analysis of Discrete-Time Systems
• Recall our convolution sum for DT systems:
y[n]  h[n] * x[n] 

 h[i]x[n  i]
i  
• Assume the ordinary DTFT of h[n]
exists (absolute summability):
j
• The DTFT of h[n] is: H (e ) 

x[n ]

 h[n]  
n  
 h[n]e
 jn
n  
• We can also write our input/output relations:
Y ( e j  )  H ( e j ) X ( e j )
Y ( e j )  H ( e j ) X ( e j  )
Y (e j )  H (e j )  X (e j )
• Note also (applying the time shift property):
y[n]  ay[n  1]  bx[n]  cx[n  1]  dx[n  2]

Y (e j )  aY (e j )e  j  bX (e j )  cX (e j )e  j  dX (e j )e  2 j


Y (e j ) 1  ae  j  X (e j ) b  ce  j  de  2 j

Y (e j ) b  ce  j  de  2 j
H (e ) 

j
X (e )
1  ae  j
j
EE 3512: Lecture 22, Slide 1
DT LTI
h[n ]
y[n]
Response to a Sinusoid
• Paralleling our derivation for CT systems:
x[n]  A cos 0 n   
    A e
X e

j
 j
k  
    0  2k   e j     0  2k  (see Table 4.1)
   H e X e    AH e e
Ye
j
j

j
j
 j
k  

 A e

 j
k  


    0  2k   e j     0  2k 



H e j ( 0  2k )     0  2k   e j H e j (0  2k )     0  2k 
• Note that the H(ej) is periodic with period 2. Also, since h[n] is real-valued,
|H(ejj)| is an even function:
    A H e e
Ye
j

j0
k  
• Taking the inverse DTFT:
  


      2k   e j ( H e   )     2k 
0
0
 j ( H e j 0  )
j 0
 
y[n]  A H e j0 cos  0 n    H e j0
• As we saw with CT LTI systems, when the input is a sinusoid, the output is a
sinusoid at the same frequency with a modified amplitude and phase.
• If the system were nonlinear, what differences might we see in the output?
EE 3512: Lecture 22, Slide 2
Example: Response to a Sinusoid
EE 3512: Lecture 22, Slide 3
Linear Constant-Coefficient Difference Equations
• We can model the input/output behavior of a DT
LTI systems using an Nth-order input/output
difference equation (also called a digital filter):
N
M
i 1
i 0
x[n ]
y[n]   ai y[n  i ]   bi x[n  i ]
DT LTI
h[n ]
y[n]
• Solution of such equations can be easily computed by solving for y[n]:
N
M
i 1
i 0
y[n]   ai y[n  i ]   bi x[n  i ]
• Let us consider a simple example: y[n]  1.5 y[n  1]  y[n  2]  2 x[n  2]
Let us assume: x[n]   [n] y[1]  0 y[2]  0 (the latter are referred to as
initial conditions). The output can be computed using a table:
n
x[n]
x[n-1]
x[n-2]
y[n]
y[n-1]
y[n-2]
0
1
0
0
0
0
0
1
0
1
0
0
0
0
2
0
0
1
2
0
0
3
0
0
0
3
2
0
4
0
0
0
2.5
3
2
EE 3512: Lecture 22, Slide 4
Difference Equations in MATLAB
• The solutions to these equations can
be easily programmed in MATLAB.
• Note that the key step is actually a dot
product between the equation’s
coefficients and the previous samples
of the output and input (often referred
to as the filter memory).
• The response to a unit step function
can also be computed using the
function recur.
• The unit step function is created by
assigning values of “1” to x,
followed by the invocation of the
recur function that performs the
difference equation computations.
EE 3512: Lecture 22, Slide 5
Complete Response of a First-Order Equation
• Consider the first-order linear difference equation:
y[n]  ay[n  1]  bx[n]
• Let us assume that: y[1]  0
y[0]  ay[1]  bx[0]
y[1]  ay[0]  bx[1]  a(ay[1]  bx[0])  bx[2]  a 2 y[1]  abx[0]  bx[1]
y[2]  a(a 2 y[1]  abx[0]  bx[1])  bx[3]  a 3 y[1]  a 2 bx[0]  abx[1]  bx[2]
...
n
y[n]  a y[0]   a n i bx[i ]
n
i 0
• The first part of the response is due to the initial condition being nonzero. The
second part of the response is due to the forcing function, x[n].
• Together, they comprise the complete response of the system.
• We will see that closed-form solutions of these equations can be easily
computed using the z-transform, which is very similar to the Laplace
transform. The z-transform converts the difference equation to an algebraic
equation.
• Closed-form solutions can also be found using summation tables.
EE 3512: Lecture 22, Slide 6
Example: Moving Average (MA) Filter
• In this example, we will demonstrate that the process of averaging is
essentially a lowpass filter. Therefore, many different types of filters, or
difference equations, can be used to average. In this example, we analyze
what is known as a “moving average” filter:
1
y[n]  x[n]  x[n  1]  x[n  2]  ...  x[n  N  1]
N
1
Y ( e j ) 
X (e j )  e  j X (e j )  ...  e  j ( N 1) X (e j )
N
1
 1  e  j  e  2 j  ...  e  j ( N 1) X (e j )
N
1
H (e j )  1  e  j  e  2 j  ...  e  j ( N 1)
N
sin( N / 2)
H ( e j ) 
N sin(  / 2)






• MATLAB CODE:
W=0:.01:1;
H=(1/2).*(1-exp(-j*2*pi*W))/.(1-exp(-j*pi*W));
magH=abs(H);
angH=180*angle(H)/pi;
EE 3512: Lecture 22, Slide 7
Example: Filter Design
• The magnitude of the frequency response
of a 3rd-order MA filter:
1
y[n]  x[n]  x[n  1]  x[n  2]
3
is shown to the right. What is wrong?
• Can we do better?
y[n]  cx[n]  dx[n  1]  ex[n  2]
• Optimization of the coefficients, c, d, and e,
is a topic known as filter design.
• We will use three constraints:
c  d  f 1
H ( e j )
H ( e j )
 
  / 2
0
 as small as possible
• This generates three equations:
c  d  f 1
H ( e j )
H ( e j )
 
  / 2
cd  f 0
 (c  f ) 2  d 2  as small as possible
EE 3512: Lecture 22, Slide 8
Example: Filter Design (Cont.)
• Solution of these equations results in:
y[n]  0.25 x[n]  0.5 x[n  1]  0.25 x[n  2]
The magnitude response is shown to the
right.
• Suppose we cascade two of these filters.
What is the impact?
h[n]  h1 [n] * h2 [n]
 (0.25 x[n]  0.5 x[n  1]  0.25 x[n  2])
* (0.25 x[n]  0.5 x[n  1]  0.25 x[n  2])
 0.0625 x[n]  0.25 x[n  1]  0.375 x[n  2]
 0.25 x[n  3]  0.625 x[n  4]
• Both of these filters can be shown to have
linear phase responses. Both compute
“weighted” averages. Which is better?
Which is more costly? Can we do better?
EE 3512: Lecture 22, Slide 9
Summary
• Introduced the use of the DTFT to compute the output of a DT LTI system.
• Demonstrated that the output of a DT LTI system to a sinusoidal input is also
sinusoidal.
• Formalized the concept of a difference equation
• Introduced the concept of filter design and demonstrated the design of
moving average filters.
• Next: Laplace Transforms
X (e j ) 

 x(t )e
 jt
dt (Fourier Transform)


X (e )  X ( s ) 
s
 st
x
(
t
)
e
dt (two - sided Laplace Transform)



X ( s )   x(t )e  st dt (one - sided Laplace Transform)
0
• What properties will hold for this transform?
• Why do we need another transform? Where you have applied this?
EE 3512: Lecture 22, Slide 10