Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Fir Frequency Response

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

Frequency Response of FIR Filters

1. Introduction
In this set of notes, we introduce the idea of the frequency response of LTI systems, and focus specifically on the
frequency response of FIR filters.
2. Steady-state frequency response of LTI systems
A. Introduction

Let us consider a discrete-time, LTI system with impulse response h [ n ] . One question of great significance
in analyzing systems is how such a system will modify sinusoidal inputs of various frequencies. For example,
a low-pass filter might allow low-frequency components of a signal through relatively unchanged, while
dampening or attenuating higher frequencies.
In continuous time, we represent frequencies as cosine functions:
x ( t ) = cos ( 2πft ) (1)
where f denotes the frequency (in Hz) of x ( t ) . The discrete-time equivalent is, of course, just a sampled ver-
sion of x ( t ) :
x [ n ] = x ( n ⁄ f s ) = cos [ 2πf ( n ⁄ f s ) ] (2)

where f s denotes the sampling frequency in Hz. Note that in equation (2), we can group all the constant terms
inside the cosine function together:
θ = 2πf ⁄ f s (3)

such that,
x [ n ] = cos ( nθ ) , – ∞ < n < ∞ . (4)
Note that θ denotes the normalized frequency variable that we have seen before in our discussion of the dis-
crete-time Fourier transform (DTFT), and if we know f s for a particular discrete-time signal x [ n ] we can use
equation (3) to convert between the frequency variable θ and corresponding real frequencies f .
So, for a discrete-time LTI system with impulse response h [ n ] , we will now derive the output y [ n ] for a dis-
crete-time sinusoidal input x [ n ] as given by equation (4).

B. Derivation

Recall from the inverse Euler relations, that we can express equation (4) in terms of two complex exponen-
tials:

e jnθ + e – jnθ
x [ n ] = cos ( nθ ) = ----------------------------- (5)
2
Therefore, by linearity, we can compute the output y [ n ] by computing the outputs y 1 [ n ] and y 2 [ n ] for the
following two complex exponentials:

x 1 [ n ] = e jnθ and x 2 [ n ] = e – jnθ (6)

such that,
1 1
x [ n ] = --- x 1 [ n ] + --- x 2 [ n ] , and, (7)
2 2

1 1
y [ n ] = --- y 1 [ n ] + --- y 2 [ n ] . (8)
2 2
For an LTI system the output corresponding to an input x [ n ] and impulse response h [ n ] can be written as:

-1-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters


y[n] = h[n] * x[n] = ∑ h [ k ]x [ n – k ] (9)
k = –∞

Hence,

y1 [ n ] = h [ n ] * x1 [ n ] = ∑ h [ k ]x 1 [ n – k ] (10)
k = –∞


y1 [ n ] = ∑ h [ k ]e j ( n – k )θ (11)
k = –∞


y 1 [ n ] = e jnθ ∑ h [ k ]e – jkθ (12)
k = –∞

Now, recall our definition of the DTFT for a sequence x [ n ] :



X ( e jθ ) = ∑ x [ n ]e – jnθ (13)
n = –∞

Therefore, we can rewrite equation (12) as:

y 1 [ n ] = e jnθ H ( e jθ ) (14)

where H ( e jθ ) denotes the DTFT of the impulse response h [ n ] . We can pursue a similar derivation for
x2 [ n ] :

y2 [ n ] = h [ n ] * x1 [ n ] = ∑ h [ k ]x 2 [ n – k ] (15)
k = –∞


y2 [ n ] = ∑ h [ k ]e – j ( n – k )θ (16)
k = –∞


y2 [ n ] = e – jnθ ∑ h [ k ]e jkθ (17)
k = –∞

Note that we can rewrite equation (17) as:

y 2 [ n ] = e – jnθ H ( e – jθ ) (18)

where,

H ( e – jθ ) = ∑ h [ k ]e jkθ . (19)
k = –∞

Using equation (18), we now can compute the output y [ n ] for the sinusoidal input x [ n ] :
1 1
y [ n ] = --- y 1 [ n ] + --- y 2 [ n ] (20)
2 2

1 1
y [ n ] = --- e jnθ H ( e jθ ) + --- e – jnθ H ( e – jθ ) (21)
2 2
Note from the definitions of H ( e jθ ) and H ( e – jθ ) , that the following relationships hold true:

-2-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

H ( e – jθ ) = H ( e jθ ) (22)

∠H ( e – jθ ) = – ∠H ( e jθ ) (23)
We now substitute,

H ( e jθ ) = H ( e jθ ) e j ∠H ( e
jθ )
and H ( e – jθ ) = H ( e – jθ ) e j ∠H ( e
– jθ )
(24)
into equation (21), and then use properties (22) and (23) to simplify the expression for y [ n ] :
1 1
y [ n ] = --- e jnθ H ( e jθ ) e j ∠H ( e ) + --- e – jnθ H ( e – jθ ) e j ∠H ( e )
jθ – jθ
(25)
2 2

1
y [ n ] = --- [ H ( e jθ ) e jnθ + j ∠H ( e ) + H ( e jθ ) e – jnθ – j ∠H ( e ) ]
jθ jθ
(26)
2

e j [ nθ + ∠H ( e ) ] + e – j [ nθ + ∠H ( e ) ]
jθ jθ
y [ n ] = H ( e jθ )  --------------------------------------------------------------------------------- (27)
 2 

y [ n ] = H ( e jθ ) cos [ nθ + ∠H ( e jθ ) ] . (28)
To summarize, the output of an LTI system with impulse response h [ n ] for a sinusoidal input x [ n ] ,
x [ n ] = cos ( nθ ) , – ∞ < n < ∞ , (29)
is given by,

y [ n ] = H ( e jθ ) cos [ nθ + ∠H ( e jθ ) ] , (30)
where,

H ( e jθ ) = ∑ h [ k ]e – jkθ = DTFT of the impulse response h [ n ] . (31)
k = –∞

The function H ( e jθ ) is known as the frequency response function, and gives us the amplitude and phase at
the output of the system for sinusoids of different frequencies. That is for all discrete-time frequencies θ , we
can use equation (30) to compute how different frequency components at the input are modified (both in
amplitude and phase).

C. Generalization to arbitrary sinusoidal inputs

Now, we want the generalize the result in equations (29) through (31) for general sinusoidal inputs of the
form,
x [ n ] = A cos ( nθ + α ) , – ∞ < n < ∞ . (32)
Due to linearity and time invariance, the output y [ n ] will just be a scaled and time-shifted version of equa-
tion (30):

y [ n ] = H ( e jθ ) A cos [ nθ + α + ∠H ( e jθ ) ] . (33)

D. Frequency response of FIR filters

FIR LTI systems are given by the following general equation:


M
y[n] = ∑ bk x [ n – k ] (34)
k=0

The impulse response h [ n ] for such systems is given by,

-3-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

 bn n ∈ { 0, 1, …, M }
h[n] =  (35)
0 elsewhere

Therefore, we can rewrite the frequency response function H ( e jθ ) in terms of the filter coefficients b k for
FIR systems:
M
H ( e jθ ) = ∑ b k e – jkθ . (36)
k=0

Note that the limits in the summation above are now no longer infinite. Below, we explore properties of a sim-
ple FIR filter.
3. Simple FIR filter example
A. Introduction

Consider the following simple FIR system:


y[n] = 1 ⁄ 2x[n] + 1 ⁄ 2x[n – 1] (37)
In a previous lecture, we have already seen that the filter in equation (37) is an example of a low-pass filter
(see 1/16 lecture notes). Intuitively, we can see this is the case if we consider the output of the system for two
different inputs x 1 [ n ] and x 2 [ n ] :
x 1 [ n ] = cos ( nθ ) θ=0
= 1 , –∞ < n < ∞ , (38)

 1 n = even
x 2 [ n ] = cos ( nθ ) θ=π
= cos ( nπ ) =  , –∞ < n < ∞ . (39)
 –1 n = odd

Note that the first input sequence corresponds to zero frequency ( θ = 0 ), while the second input sequence
corresponds to the highest possible normalized frequency ( θ = π ). For these inputs, the corresponding out-
puts are given by,
y 1 [ n ] = 1 ⁄ 2 ( 1 ) + 1 ⁄ 2 ( 1 ) = 1 and (40)

y2 [ n ] = 1 ⁄ 2 ( –1 ) + 1 ⁄ 2 ( 1 ) = 0 . (41)

These input and output sequences are plotted in Figure 1 below. Thus, it appears that this filter passes through
the lowest frequency unchanged, while completely zeroing out the highest possible discrete-time frequency;
that’s why we would call this filter a low-pass filter. In the next section, we will derive the frequency response
function H ( e jθ ) for the filter in equation (37), and explore some of its properties.

B. Frequency response function

From the definition in equation (36), H ( e jθ ) for the filter in equation (37) is given by,
1
1 – jkθ 1 1
H ( e jθ ) = ∑ --- e
2
= --- + --- e – jθ .
2 2
(42)
k=0

We can rewrite equation (42) as:

H ( e jθ ) = e – jθ ⁄ 2  --- e jθ ⁄ 2 + --- e – jθ ⁄ 2 = e – jθ ⁄ 2 cos ( θ ⁄ 2 )


1 1
(43)
2 2 

From equation (43), H ( e jθ ) and ∠H ( e jθ ) are straightforward to compute:

H ( e jθ ) = e – jθ ⁄ 2 cos ( θ ⁄ 2 ) = e – jθ ⁄ 2 cos ( θ ⁄ 2 ) = cos ( θ ⁄ 2 ) (44)

-4-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

2 2
x1 [ n ] x2 [ n ]
1 1

0 0

-1 -1

-2 -2
0 5 10 n 15 20 0 5 10 n 15 20

2 2
y1 [ n ] y2 [ n ]
1 1

0 0

-1 -1

-2 -2
0 5 10 n 15 20 0 5 10 n 15 20

Figure 1

 –θ ⁄ 2 cos ( θ ⁄ 2 ) > 0
∠H ( e jθ ) = ∠e – jθ ⁄ 2 cos ( θ ⁄ 2 ) =  (45)
– θ ⁄ 2 ± π cos ( θ ⁄ 2 ) < 0

In Figure 2, we plot H ( e jθ ) and ∠H ( e jθ ) as a function of θ ∈ [ – π, π ] (recall that outside the plotted inter-
val, H ( e jθ ) (i.e. the DTFT) is periodic).
1 1.5
H ( e jθ ) ∠H ( e jθ )
0.8 1
0.5
0.6
0
0.4
-0.5
0.2 -1

0 -1.5
-3 -2 -1 0 1 2 3
-3 -2 -1 0
θ
1 2 3 θ
Figure 2
Note that the magnitude plot of the frequency response function confirms our specific results for θ = 0 and
θ = π . Also, note that H ( e jθ ) gives us the scaled output magnitudes for input frequencies between θ = 0
and θ = π , while the phase plot ∠H ( e jθ ) tells us the phase delay for every frequency. Note that the phase
profile in Figure 2 is known as a linear phase response, because the phase ∠H ( e jθ ) is a linear function of θ
in the interval θ ∈ [ – π, π ] . It might seem strange that different frequencies appear to get shifted by different
amounts; however, the linear phase property of this system is exactly what is desirable if we don’t want to
create phase distortion in a signal. This concept of phase distortion is considered in greater detail in the fol-
lowing section.

-5-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

C. Linear phase and phase distortion

Let us see how the linear phase characteristic of the filter in equation (37) affects the output of the system for
different frequencies. From equation (33), we can write the output y [ n ] as a function of the frequency vari-
able θ :

y [ n ] = H ( e jθ ) cos [ nθ + ∠H ( e jθ ) ]
= cos ( θ ⁄ 2 ) cos [ nθ – θ ⁄ 2 ] (46)
= cos ( θ ⁄ 2 ) cos [ θ ( n – 1 ⁄ 2 ) ]

Note that the linear phase characteristic of the filter results in exactly the same shift of – 1 ⁄ 2 for all normal-
ized frequencies θ . Therefore, an ideal filter should have a phase response of the following form:

∠H ( e jθ ) = aθ . (47)

For the filter in equation (37) a = – 1 ⁄ 2 ; in fact, causal filters will always have the property that a ≤ 0 . Also
note that more negative values of a introduce a greater time delay into the overall system response.

Let us now compare two hypothetical filters with the following frequency response functions:

H 1 ( e jθ ) = e – j5θ and H 2 ( e jθ ) = e – j5 .1 (48)

Both filters have the same magnitude responses,

H 1 ( e jθ ) = H 2 ( e jθ ) = 1 (49)

but different phase responses:

∠H 1 ( e jθ ) = – 5θ and ∠H 2 ( e jθ ) = – 5 . (50)

Note that the first filter has a linear-phase response, while the second filter has a constant phase response. We
now test this system with the following input sequence:

x [ n ] = cos  ------n + 2 cos  ------n , – ∞ < n < ∞ .


2π 4π
(51)
 50   50 

The corresponding outputs of the two systems will be given by,

y 1 [ n ] = x [ n – 10 ] = cos  ------ ( n – 5 ) + 2 cos  ------ ( n – 5 )


2π 4π
(52)
 50   50 

y 2 [ n ] = cos  ------n – 5 + 2 cos  ------n – 5 .


2π 4π
(53)
 50   50 

The input and two output sequences are plotted in Figure 3 below. Note that the first system results in an out-
put that is identical to the input except for a shift to the right of five time units; the second system, however,
results in an output that is a distortion of the input, because the two input frequencies get shifted by constant
amounts, not amounts proportional to each frequency component. Thus, y 2 [ n ] exhibits phase distortion; that
is although both frequencies in the input signal are present at the output with the same amplitude as the input,
the signal becomes distorted by constant phase shifts to each frequency component.

1. Note that H 1 corresponds to the system y [ n ] = x [ n – 5 ] , while the second corresponds to a filter
with complex filter coefficients.

-6-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

3
x[n]
2

-1

-2
0 n 20 40 n 60 80 100

3
y1 [ n ] y2 [ n ]
2
2
1
1
0
0
-1
-1
-2
-2
0 20 40 n 60 80 100 0 20 40 n 60 80 100

Figure 3

D. Comparison to time-domain convolution

For an FIR system, we now have two ways of computing the output y [ n ] for a given sinusoidal input. We can
either apply equation (33) above, or compute y [ n ] in the time-domain directly through the convolution sum.
Consider, for example, the following sinusoidal input x [ n ] applied to the system in equation (37):

x [ n ] = cos ( θn ) , – ∞ < n < ∞ , θ ∈ [ – π, π ] . (54)


Using the convolution sum, the output y [ n ] is given by,

y[n] = h[n] * x[n] = ∑ h [ k ]x [ n – k ] (55)
k = –∞

1
1 1
y[n] = ∑ b k x [ n – k ] = --- x [ n ] + --- x [ n – 1 ]
2 2
(56)
k=0

1 1
y [ n ] = --- cos ( θn ) + --- cos ( θ ( n – 1 ) ) (57)
2 2
From equation (46), we can also compute the output y [ n ] from the frequency response function:

y [ n ] = cos ( θ ⁄ 2 ) cos [ θ ( n – 1 ⁄ 2 ) ] (58)


We can show that the outputs in (57) and (58) are equivalent by applying the following trigonometric identity:

1 1
cos ( α ) cos ( β ) = --- cos ( α – β ) + --- cos ( α + β ) (59)
2 2
Since cos ( θ ⁄ 2 ) ≥ 0 , θ ∈ [ – π, π ] , we can first rewrite equation (58) as:

y [ n ] = cos ( θ ⁄ 2 ) cos [ θ ( n – 1 ⁄ 2 ) ] (60)


Now we apply trigonometric identity (59) to equation (60) by letting:

-7-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

α = θ ⁄ 2 and β = θ ( n – 1 ⁄ 2 ) (61)

1 1
y [ n ] = --- cos ( θ ⁄ 2 – θ ( n – 1 ⁄ 2 ) ) + --- cos ( θ ⁄ 2 + θ ( n – 1 ⁄ 2 ) ) (62)
2 2

1 1
y [ n ] = --- cos ( – θn + θ ) + --- cos ( θn ) (63)
2 2

1 1
y [ n ] = --- cos ( θn ) + --- cos ( θ ( n – 1 ) ) . (64)
2 2
Note that equation (64) is identical to the output derived directly from the convolution sum [equation (57)]. In
the next section, we will extend our result for sinusoidal inputs (i.e. relationship between time-domain convo-
lution and the frequency response function) to arbitrary input sequences x [ n ] .
4. Time-domain convolution in the frequency domain
A. Introduction

So far, we have shown that the analytic output y [ n ] of an LTI system to a sinusoidal input x [ n ] ,
x [ n ] = A cos ( nθ + α ) , – ∞ < n < ∞ , θ ∈ [ – π, π ] , (65)
is given by,

y [ n ] = H ( e jθ ) A cos [ nθ + α + ∠H ( e jθ ) ] (66)
where H ( e jθ ) is the frequency response of the system (i.e. the DTFT of the impulse response h [ n ] ). Below
we develop the system response of an LTI system for arbitrary input sequences x [ n ] in the frequency domain
and derive an important result that relates convolution in the time domain with multiplication in the frequency
domain.

B. Frequency-domain computation of system output

Let us consider the output of a system for an arbitrary input sequence x [ n ] . The DTFT X ( e jθ ) ,

X ( e jθ ) = ∑ x [ n ]e – jnθ (67)
n = –∞

gives us the frequency content of x [ n ] as a function of the normalized frequency variable θ . That is, X ( e jθ )
tells us the magnitude and phase of each frequency θ that makes up the time-domain signal x [ n ] . The fre-
quency response function H ( e jθ ) , on the other hand, tells us how each frequency component of x [ n ] will be
modified by the system. Therefore, the frequency representation of the output Y ( e jθ ) is given by,

Y ( e jθ ) = X ( e jθ )H ( e jθ ) (68)
where Y ( e jθ ) represents the DTFT of the output y [ n ] . If we compare equation (68) to the convolution repre-
sentation of the output in the time domain,
y[n] = x[n] * h[n] (69)
we see that convolution in the time domain corresponds to multiplication in the frequency domain. This is an
extremely important result, that applies not just to discrete-time systems, but to continuous-time systems as
well. Below, we show analytically that equations (68) and (69) are equivalent. The right-hand side of equation
(68) can be written as:

 ∞  ∞ 
Y ( e jθ ) = X ( e jθ )H ( e jθ ) =  ∑ x [ m ]e – jmθ  ∑ h [ p ]e – jpθ (70)
 m = –∞   p = –∞ 

-8-
EEL3135: Discrete-Time Signals and Systems Frequency Response of FIR Filters

∞ ∞
Y ( e jθ ) = ∑ ∑ x [ m ]e – jmθ h [ p ]e – jpθ (71)
m = –∞ p = –∞

∞ ∞
Y ( e jθ ) = ∑ ∑ x [ m ]h [ p ]e – j ( m + p )θ (72)
m = –∞ p = –∞

From equation (69) and the definition of the DTFT, we can write the following:
∞ ∞
 ∞ 
Y ( e jθ ) = ∑ y [ n ]e – jnθ = ∑  ∑ x [ k ]h [ n – k ] e –jnθ (73)
n = –∞ n = –∞ k = –∞

∞ ∞
Y ( e jθ ) = ∑ ∑ x [ k ]h [ n – k ]e – jnθ (74)
n = –∞ k = –∞

We now have to show that equations (72) [derived from (68)] and (74) [derived from (69)] are equivalent. To
do this, let us make the substitutions,
k = m (75)

n–k = p (76)
into equation (74):
∞ ∞
Y ( e jθ ) = ∑ ∑ x [ m ]h [ p ]e – j ( m + p )θ (77)
p = –∞ m = –∞

Note that equation (77) is equivalent to (72) (except for the order of summation, which can readily be inter-
changed). Thus, we have shown the following important correspondence:

y[n] = x[n] * h[n] ⇔ Y ( e jθ ) = X ( e jθ )H ( e jθ ) . (78)


5. Conclusion
The Mathematica notebook “fir_frequency_response.nb” was used to generate the example on phase distortion,
and shows the equivalence of time-domain convolution with frequency-domain multiplication for a simple FIR
system. In this set of notes, we introduced the concept of frequency response for LTI systems, gave the formula
for the frequency response of an FIR LTI system in terms of the coefficients of the system’s difference equation
[equation (36)], and explored some of the properties of the frequency response function through a simple FIR fil-
ter example. Finally, we showed that convolution in the time domain corresponds to multiplication in the fre-
quency domain.

-9-

You might also like