You are on page 1of 19

11/19/2017 Structures for Implementing Finite Impulse Response Filters

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 1/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Structures for Implementing Finite Impulse


Response Filters
October 04, 2017 by Steve Arar (/author/steve-arar)

This article will review some basic structures to implement


Finite Impulse Response (FIR) filters.

When designing a filter, we start from a set of specifications which are


generally determined by a particular application. For example, we may need
to suppress the 50-Hz noise which appears at the output of a sensor and
makes our measurements inaccurate. Based on the frequency and strength
of the noise component, we can determine the filter specifications such as
the passband and stopband edge, the transition bandwidth, the ultimate out-
of-band rejection, etc. Now, we can find the system function,

H(z)

, which satisfies these requirements.


H (z)
For a FIR design, we have a couple of options such as the windowing
method (https://www.allaboutcircuits.com/technical-articles/finite-impulse-
response-filter-design-by-windowing-part-i-concepts-and-rect/), the
frequency sampling method, and more. Then, we need to choose a
realization structure
(http://www.ee.ic.ac.uk/hp/staff/dmb/courses/DSPDF/01000_Structures.pdf)
for the obtained system function. In other words, there are several structures
which exhibit the same system function

H(z)

. One consideration for choosing the appropriate structure is the sensitivity


H (z)
to coefficient quantization. Since a digital filter uses a finite number of bits to
represent signals and coefficients, we need structures which can somehow

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 2/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

retain the target filter specifications even after quantizing the coefficients. In
addition, sometimes we observe that a particular structure can dramatically
reduce the computational complexity of the system.

The Direct-Form Structure


The direct-form structure is directly obtained from the difference equation.
Assume that the difference equation of the FIR filter is given by

M−1

y(n) = ∑ b kx(n − k)
k=0

M −1

y(n) = ∑ bk x(n − k)
Equation 1
k=0

Based on the above equation, we need the current input sample and

M−1

previous samples of the input to produce an output point. For


M −1

M=5

, we can simply obtain the following diagram from Equation 1.


M = 5

Figure 1. Direct-form structure for a fourth-order FIR filter.

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 3/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Using the direct-form realization of Figure 1, we need

multipliers for an
M

(M − 1)

th-order FIR filter. However, usually, we can almost halve the number of
(M − 1)
multipliers. This can be achieved by noting that we are mainly interested in
linear-phase FIR filters. In fact, the main advantage of a FIR filter over an
infinite impulse response (IIR) design is its linear-phase response,
otherwise, for a given set of specifications, an IIR design can offer a filter of
lower order and reduce the computational complexity. On the other hand, for
a linear-phase FIR filter, we observe the following symmetry in the
coefficients (https://www.allaboutcircuits.com/technical-articles/finite-
impulse-response-filter-design-by-windowing-part-i-concepts-and-rect/) of
the difference equation

bk = ± bM − 1 − k

bk = ±bM −1−k

For

M=5

, Equation 1 gives
M = 5

y(n) = b 0x(n) + b 1x(n − 1) + b 2x(n − 2) + b 3x(n − 3) + b 4x(n − 4)

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 4/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

y(n) = b0 x(n) + b1 x(n − 1) + b2 x(n

Assuming

bk = bM − 1 − k

, we obtain
bk = bM −1−k

y(n) = b 0(x(n) + x(n − 4)) + b 1(x(n − 1) + x(n − 3)) + b 2x(n − 2)

y(n) = b0 (x(n) + x(n − 4)) + b1 (x(

The structure obtained from the above equation is shown in Figure 2. While
Figure 1 requires five multipliers, employing the symmetry of a linear-phase
FIR filter, we can implement the filter using only three multipliers. This
example shows that for an odd

, the symmetry property reduces the number of multipliers of an


M

(M − 1)

th-order FIR filter from


(M − 1)

to
M
M+1
2

. For a brief discussion about the importance of linear-phase response see


M +1

this
2 article (https://www.allaboutcircuits.com/technical-articles/finite-impulse-

response-filter-design-by-windowing-part-i-concepts-and-rect/).

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 5/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Figure 2. The symmetry of a linear-phase FIR filter can be used to reduce the number of
multipliers.

The Cascade-Form Structure


While the direct form is derived from the difference equation, the cascade
structure is obtained from the system function

H(z)

. The idea is to decompose the target system function into a cascade of


H (z)
second-order FIR systems. In other words, we need to find second-order
systems which satisfy

M−1 P

H(z) = ∑ b kz − k = ∏ (b 0k + b 1kz − 1 + b 2kz − 2 )


k=0 k=1

M −1 P

−k
H (z) = ∑ bk z = ∏ (b0k + b1k z

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 6/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

∑ ∏(
Equation 2 k=0 k=1

where

is the integer part of


P
M
2

. For example,
M

2
M=5

,
M = 5

H(z)

will be a polynomial of degree four which can be decomposed into two


H (z)
second-order sections. Each of these second-order filters can be realized
using a direct form structure. It is desirable to set a pair of complex-
conjugate roots for each of the second-order sections so that the coefficients
become real. The reader may wonder why we need to rewrite a given

H(z)

in terms of second-order sections. In a future article, we will see that the


H (z)
main advantage of the cascade structure is its smaller sensitivity to the
coefficient quantization.

To clarify converting a system function into the cascade form, let’s review an
example.

Example 1

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 7/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Assume that we need to implement the nine-tap FIR filter given by the
following table using a cascade structure.

The system function of this filter is

H(z) = − 0.0977 + 0.1497z − 2 + 0.2813z − 3 + 0.3333z − 4 + 0.2813z − 5 + 0.1497z − 6 −

−2
H (z) = −0.0977 + 0.1497z + 0.2
It can be shown that

H(z) = GH 1(z)H 2(z)H 3(z)H 4(z)

H (z) = GH1 (z)H2 (z)H3 (z)H4 (z)

where

G = − 0.0977

G = −0.0977

(
H 1(z) = 1 − 2.5321z − 1 + z − 2 )
−1 −2
H1 (z) = (1 − 2.5321z +z )

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 8/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

(
H 2(z) = 1 − 0.3474z − 1 + z − 2 )
−1 −2
H2 (z) = (1 − 0.3474z +z )

(
H 3(z) = 1 + 1.8794z − 1 + z − 2 )
−1 −2
H3 (z) = (1 + 1.8794z +z )

(
H 4(z) = 1 + z − 1 + z − 2 )
−1 −2
H4 (z) = (1 + z +z )

Hence, we obtain the structure shown in Figure 3.

Figure 3. The cascade structure for the system function of Example 1.

Each of these second-order systems can be realized using the direct-form


structure. For example, the realization of

H 1(z)

is shown in Figure 4.
H1 (z)

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 9/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Figure 4. The direct form realization of

H 1(z)

.
H1 (z)

You can verify that

H 1(z)

pairs two real zeros of


H1 (z)

H(z)

, i.e.
H (z)

z 1 = 2.0425

and
z1 = 2.0425

z 2 = 0.4896

; however, the other three second-order sections (sos) incorporate the


z2 = 0.4896
complex-conjugate roots of

H(z)

. For example, the roots of


H (z)

H 2(z)

are
H2 (z)

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 10/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

( )
z 3 = 0.1737 + 0.9848j

and
z3 = 0.1737 + 0.9848j

z 4 = 0.1737 − 0.9848j

.
z4 = 0.1737 − 0.9848j
Since finding the cascade form of a practical FIR filter involves tedious
mathematics, we can use the MATLAB function tf2sos, which stands for
transfer function to second-order section, to obtain the cascade form of a
given transfer function. In fact, the cascade form of

H(z)

in the above example was found using the tf2sos function with the following
H (z)
lines of code:

N=[-0.0977 0 0.1497 0.2813 0.3333 0.2813 0.1497 0 -0.0977]; % This line


defines the numerator of H(z)

D=1; % This defines the denominator of H(z)

[sos, G]=tf2sos(N, D) % converts the transfer function defined by Nand Dinto


a cascade of second-order sections

The result will be:

sos=

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 11/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

and

G = − 0.0977

.
G = −0.0977

Each row of sos above gives the transfer function of one of the second-order
sections. The first three numbers of each row represent the numerator of the
corresponding second-order section and the second three numbers give its
denominator. For example, the first row of sos gives the second-order
section

H 1(z)

of Example 1 and so on. The tf2sos command also gives a gain factor,
H1 (z)

, which can be included in the cascade-form structure as shown in Figure 3.


G

Example 2
Assume that we need to implement the ten-tap FIR filter given by the
following table using a cascade structure.

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 12/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Similar to the previous example, we have:

N=[-0.0024 0.0073 0.0606 0.1691 0.2654 0.2654 0.1691 0.0606 0.0073


-0.0024];
D=1;
[sos, G]=tf2sos(N, D)

The result will be:

sos =

and

G = − 0.0024

.
G = −0.0024

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 13/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

Hence, the target system function can be rewritten in terms of second-order


sections as

H(z) = GH 1(z)H 2(z)H 3(z)H 4(z)H 5(z)

H (z) = GH1 (z)H2 (z)H3 (z)H4 (z)H

where

G = − 0.0024

G = −0.0024

H 1(z) = 1 − 7.7465z − 1

−1
H1 (z) = 1 − 7.7465z

H 2(z) = 1 + 0.8709z − 1 − 0.1291z − 2

−1 −2
H2 (z) = 1 + 0.8709z − 0.1291z

H 3(z) = 1 + 1.7922z − 1 + 1.6972z − 2

−1 −2
H3 (z) = 1 + 1.7922z + 1.6972z

H 4(z) = 1 + 0.9858z − 1 + z − 2

−1 −2
H4 (z) = 1 + 0.9858z +z

H 5(z) = 1 + 1.0560z − 1 + 0.5892z − 2

−1 −2
H5 (z) = 1 + 1.0560z + 0.5892z

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 14/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

In this example, the system function polynomial is of degree nine and,


hence, the filter has nine zeros. As a result, we observe that

H 1(z)

incorporates only one zero, i.e. the coefficient


H1 (z)

b 2k

in Equation 2 is zero for this second-order section.


b2k

We can realize the second-order sections of this example using a direct form
structure and obtain the cascade structure of the filter; however, there is
another alternative which allows us to reduce the computational complexity.
To find this computationally efficient structure, remember that, as illustrated
by Figure 1 and 2 above, a linear-phase FIR filter can be realized with a
smaller number of multipliers. On the other hand, notice that while the target
system function is a linear phase, only

H 4(z)

is a linear-phase FIR structure (because of the coefficient symmetry).


H4 (z)
So, the question remains: can we group the zeros of a given linear-phase
FIR system function in a way that the obtained decomposition incorporates
linear-phase structures? For a linear-phase FIR filter, the symmetry in the

bk

coefficients leads to asymmetry in the zeros of the transfer function. In


bk
particular, if

z1

and
z1

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 15/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

z 1∗

are the zeros of the transfer function, then



z
1
1
z1

and
1

z1
1

z1

are also a pair of its zeros.We can use this property to group the zeros in a
1

way
z
1
that the system function is decomposed into linear-phase elements.

Let’s use the MATLAB command roots, to find the zeros of the system
function:

N=[-0.0024 0.0073 0.0606 0.1691 0.2654 0.2654 0.1691 0.0606 0.0073


-0.0024];

roots(N)

Hence, we obtain:

z 1 = − 1.0000

z1 = −1.0000

z 2 = 7.7465

,
z2 = 7.7465

z 3 = 0.1291

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 16/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

z3 = 0.1291

z 4 = − 0.4929 + 0.8701j

,
z4 = −0.4929 + 0.8701j

z 5 = − 0.4929 − 0.8701j

z5 = −0.4929 − 0.8701j

z 6 = − 0.5280 + 0.5571j

,
z6 = −0.5280 + 0.5571j

z 7 = − 0.5280 − 0.5571j

z7 = −0.5280 − 0.5571j

z 8 = − 0.8961 + 0.9456j

,
z8 = −0.8961 + 0.9456j

z 9 = − 0.8961 − 0.9456j

z9 = −0.8961 − 0.9456j
The reader can verify that

1
z2 = z3

,
1
z2 =
z3
1
z4 = ∗
z5

,
1
z4 = ∗
z
5
1
z6 = ∗
z8

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 17/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

and
1
z6 = ∗
z
8
1
z7 =
z 9∗

. Then, we can pair


1
z7 = ∗
z
z2
9

and
z2

z3

to obtain the following linear-phase second-order section


z3

H LP1(z) = (1 − 0.1291z − 1)(1 − 7.7465z − 1) = (1 − 7.8756z − 1 + z − 2)

−1
HLP 1 (z) = (1 − 0.1291z )(1 − 7.7

Pairing

z4

and
z4

z5

gives:

H LP2(z) = (1 − ( − 0.4929 + 0.8701j)z − 1)(1 − ( − 0.4929 − 0.8701j)z − 1) = (1 + 0.985

Grouping

z6

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 18/19
11/19/2017 Structures for Implementing Finite Impulse Response Filters

z7

z8

, and

z9

together, we obtain:

H LP3(z) = 1 + 2.8482z − 1 + 4.1790z − 2 + 2.8482z − 3 + z − 4

To incorporate the zero

z1

, we need to include a first-order section, i.e.

H LP4(z) = 1 + z − 1

. A cascade of these linear-phase elements will give the original system


function:

H(z) = GH LP1(z)H LP2(z)H LP3(z)H LP4(z)

where

G = − 0.0024

https://www.allaboutcircuits.com/technical-articles/structures-for-implementing-finite-impulse-response-filters/ 19/19

You might also like