Parallel Realization

CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
6. Realization of Digital Filters
6.1. Direction-Form I Realization
The digital filter transfer function is given by
𝑯(𝒛) =
𝒀(𝒛) π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + β‹― + 𝒃𝑴 π’›βˆ’π‘΄ 𝑩(𝒛)
=
=
𝑿(𝒛)
𝟏 + π’‚πŸ π’›βˆ’πŸ + β‹― + 𝒂𝑡 π’›βˆ’π‘΅
𝑨(𝒛)
This expression can also be written as
𝒀(𝒛) = 𝑯(𝒛)𝑿(𝒛)
Or
π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + β‹― + 𝒃𝑴 π’›βˆ’π‘΄
𝒀(𝒛) = (
) 𝑿(𝒛)
𝟏 + π’‚πŸ π’›βˆ’πŸ + β‹― + 𝒂𝑡 π’›βˆ’π‘΅
Taking the inverse z-transform of the above equation yields the difference equation
π’š(𝒏) = π’ƒπŸŽ 𝒙(𝒏) + π’ƒπŸ 𝒙(𝒏 βˆ’ 𝟏) + β‹― + 𝒃𝑴 𝒙(𝒏 βˆ’ 𝑴)
βˆ’π’‚πŸ π’š(𝒏 βˆ’ 𝟏) βˆ’ π’‚πŸ π’š(𝒏 βˆ’ 𝟐) βˆ’ β‹― βˆ’ 𝒂𝑡 π’š(𝒏 βˆ’ 𝑡)
This difference equation can be implemented by a direct-form I realization. We introduce the
following notation:
𝒙(𝒏)
π’ƒπ’Š
π’ƒπ’Š βˆ™ 𝒙(𝒏)
Product / Scaling
𝒙(𝒏)
π’›βˆ’πŸ
𝒙(𝒏 βˆ’ 𝟏)
Delay
The direct form I realization of the above difference equation is given in the figure below.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
The direct form I realization of the second order IIR filter (𝑡 = 𝑴 = 𝟐) is given by
π’š(𝒏) = π’ƒπŸŽ 𝒙(𝒏) + π’ƒπŸ 𝒙(𝒏 βˆ’ 𝟏) + π’ƒπŸ 𝒙(𝒏 βˆ’ 𝟐) βˆ’ π’‚πŸ π’š(𝒏 βˆ’ 𝟏) βˆ’ π’‚πŸ π’š(𝒏 βˆ’ 𝟐)
is shown in the diagram below:
6.2. Direction-Form II Realization
Using the digital filter transfer function, we can write
𝒀(𝒛) = 𝑯(𝒛)𝑿(𝒛) =
𝑩(𝒛)
𝑿(𝒛)
𝑿(𝒛) = 𝑩(𝒛) (
)
𝑨(𝒛)
𝑨(𝒛)
This expression can also be written as
𝑿(𝒛)
𝒀(𝒛) = (π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + β‹― + 𝒃𝑴 π’›βˆ’π‘΄ ) (
)
𝟏 + π’‚πŸ π’›βˆ’πŸ + β‹― + 𝒂𝑡 π’›βˆ’π‘΅
By defining
𝑾(𝒛) =
𝟏 + π’‚πŸ
π’›βˆ’πŸ
𝟏
𝑿(𝒛)
+ β‹― + 𝒂𝑡 π’›βˆ’π‘΅
(1)
(2)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
We have
𝒀(𝒛) = (π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + β‹― + 𝒃𝑴 π’›βˆ’π‘΄ )𝑾(𝒛)
(3)
The corresponding difference equations for equations (2) and (3) are
π’˜(𝒏) = 𝒙(𝒏) βˆ’ π’‚πŸ π’˜(𝒏 βˆ’ 𝟏) βˆ’ π’‚πŸ π’˜(𝒏 βˆ’ 𝟐) βˆ’ β‹― βˆ’ 𝒂𝑡 π’˜(𝒏 βˆ’ 𝑡)
(4)
π’š(𝒏) = π’ƒπŸŽ π’˜(𝒏) + π’ƒπŸ π’˜(𝒏 βˆ’ 𝟏) + β‹― + 𝒃𝑴 π’˜(𝒏 βˆ’ 𝑴)
(5)
and
These difference equations can be implemented by a direct-form II realization.
The direct form II realization of the second order IIR filter (𝑡 = 𝑴 = 𝟐) is given by the
equations
π’˜(𝒏) = 𝒙(𝒏) βˆ’ π’‚πŸ π’˜(𝒏 βˆ’ 𝟏) βˆ’ π’‚πŸ π’˜(𝒏 βˆ’ 𝟐)
π’š(𝒏) = π’ƒπŸŽ π’˜(𝒏) + π’ƒπŸ π’˜(𝒏 βˆ’ 𝟏) + π’ƒπŸ π’˜(𝒏 βˆ’ 𝟐)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
is shown in the diagram below:
6.3. Cascade (Series) Realization
The digital filter transfer function can be factorized and written as
𝑯(𝒛) = π‘―πŸ (𝒛) βˆ™ π‘―πŸ (𝒛) β‹― π‘―π’Œ (𝒛)
where π‘―π’Œ (𝒛) is chosen to be first- or second-order transfer function (section), defined as,
π‘―π’Œ (𝒛) = (
π’ƒπ’ŒπŸŽ + π’ƒπ’ŒπŸ π’›βˆ’πŸ
)
𝟏 + π’‚π’ŒπŸ π’›βˆ’πŸ
Or
π’ƒπ’ŒπŸŽ + π’ƒπ’ŒπŸ π’›βˆ’πŸ + π’ƒπ’ŒπŸ π’›βˆ’πŸ
π‘―π’Œ (𝒛) = (
)
𝟏 + π’‚π’ŒπŸ π’›βˆ’πŸ + π’‚π’ŒπŸ π’›βˆ’πŸ
The block diagram for the cascade (or series) realization is shown in figure below.
For the individual first- or second-order transfer function (section), one can use either direct
form I or direct form II realizations.
6.4. Parallel Realization
The digital filter transfer function can be written as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
𝑯(𝒛) = π‘―πŸ (𝒛) + π‘―πŸ (𝒛) + β‹― + π‘―π’Œ (𝒛)
where π‘―π’Œ (𝒛) is chosen to be first- or second-order transfer function (section), defined as,
π’ƒπ’ŒπŸŽ
π‘―π’Œ (𝒛) = (
)
𝟏 + π’‚π’ŒπŸ π’›βˆ’πŸ
Or
π’ƒπ’ŒπŸŽ + π’ƒπ’ŒπŸ π’›βˆ’πŸ
(𝒛)
π‘―π’Œ
=(
)
𝟏 + π’‚π’ŒπŸ π’›βˆ’πŸ + π’‚π’ŒπŸ π’›βˆ’πŸ
The block diagram for the parallel realization is shown in figure below.
Here again, for the individual first- or second-order transfer function (section), one can use
either direct form I or direct form II realizations.
Example 13
Given a second-order transfer function
𝑯(𝒛) =
𝟎. πŸ“ (𝟏 βˆ’ π’›βˆ’πŸ )
(𝟏 + 𝟏. πŸ‘ π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ )
Perform the filter realizations and write the difference equations using the following
realizations
(1)
(2)
(3)
Direct form I and direct form II
Cascade form via the first-order sections
Parallel form via the first-order sections
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Solution
Part (1): The transfer function in its β€œdelay” form can be written as
𝟎. πŸ“ βˆ’ 𝟎. πŸ“ π’›βˆ’πŸ
𝑯(𝒛) =
𝟏 + 𝟏. πŸ‘ π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ
Comparing it with the standard delay form of the transfer function
π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + β‹― + 𝒃𝑴 π’›βˆ’π‘΄
𝑯(𝒛) =
𝟏 + π’‚πŸ π’›βˆ’πŸ + β‹― + 𝒂𝑡 π’›βˆ’π‘΅
We identify, that 𝑴 = 𝟏, 𝑡 = 𝟐, and
π’ƒπŸŽ = 𝟎. πŸ“,
π’ƒπŸ = 𝟎. 𝟎,
π’‚πŸ = 𝟏. πŸ‘,
π’‚πŸ = 𝟎. πŸ‘πŸ”
π’ƒπŸ = βˆ’πŸŽ. πŸ“
The difference equation form for the direct form I realization is given by
π’š(𝒏) = 𝟎. πŸ“ 𝒙(𝒏) βˆ’ 𝟎. πŸ“ 𝒙(𝒏 βˆ’ 𝟐) βˆ’ 𝟏. πŸ‘ π’š(𝒏 βˆ’ 𝟏) βˆ’ 𝟎. πŸ‘πŸ” π’š(𝒏 βˆ’ 𝟐)
The direct form I realization for this filter is shown in figure below.
For the direct form II realization, we write the difference equation as made up of the
following two difference equations
π’˜(𝒏) = 𝒙(𝒏) βˆ’ 𝟏. πŸ‘ π’˜(𝒏 βˆ’ 𝟏) βˆ’ 𝟎. πŸ‘πŸ” π’˜(𝒏 βˆ’ 𝟐)
π’š(𝒏) = 𝟎. πŸ“ π’˜(𝒏) βˆ’ 𝟎. πŸ“ π’˜(𝒏 βˆ’ 𝟐)
The direct form II realization of the filter is shown below in the figure.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Part (2): For the cascade realization, the transfer function is written in the product form. This
is achieved by factorization of the numerator and the denominator polynomials. The given
transfer function is
𝑯(𝒛) =
𝟎. πŸ“(𝟏 βˆ’ π’›βˆ’πŸ )
𝟏 + 𝟏. πŸ‘ π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ
The numerator polynomial can be factorized as
𝑩(𝒛) = 𝟎. πŸ“(𝟏 βˆ’ π’›βˆ’πŸ ) = 𝟎. πŸ“ (𝟏 βˆ’ π’›βˆ’πŸ )(𝟏 + π’›βˆ’πŸ )
The denominator polynomial can be factorized as
𝑨(𝒛) = 𝟏 + 𝟏. πŸ‘ π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ = 𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ + 𝟎. πŸ— π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ
= 𝟏(𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ ) + 𝟎. πŸ—π’›βˆ’πŸ (𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ )
= (𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ )(𝟏 + 𝟎. πŸ—π’›βˆ’πŸ )
Therefore, the transfer function can be written as
𝑯(𝒛) =
𝟎. πŸ“ (𝟏 βˆ’ π’›βˆ’πŸ )(𝟏 + π’›βˆ’πŸ )
(𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ )(𝟏 + 𝟎. πŸ—π’›βˆ’πŸ )
Or
𝑯(𝒛) = (
𝟎. πŸ“ βˆ’ 𝟎. πŸ“ π’›βˆ’πŸ
𝟏 + π’›βˆ’πŸ
)
(
) = π‘―πŸ (𝒛) βˆ™ π‘―πŸ (𝒛)
𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ
𝟏 + 𝟎. πŸ—π’›βˆ’πŸ
Thus, in this case
𝟎. πŸ“ βˆ’ 𝟎. πŸ“ π’›βˆ’πŸ
π‘―πŸ (𝒛) =
𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
π‘―πŸ (𝒛) =
𝟏 + π’›βˆ’πŸ
𝟏 + 𝟎. πŸ—π’›βˆ’πŸ
Each one of π‘―πŸ (𝒛) and π‘―πŸ (𝒛) can be realized in direct form I or direct form II. Overall, we get
the cascaded realization with two sections. It should be noted that there could be other
𝟏+π’›βˆ’πŸ
forms for π‘―πŸ (𝒛) and π‘―πŸ (𝒛), for example, we could have taken π‘―πŸ (𝒛) = 𝟏+𝟎.πŸ’ π’›βˆ’πŸ, π‘―πŸ (𝒛) =
𝟎.πŸ“βˆ’πŸŽ.πŸ“ π’›βˆ’πŸ
𝟏+𝟎.πŸ—π’›βˆ’πŸ
, to yield the same 𝑯(𝒛). Using the former π‘―πŸ (𝒛) and π‘―πŸ (𝒛), and using direct form
II realizations for the two cascaded sections, we get the following difference equations:
Section 1: (π‘―πŸ (𝒛) =
𝟎.πŸ“βˆ’πŸŽ.πŸ“ π’›βˆ’πŸ
𝟏+𝟎.πŸ’ π’›βˆ’πŸ
)
π’˜πŸ (𝒏) = 𝒙(𝒏) βˆ’ 𝟎. πŸ’ π’˜(𝒏 βˆ’ 𝟏)
π’šπŸ (𝒏) = 𝟎. πŸ“ π’˜πŸ (𝒏) βˆ’ 𝟎. πŸ“ π’˜πŸ (𝒏 βˆ’ 𝟏)
𝟏+π’›βˆ’πŸ
Section 2: (π‘―πŸ (𝒛) = 𝟏+𝟎.πŸ—π’›βˆ’πŸ )
π’˜πŸ (𝒏) = π’šπŸ (𝒏) βˆ’ 𝟎. πŸ— π’˜πŸ (𝒏 βˆ’ 𝟏)
π’š(𝒏) = π’˜πŸ (𝒏) + π’˜πŸ (𝒏 βˆ’ 𝟏)
Part (3): For the parallel realization, the transfer function is written in the partial fraction’s
form. The given transfer function is
𝑯(𝒛) =
𝟎. πŸ“(𝟏 βˆ’ π’›βˆ’πŸ )
𝟏 + 𝟏. πŸ‘ π’›βˆ’πŸ + 𝟎. πŸ‘πŸ” π’›βˆ’πŸ
Multiplying the numerator and denominator with π’›πŸ we get
𝑯(𝒛) =
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
π’›πŸ + 𝟏. πŸ‘ 𝒛 + 𝟎. πŸ‘πŸ”
The denominator polynomial can be factorized as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
𝑨(𝒛) = π’›πŸ + 𝟏. πŸ‘ 𝒛 + 𝟎. πŸ‘πŸ” = π’›πŸ + 𝟎. πŸ’ 𝒛 + 𝟎. πŸ— 𝒛 + 𝟎. πŸ‘πŸ”
= 𝟏(𝒛 + 𝟎. πŸ’ ) + 𝟎. πŸ— 𝒛 (𝒛 + 𝟎. πŸ’ ) = (𝒛 + 𝟎. πŸ’)(𝒛 + 𝟎. πŸ—)
Therefore, the transfer function can be written as
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝑯(𝒛) =
(𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—)
Or
𝑯(𝒛)
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
=
𝒛
𝒛(𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—)
Writing it into partial fractions form,
𝑯(𝒛) 𝑨
𝑩
π‘ͺ
= +
+
𝒛
𝒛 (𝒛 + 𝟎. πŸ’ ) (𝒛 + 𝟎. πŸ—)
where
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝑨 = 𝒛(
)|
=
|
= βˆ’πŸ. πŸ‘πŸ—
𝒛(𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—) 𝒛=𝟎 (𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—) 𝒛=𝟎
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
(𝒛
)
𝑩 = + 𝟎. πŸ’ (
)|
=
|
= βˆ’πŸ. 𝟏
𝒛(𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—) 𝒛=βˆ’πŸŽ.πŸ’
𝒛(𝒛 + 𝟎. πŸ—) 𝒛=βˆ’πŸŽ.πŸ’
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝟎. πŸ“(π’›πŸ βˆ’ 𝟏)
𝒄 = (𝒛 + 𝟎. πŸ— ) (
)|
=
|
= 𝟎. 𝟐𝟏
𝒛(𝒛 + 𝟎. πŸ’ )(𝒛 + 𝟎. πŸ—) 𝒛=βˆ’πŸŽ.πŸ—
𝒛(𝒛 + 𝟎. πŸ’) 𝒛=βˆ’πŸŽ.πŸ—
Therefore,
𝑯(𝒛) βˆ’πŸ. πŸ‘πŸ—
βˆ’πŸ. 𝟏
𝟎. 𝟐𝟏
=
+
+
(𝒛 + 𝟎. πŸ’ ) (𝒛 + 𝟎. πŸ—)
𝒛
𝒛
Or
𝑯(𝒛) = βˆ’πŸ. πŸ‘πŸ— βˆ’
𝟐. πŸπ’›
𝟎. πŸπŸπ’›
+
(𝒛 + 𝟎. πŸ’ ) (𝒛 + 𝟎. πŸ—)
In delay form it can be written as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
𝑯(𝒛) = βˆ’πŸ. πŸ‘πŸ— βˆ’
𝟐. 𝟏
𝟎. 𝟐𝟏
+
(𝟏 + 𝟎. πŸ’ π’›βˆ’πŸ ) (𝟏 + 𝟎. πŸ— π’›βˆ’πŸ )
This can be written as
𝑯(𝒛) = π‘―πŸ (𝒛) + π‘―πŸ (𝒛) + π‘―πŸ‘ (𝒛)
This shows that for this filter, there are three sections in the parallel realization. They can be
individually realized using either direct form I or direct form II realizations. We use direct
form II realization. The difference equations for each of three parallel sections are
Section 1: (π‘―πŸ (𝒛) = βˆ’πŸ. πŸ‘πŸ—)
π’šπŸ (𝒏) = βˆ’πŸ. πŸ‘πŸ— 𝒙(𝒏)
𝟐.𝟏
Section 2: (π‘―πŸ (𝒛) = βˆ’ (𝟏+𝟎.πŸ’ π’›βˆ’πŸ ))
π’˜πŸ (𝒏) = 𝒙(𝒏) βˆ’ 𝟎. πŸ’ π’˜πŸ (𝒏 βˆ’ 𝟏)
π’šπŸ (𝒏) = 𝟐. 𝟏 π’˜πŸ (𝒏)
𝟎.𝟐𝟏
Section 2: (π‘―πŸ‘ (𝒛) = (𝟏+𝟎.πŸ— π’›βˆ’πŸ ))
π’˜πŸ‘ (𝒏) = 𝒙(𝒏) βˆ’ 𝟎. πŸ— π’˜πŸ‘ (𝒏 βˆ’ 𝟏)
π’šπŸ‘ (𝒏) = βˆ’πŸŽ. 𝟐𝟏 π’˜πŸ‘ (𝒏)
The output is π’š(𝒏) = π’šπŸ (𝒏) + π’šπŸ (𝒏) + π’šπŸ‘ (𝒏) and the parallel realization is shown below in
the diagram.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Magnitude
frequency
response of a
normalized
lowpass filter.
Magnitude
frequency
response of a
normalized
highpass filter.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Magnitude
frequency
response of a
normalized
bandpass filter.
Magnitude
frequency
response of a
normalized
bandreject filter.
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
7. Finite Impulse Response (FIR) Filter Design
An FIR filter is completely specified by the following difference equation (input-output
relationship):
𝑴
π’š(𝒏) = π’ƒπŸŽ 𝒙(𝒏) + π’ƒπŸ 𝒙(𝒏 βˆ’ 𝟏) + β‹― + 𝒃𝑴 𝒙(𝒏 βˆ’ 𝑴) = βˆ‘ π’ƒπ’Š 𝒙(𝒏 βˆ’ π’Š)
(7.1)
π’Š=𝟎
The frequency response of an ideal lowpass filter is shown below in Figure (a).
𝒉(𝒏)
|𝑯(𝒆𝒋𝛀 )|
1
βˆ’πœ‹
βˆ’Ξ©π‘
0
Ω𝑐
πœ‹
(a) Ideal Lowpass Frequency Response
(b) Impulse Response of an Ideal Lowpass Filter
Mathematically it is given by
𝟏,
𝑯(𝒆𝒋𝛀 ) = {
𝟎,
𝟎 ≀ |𝛀| ≀ π›€πœ
π›€πœ ≀ |𝛀| ≀ 𝛑
The frequency π›€πœ is the lowpass cutoff frequency. It can be shown that, the corresponding
impulse response of the ideal lowpass filter is as shown in Figure (b) above. A truncated part
of the impulse response is shown (the actual response extends to infinity on both sides)
from 𝒏 = βˆ’π‘΄ to 𝒏 = 𝑴. It is given by
π›€πœ
,
𝒏=𝟎
𝛑
𝒉(𝒏) = {
sin(π›€πœ 𝐧)
π§β‰ πŸŽ
𝝅𝒏
The impulse response is symmetric about 𝒏 = 𝟎. It could further be shown that, in this case
the z-transform of the impulse response is given by
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
𝑯(𝒛) = 𝒉(𝑴)𝒛𝑴 + 𝒉(𝑴 βˆ’ 𝟏)π’›π‘΄βˆ’πŸ + β‹― + 𝒉(𝟏)π’›πŸ + 𝒉(𝟎) + 𝒉(𝟏)π’›βˆ’πŸ
+ β‹― 𝒉(𝑴 βˆ’ 𝟏)π’›βˆ’π‘΄+𝟏 + 𝒉(𝑴)π’›βˆ’π‘΄
To obtain a causal impulse response, we shift (delay) the non-causal impulse response by M
samples, to yield the transfer function of a causal ideal lowpass FIR filter:
𝑯(𝒛) = π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + π’ƒπŸ π’›βˆ’πŸ + β‹― + π’ƒπŸπ‘΄ π’›βˆ’πŸπ‘΄
where, 𝒃𝒏 = 𝒉(𝒏 βˆ’ 𝑴) for 𝒏 = 𝟎, 𝟏, 𝟐, β‹― , πŸπ‘΄.
Similarly, we can obtain the design equations for the other types of FIR filters, such as
highpass, bandpass and bandstop. Table 7.1 gives the formulas for these FIR filters for their
filter coefficient calculations.
Table 7.1: Summary of ideal impulse responses for standard FIR filters
Filter Type
Ideal Impulse Response
𝒉(𝒏) (non-causal FIR coefficients)
π›€πœ
,
𝒏=𝟎
𝛑
𝒉(𝒏) = {
sin(π›€πœ 𝒏)
βˆ’π‘΄ ≀ 𝒏 ≀ 𝑴
𝝅𝒏
𝛑 βˆ’ π›€πœ
Highpass
,
𝒏=𝟎
𝛑
𝒉(𝒏) = {
sin(π›€πœ 𝐧)
βˆ’
βˆ’π‘΄ ≀ 𝒏 ≀ 𝑴
𝝅𝒏
𝛀𝑯 βˆ’ 𝛀𝑳
Bandpass
,
𝒏=𝟎
𝝅
𝒉(𝒏) = {
sin(𝛀𝑯 𝒏) sin(𝛀𝑳 𝒏)
βˆ’
βˆ’π‘΄ ≀ 𝒏 ≀ 𝑴
𝝅𝒏
𝝅𝒏
𝝅 βˆ’ 𝛀𝑯 + 𝛀𝑳
Bandstop
,
𝒏=𝟎
𝝅
𝒉(𝒏) = {
sin(𝛀𝑯 𝒏) sin(𝛀𝑳 𝒏)
βˆ’
+
βˆ’π‘΄ ≀ 𝒏 ≀ 𝑴
𝝅𝒏
𝝅𝒏
Causual FIR filter coefficients: shifting 𝒉(𝒏) to the right by samples.
Lowpass
Transfer Function:
𝑯(𝒛) = π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + π’ƒπŸ π’›βˆ’πŸ + β‹― + π’ƒπŸπ‘΄ π’›βˆ’πŸπ‘΄
Where 𝒃𝒏 = 𝒉(𝒏 βˆ’ 𝑴) for 𝒏 = 𝟎, 𝟏, 𝟐, β‹― , 𝟐
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Example 7.2
(a) Calculate the filter coefficients for a 3-tap FIR lowpass filter with a cutoff frequency of
800 Hz and a sampling rate of 8000 Hz using the Fourier Transform method.
(b) Determine the transfer function and difference equation of the designed FIR system.
(c) Compute and plot the frequency response.
Solution
Part (a): We first determine the normalized cutoff frequency
πŸ–πŸŽπŸŽ
𝛀𝒄 = πŸπ… 𝒇𝒄 𝑻𝒔 = πŸπ… × πŸ–πŸŽπŸŽπŸŽ = 𝟎. πŸπ… radians
In this case πŸπ‘΄ + 𝟏 = πŸ‘, therefore, using table 7.1
π›€πœ
,
𝒏=𝟎
𝛑
𝒉(𝒏) = {
sin(π›€πœ 𝒏)
βˆ’π‘΄ ≀ 𝒏 ≀ 𝑴
𝝅𝒏
Therefore
𝒉(𝟎) =
π›€πœ 𝟎. πŸπ…
=
= 𝟎. 𝟐
𝝅
𝝅
𝒉(𝟏) =
sin(π›€πœ ) sin(𝟎. πŸπ…)
=
= 𝟎. πŸπŸ–πŸ•πŸ
𝝅
𝝅
Using symmetry, 𝒉(βˆ’πŸ) = 𝒉(𝟏) = 𝟎. πŸπŸ–πŸ•πŸ
Delaying 𝒉(𝒏) by 𝑴 = 𝟏 samples, we get
π’ƒπŸŽ = 𝒉(𝟎 βˆ’ 𝟏) = 𝒉(βˆ’πŸ) = 𝟎. πŸπŸ–πŸ•πŸ
π’ƒπŸ = 𝒉(𝟏 βˆ’ 𝟏) = 𝒉(𝟎) = 𝟎. 𝟐
Filter
Coefficients
π’ƒπŸ = 𝒉(𝟏 βˆ’ 𝟏) = 𝒉(𝟏) = 𝟎. πŸπŸ–πŸ•πŸ
Part (b): Therefore, the transfer function in this case is
𝑯(𝒛) = π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + π’ƒπŸ π’›βˆ’πŸ = 𝟎. πŸπŸ–πŸ•πŸ + 𝟎. πŸπ’›βˆ’πŸ + 𝟎. πŸπŸ–πŸ•πŸπ’›βˆ’πŸ
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
The difference equation is
π’š(𝒏) = 𝟎. πŸπŸ–πŸ•πŸπ’™(𝒏) + 𝟎. πŸπ’™(𝒏 βˆ’ 𝟏) + 𝟎. πŸπŸ–πŸ•πŸπ’™(𝒏 βˆ’ 𝟐)
Part (c): The frequency response of the filter is
𝑯(𝒆𝒋𝛀 ) = 𝟎. πŸπŸ–πŸ•πŸ + 𝟎. πŸπ’†βˆ’π’‹π›€ + 𝟎. πŸπŸ–πŸ•πŸπ’†βˆ’πŸπ’‹π›€
It can be written as
𝑯(𝒆𝒋𝛀 ) = π’†βˆ’π’‹π›€ (𝟎. πŸπŸ–πŸ•πŸπ’†π’‹π›€ + 𝟎. 𝟐 + 𝟎. πŸπŸ–πŸ•πŸπ’†βˆ’πŸπ’‹π›€ ) = π’†βˆ’π’‹π›€ (𝟎. 𝟐 + 𝟎. πŸπŸ–πŸ•πŸ(𝒆𝒋𝛀 + π’†βˆ’πŸπ’‹π›€ ))
= π’†βˆ’π’‹π›€ (𝟎. 𝟐 + 𝟎. πŸπŸ–πŸ•πŸ × πŸcos(𝛀)) = π’†βˆ’π’‹π›€ (𝟎. 𝟐 + 𝟎. πŸ‘πŸ•πŸ’πŸcos(𝛀))
Thus, the magnitude frequency response is
|𝑯(𝒆𝒋𝛀 )| = 𝟎. 𝟐 + 𝟎. πŸ‘πŸ•πŸ’πŸcos(𝛀)
And the phase response is
Phase response(degrees)
Magnitude response(dB)
βˆ π‘―(𝒆𝒋𝛀 ) = {
βˆ’π›€,
βˆ’π›€ + 𝝅
𝟎. 𝟐 + 𝟎. πŸ‘πŸ•πŸ’πŸcos(𝛀) > 0
𝟎. 𝟐 + 𝟎. πŸ‘πŸ•πŸ’πŸcos(𝛀) < 0
0
-20
-40
-60
0
500
1000
1500
2000
2500
Frequency (Hz)
3000
3500
4000
0
500
1000
1500
2000
2500
Frequency (Hz)
3000
3500
4000
100
50
0
-50
-100
-150
Figure 7.4: Frequency response in Example 7.2
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
In FIR filters with symmetrical coefficients, the phase response has a linear behavior in the
passband.
This means that all frequency components of the filter input within the passband are
subjected to the same amount of time delay at the filter output. This is a requirement
of applications in audio and speech filtering, where phase distortions needs to be
avoided.
If the design method cannot produce the symmetrical coefficients, then the resultant
FIR filter does not have linear phase property leading to distortions in the filtered
signal. This distortion due to nonlinear phase is shown with the example below.
𝒙(𝒏) = π’™πŸ (𝒏) + π’™πŸ (𝒏) = sin(𝟎. πŸŽπŸ“π…π’) 𝒖(𝒏) + sin(𝟎. πŸπŸ“π…π’) 𝒖(𝒏)
π’šπŸ (𝒏) = sin(𝟎. πŸŽπŸ“π…(𝒏 βˆ’ πŸ–)) + sin(𝟎. πŸπŸ“π…(𝒏 βˆ’ πŸ–))
Linear Phase
π’šπŸ (𝒏) = sin(𝟎. πŸŽπŸ“π…π’ βˆ’ 𝝅/𝟐) + sin(𝟎. πŸπŸ“π…π’ βˆ’ 𝝅/𝟐))
Non-Linear Phase
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
The FIR filter has a good phase property, but it does not give an acceptable magnitude
frequency response. The result with an 17-tap lowpass filter is also shown below.
There are oscillations (ripple) in the passband (main lobe) and stopband (side lobe) of
the magnitude frequency response. This is due to Gibbs oscillations, originating from
the abrupt truncation of the infinite impulse response of the lowpass filter.
Phase response(degrees)
Magnitude response(dB)
This behavior can be avoided with the help of windowing.
20
0
-20
-40
-60
-80
0
500
1000
1500
2000
2500
Frequency (Hz)
3000
3500
4000
4500
0
500
1000
1500
2000
2500
Frequency (Hz)
3000
3500
4000
4500
200
0
-200
-400
-600
Figure 7.5: Magnitude and Phase Frequency responses of the ideal lowpass FIR filters
with 3-coefficients (dashed lines) and 17 coefficients (solid lines)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Example 7.2
(a) Calculate the filter coefficients for a 5-tap FIR bandpass filter with a lower cutoff
frequency of 2000 Hz and an upper cutoff frequency of 2400 at a sampling rate of 8000
Hz.
(b) Determine the transfer function and plot the frequency responses with MATLAB.
Solution
Part (a): We first determine the normalized cutoff frequencies
Ω𝑳 =
Ω𝑯 =
πŸπ…π’‡π‘³
𝒇𝒔
πŸπ…π’‡π‘―
𝒇𝒔
𝟐𝟎𝟎𝟎
= πŸπ… × πŸ–πŸŽπŸŽπŸŽ = 𝟎. πŸ“π… radians
πŸπŸ’πŸŽπŸŽ
= πŸπ… × πŸ–πŸŽπŸŽπŸŽ = 𝟎. πŸ”π… radians
In this case πŸπ‘΄ + 𝟏 = πŸ“, therefore, from Table7.1
𝛀𝑯 βˆ’ 𝛀𝑳
,
𝒏=𝟎
𝝅
𝒉(𝒏) = {
𝐬𝐒𝐧(𝛀𝑯 𝒏) 𝐬𝐒𝐧(𝛀𝑳 𝒏)
βˆ’
, βˆ’πŸ ≀ 𝒏 ≀ 𝟐
𝒏𝝅
𝒏𝝅
The non-causal FIR coefficients are
𝒉(𝟎) =
𝛀𝑯 βˆ’ 𝛀𝑳 𝟎. πŸ”π… βˆ’ 𝟎. πŸ“π…
=
= 𝟎. 𝟏
𝝅
𝝅
𝒉(𝟏) =
𝐬𝐒𝐧(𝛀𝑯 × πŸ) 𝐬𝐒𝐧(𝛀𝑳 × πŸ) 𝐬𝐒𝐧(𝟎. πŸ”π…) 𝐬𝐒𝐧(𝟎. πŸ“π…)
βˆ’
=
βˆ’
= βˆ’πŸŽ. πŸŽπŸπŸ“πŸ“πŸ–
𝝅×𝟏
𝝅×𝟏
𝝅
𝝅
𝒉(𝟐) =
𝐬𝐒𝐧(𝛀𝑯 × πŸ) 𝐬𝐒𝐧(𝛀𝑳 × πŸ) 𝐬𝐒𝐧(𝟏. πŸπ…) 𝐬𝐒𝐧(𝟏. πŸŽπ…)
βˆ’
=
βˆ’
= βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“
𝝅×𝟐
𝝅×𝟐
πŸπ…
πŸπ…
Using the symmetry property
𝒉(βˆ’πŸ) = 𝒉(𝟏) = βˆ’πŸŽ. πŸŽπŸπŸ“πŸ“πŸ–
𝒉(βˆ’πŸ) = 𝒉(𝟐) = βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“
Thus the filter coefficients are obtained by delaying by 𝑴 = 𝟐 samples, as
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
π’ƒπŸŽ = 𝒉(𝟎 βˆ’ 𝟐) = 𝒉(βˆ’πŸ) = βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“
π’ƒπŸ = 𝒉(𝟏 βˆ’ 𝟐) = 𝒉(βˆ’πŸ) = βˆ’πŸŽ. πŸŽπŸπŸ“πŸ“πŸ–
π’ƒπŸ = 𝒉(𝟐 βˆ’ 𝟐) = 𝒉(𝟎) = 𝟎. 𝟏
Filter
Coefficients
π’ƒπŸ‘ = 𝒉(πŸ‘ βˆ’ 𝟐) = 𝒉(𝟏) = βˆ’πŸŽ. πŸŽπŸπŸ“πŸ“πŸ–
π’ƒπŸ’ = 𝒉(πŸ’ βˆ’ 𝟐) = 𝒉(𝟐) = βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“
Part (b): Therefore, the transfer function in this case is
𝑯(𝒛) = π’ƒπŸŽ + π’ƒπŸ π’›βˆ’πŸ + π’ƒπŸ π’›βˆ’πŸ + π’ƒπŸ‘ π’›βˆ’πŸ‘ + π’ƒπŸ’ π’›βˆ’πŸ’
= βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“ βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– π’›βˆ’πŸ + 𝟎. πŸπ’›βˆ’πŸ βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ–π’›βˆ’πŸ‘ βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ π’›βˆ’πŸ’
The difference equation is
π’š(𝒏) = βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“ 𝒙(𝒏) βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– 𝒙(𝒏 βˆ’ 𝟏) + 𝟎. 𝟏 𝒙(𝒏 βˆ’ 𝟐) βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– 𝒙(𝒏 βˆ’ πŸ‘)
βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ 𝒙(𝒏 βˆ’ πŸ’)
Part (c): The frequency response of the filter is
𝑯(𝒆𝒋𝛀 ) = βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“ βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– π’†βˆ’π’‹π›€ + 𝟎. 𝟏 π’†βˆ’πŸπ’‹π›€ βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– π’†βˆ’πŸ‘π’‹π›€
βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ π’†βˆ’πŸ’π’‹π›€
It can be written as
𝑯(𝒆𝒋𝛀 ) = π’†βˆ’πŸπ’‹π›€ (βˆ’πŸŽ. πŸŽπŸ—πŸ‘πŸ“πŸ“ π’†πŸπ’‹π›€ βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– 𝒆𝒋𝛀 + 𝟎. 𝟏 βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– π’†βˆ’π’‹π›€
βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ π’†βˆ’πŸπ’‹π›€ )
= π’†βˆ’πŸπ’‹π›€ (𝟎. 𝟏 βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– (𝒆𝒋𝛀 + π’†βˆ’π’‹π›€ ) βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ (π’†πŸπ’‹π›€ + π’†βˆ’πŸπ’‹π›€ ))
= π’†βˆ’πŸπ’‹π›€ (𝟎. 𝟏 βˆ’ 𝟎. πŸŽπŸπŸ“πŸ“πŸ– (𝟐𝐜𝐨𝐬(𝛀)) βˆ’ 𝟎. πŸŽπŸ—πŸ‘πŸ“πŸ“ (𝟐𝐜𝐨𝐬(πŸπ›€)))
= π’†βˆ’πŸπ’‹π›€ (𝟎. 𝟏 βˆ’ 𝟎. πŸŽπŸ‘πŸπŸπŸ” 𝐜𝐨𝐬(𝛀) βˆ’ 𝟎. πŸπŸ–πŸ•πŸ 𝐜𝐨𝐬(πŸπ›€))
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Thus, the magnitude frequency response is and the phase response are computed by the
MATLAB program shown below and are the plots are shown in the figure below.
Phase response(degrees)
Magnitude response(dB)
[response, w] = freqz([-0.09355 -0.01558 0.1 -0.01558 -0.09355], ...
[1], 512);
magnitude = abs(response);
magnitude2 = 20*log10(magnitude);
phase2 = 180*unwrap(angle(response))/pi;
figure,
subplot(2,1,1); plot(w, magnitude2,'LineWidth',2); grid on;
xlabel('Frequency (rad)');
ylabel('Magnitude response(dB)');
subplot(2,1,2); plot(w, phase2,'LineWidth',2); grid on;
xlabel('Frequency (rad)');
ylabel('Phase response(degrees)');
0
-20
-40
-60
-80
0
0.5
1
1.5
2
Frequency (rad)
2.5
3
3.5
0
0.5
1
1.5
2
Frequency (rad)
2.5
3
3.5
300
200
100
0
Figure 7.8: Magnitude and Phase Frequency responses of the ideal bandpass FIR filters with 5coefficients (Example 7.3)
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing
by Dr. Anwar M. Mirza
Lecture No. 21
Date: December, 2012
Department of Computer Engineering
College of Computer & Information Sciences, King Saud University
Ar Riyadh, Kingdom of Saudi Arabia