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

DESIGN OF DIGITAL FILTERS

Contents:
 General considerations
o Causality and its Implications
o Characteristics of Practical Frequency-Selective Filters
 Design of fir filters
o Symmetric and Antisymmetric Filters
o Design of Linear-Phase FIR Filters using Windows
o Design of Linear-Phase FIR Filters by the Frequency-Sampling Method
o Design of Optimum Equiripple Linear-Phase FIR Filters
o Design of FIR Differentiators
o Design of Hilbert Transformers
o Comparison of Design Methods for Linear-Phase FIR Filters
2
Contents:
 Design of IIR filters from analog filters
o IIR Filter Design by Approximation of Derivatives
o IIR Filter Design by Impulse Invariance
o IIR Filter Design by the Bilinear Transformation
o Characteristics of Commonly Used Analog Filters
o Some Examples of Digital Filter Designs Based on the Bilinear
Transformation
 Frequency transformations
o Frequency Transformations in the Analog Domain
o Frequency Transformations in the Digital Domain

3
Introduction :
o With the background that we have developed in the
preceding chapters, we are now in a position to treat the
subject of digital filter design.
o We shall describe several methods for designing FIR and
IIR digital filters.
o In the design of frequency-selective filters, the desired filter
characteristics are specified in the frequency domain in
terms of the desired magnitude and phase response of the
filter.
4
Introduction :
o In the filter design process, we determine the coefficients
of a causal FIR or IIR filter that closely approximates
the desired frequency response specifications.
o The issue of which type of filter to design, FIR or IIR,
depends on the NATURE OF THE PROBLEM and on
the SPECIFICATIONS OF THE DESIRED
FREQUENCY RESPONSE.
o In practice, FIR filters are employed in filtering problems
where there is a requirement for a linear-phase
characteristic within the passband of the filter. 5
Introduction :
o If there is no requirement for a linear-phase characteristic,
either an IIR or an FIR filter may be employed.
o However, as a general rule, an IIR filter has lower side-
lobes in the stopband than an FIR filter having the same
number of parameters.
o For this reason, if some phase distortion is either tolerable or
unimportant, an IIR filter is preferable, primarily because
its implementation involves fewer parameters, requires less
memory and has lower computational complexity.
6
Introduction :
oIn conjunction with our discussion of digital filter
design, we describe frequency transformations in
both the analog and digital domains for transforming a
lowpass prototype filter into:
 Another lowpass,
 Bandpass,
 Bandstop, or
 Highpass filter.
7
Introduction :
oToday, FIR and IIR digital filter design is greatly
facilitated by the availability of numerous computer
software programs.
oIn describing the various digital filter design methods
in this chapter, our primary objective is to give the
reader the background necessary to select the
filter that best matches the application
and satisfies the design requirements.
8
§10.1 General Considerations

9
General Considerations :

Figure 5.4.1: Magnitude response for some ideal frequency-selective DT filters.


10
General Considerations :
o In Section 5.4, we described the characteristics of ideal
filters and demonstrated that such filters are NOT
CAUSAL and therefore are NOT PHYSICALLY
REALIZABLE.
o In this section, the issue of causality and its implications
is considered in more detail.
o Following this discussion, we present the frequency
response characteristics of CAUSAL FIR and IIR
digital filters.
11
§10.1.1 Causality and Its Implications

12
Causality & Its Implications :

13
Causality & Its Implications :

𝜋
ℎ(𝑛) with 𝜔𝑐 =
4

14
RECALL :

15
Causality & Its Implications :

ℎ 𝑛 − 𝑛0 × 𝑢(𝑛)  Causal & IIR Filter


ℎ 𝑛 − 𝑛0 × 𝑤(𝑛)  Causal & FIR Filter
16
Causality & Its Implications :

Ideal BPF Vs
Practical BPF

17
Causality & Its Implications :

18
Causality & Its Implications :

19
Causality & Its Implications :

20
Causality & Its Implications :
fun = @(x) (x.^2).^(-1/3);
plot([-2:0.01:2],fun([-2:0.01:2]));
grid;
fun(0)
q = integral(fun,-1,1)

An improper integral is a definite integral that has either


or both limits infinite or an integrand that
approaches infinity at one or more points in the range of
integration. Improper integrals cannot be computed using
a normal Riemann integral.
http://mathworld.wolfram.com/ImproperIntegral.html

21
Causality & Its Implications :
One important conclusion we draw from the Paley-Wiener theorem is
that:

the magnitude response |𝑯 𝒆𝒋𝝎 | of a stable


and causal system CANNOT BE ZERO OVER ANY FINITE BAND OF
FREQUENCIES (can ONLY be zero at some frequencies) because, in
this case,
the integral becomes infinite.
Hence, any stable ideal frequency-selective filter must be
non-causal.
22
Causality & Its Implications :
Another important conclusion that we draw
from the Paley-Wiener theorem is :

Therefore, given the magnitude


𝒋𝝎
response |𝑯 𝒆 | of a causal and stable
system, we cannot assign its phase
response arbitrarily. 23
Causality & Its Implications :

24
Causality & Its Implications :

25
Causality & Its Implications :
EXAMPLE:
Consider a causal signal: ℎ 𝑛 = [ 𝟏 2 3 4 5]
Its reflected version is ℎ −𝑛 = [5 4 3 2 𝟏]
Hence, ℎ𝑒 𝑛 = [2.5 2 1. 5 1 𝟏 1 1.5 2 2.5], and
ℎ𝑜 𝑛 = [−2.5 − 2 − 1. 5 − 1 𝟎 1 1.5 2 2.5],
In contrast to non-causal sequence (which require both even and odd parts),
this causal 𝒉[𝒏] can be uniquely defined BY ITS EVEN PARTS ONLY as:
𝒉 𝒏 = 𝟐𝒉𝒆 𝒏 𝒖 𝒏 − 𝒉𝒆 𝟎 𝜹 𝒏 = 2 2 3 4 5 − 1 0 0 0 0 = [1 2 3 4 5]
Alternatively, we can define ℎ 𝑛 from ℎ𝑜 𝑛 if we also know ℎ 0 because 𝒉𝒐 𝟎 = 𝟎
always.

There is a strong relationship between ℎ𝑜 𝑛 and ℎ𝑒 𝑛 . And


that relation is:
𝒉𝒐 𝒏 = 𝒉𝒆 𝒏 for 𝒏 ≥ 𝟏.
26
Causality & Its Implications :

27
Recall :

28
EX. 10.1.1

29
Causality & Its Implications :

30
Causality & Its Implications :

31
Causality & Its Implications :
1 1
ℎ 𝑛 = 𝑎𝑛 𝑢 𝑛 𝐻 𝑧 = 𝐻 𝜔 =
1−𝑎𝑧 −1 1−𝑎𝑒 −𝑗𝜔
Hence
1 1
𝐻 𝜔 = −𝑗𝜔
=
1 − 𝑎𝑒 1 − 𝑎{cos 𝜔 − 𝑗𝑠𝑖𝑛 𝜔 }
1 1 − 𝑎 cos 𝜔 − 𝑗𝑎𝑠𝑖𝑛 𝜔
= ×
{1 − 𝑎 cos 𝜔 } + 𝑗𝑎𝑠𝑖𝑛 𝜔 1 − 𝑎 cos 𝜔 − 𝑗𝑎𝑠𝑖𝑛 𝜔
1 − 𝑎 cos 𝜔 − 𝑗𝑎𝑠𝑖𝑛 𝜔 1 − 𝑎 cos 𝜔 − 𝑗𝑎𝑠𝑖𝑛 𝜔
= 2 2 2
=
1 − 𝑎 cos 𝜔 + a sin (𝜔) 1 + 𝑎2 − 2𝑎 cos 𝜔
1 − 𝑎 cos 𝜔 𝑎𝑠𝑖𝑛 𝜔
= 2
−𝑗
1 + 𝑎 − 2𝑎 cos 𝜔 1 + 𝑎2 − 2𝑎 cos 𝜔

1−𝑎 cos 𝜔 𝑎𝑠𝑖𝑛 𝜔
𝐻𝑅 𝜔 = ; and 𝐻𝐼 𝜔 = −
1+𝑎2 −2𝑎 cos 𝜔 1+𝑎2 −2𝑎 cos 𝜔
32
Causality & Its Implications :

Observe that for real ℎ(𝑛), 𝐻𝑅 (𝜔) is an even function of


𝜔 while 𝐻𝐼 (𝜔) is an odd function of 𝜔 (following
Hermitian or conjugate symmetry.)

33
Causality & Its Implications :

34
Causality & Its Implications :

35
Causality & Its Implications :

H_R_an2 = imag(hilbert(H_I_an)) + h0;


%
H_I_an2 = -imag(hilbert(H_R));
36
Causality & Its Implications :

37
Causality & Its Implications :

38
Recall :

39
§10.1.2 Characteristics of
Practical Frequency-Selective Filters

40
Characteristics of Practical Frequency-Selective Filters :

41
Characteristics of Practical Frequency-Selective Filters :

42
Tolerance Diagram
and
Filter Specifications
43
Characteristics of Practical Frequency-Selective Filters :
Transition BW: Δ𝜔 = 𝜔𝑠 − 𝜔𝑝
Filter BW: Δ𝜔 = 𝜔𝑝 − 0 = 𝜔𝑝

44
Characteristics of Practical Frequency-Selective Filters :

45
Characteristics of Practical Frequency-Selective Filters :

Figure: Specifying the


tolerance in the passband,
stopband, and transition band
for a practical LPF

46
Characteristics of Practical Frequency-Selective Filters :

47
Characteristics of Practical Frequency-Selective Filters :

The quantities 𝐴𝑝 and 𝐴𝑠 are


positive and, for a well
designed filter, typically 𝐴𝑝 ≈ 0
and 𝐴𝑠 ≫ 1. 48
Characteristics of Practical Frequency-Selective Filters :

49
Characteristics of Practical Frequency-Selective Filters :
By re-arranging the definitions of 𝐴𝑝 and 𝐴𝑠 , we get the
following Relative to Absolute Conversion formulas:

𝐴𝑝 /20
10 −1
𝛿𝑝 = 𝐴𝑝 /20
10 +1
and
1 + 𝛿𝑝
𝛿𝑠 = 𝐴 /20
10 𝑠
50
Characteristics of Practical Frequency-Selective Filters :

51
Characteristics of Practical Frequency-Selective Filters :

clearvars; clc; close all;


% Given Relative Specifications
wp = 0.3*pi;
ws = 0.5*pi;
Ap = 0.5;
As = 40;
% Relative to Absolute CONVERSION
deltap = (10^(Ap/20)-1)/(10^(Ap/20)+1)
deltas = (1+deltap)/(10^(As/20))

deltap = 0.0288

deltas = 0.0103
52
Characteristics of Practical Frequency-Selective Filters :

clearvars; clc; close all;


% Given Relative Specifications
Ap = 0.25; As = 50;
% Relative to Absolute CONVERSION
deltap = (10^(Ap/20)-1)/(10^(Ap/20)+1)
deltas = (1+deltap)/(10^(As/20)) 53
Characteristics of Practical Frequency-Selective Filters :

clearvars; clc; close all;


% Given Absolute Specifications
delta_p = 0.01; delta_s = 0.001;
% Absolute to Relative CONVERSION
A_p = 20*log10((1+delta_p)/(1-delta_p))
A_s = 20*log10((1+delta_p)/(delta_s)) 54
Characteristics of Practical Frequency-Selective Filters :

55
§10.2 Design of FIR Filters

56
Design of FIR Filters :

In this section we describe several


methods for designing FIR filters.
Our treatment is focused on the
important class of linear-phase FIR
filters.

57
§10.2.1 Symmetric and
Anti-Symmetric FIR Filters

58
Symmetric and Anti-Symmetric FIR : 𝑀 = Length of FIR Filter
= Length of its [𝑛]

59
Symmetric and Anti-Symmetric FIR :

Recall: FIR Filters are All-ZERO Systems.


60
Symmetric and Anti-Symmetric FIR :

𝑀−1
Center of Symmetry is at 𝑛 = 2
𝑀−1
𝑛=
2
is integer for M=Odd (middle
sample) i.e., for Type I and Type III
𝑀−1
𝑛=
2
is integer+0.5 for M=Even
(middle of two center samples) i.e., for
Type II and Type IV
𝑀−1
𝑀 =9 =4
2
𝑀−1
𝑀 =8 = 3.5
2

61
Symmetric and Anti-Symmetric FIR :

TYPE-I LP FIR FILTER 𝑀 = Odd & ℎ[𝑛] Symmetric


TYPE-II LP FIR FILTER 𝑀 = Even & ℎ[𝑛] Symmetric
TYPE-III LP FIR FILTER 𝑀 = Odd & ℎ[𝑛] Anti-symmetric
TYPE-IV LP FIR FILTER 𝑀 = Even & ℎ[𝑛] Anti-symmetric

62
Symmetric and Anti-Symmetric FIR :

middle sample 63
Symmetric and Anti-Symmetric FIR :

64
Symmetric and Anti-Symmetric FIR :

65
Symmetric and Anti-Symmetric FIR :

Example:
ℎ 𝑛 = 3, 2, 0, −2, −3 ;
𝐻 𝑧 = 3𝑧 −0 + 2𝑧 −1 + 0𝑧 −2 − 2𝑧 −3 − 3𝑧 −4
𝐻 𝑧 −1 = 3𝑧 +0 + 2𝑧 +1 + 0𝑧 +2 − 2𝑧 +3 − 3𝑧 +4
𝒛−𝟒 × 𝑯 𝒛−𝟏 = 3𝑧 −4 + 2𝑧 −3 + 0𝑧 −2 − 2𝑧 −1 − 3𝑧 +0 = −𝑯(𝒛)

h = [3 2 0 -2 -3];
ans = ans =
% Type-III LP FIR Filter
1.0000 + 0.0000i 1.0000 + 0.0000i
b1 = h;
-0.3333 + 0.9428i -0.3333 + 0.9428i
b2 = -fliplr(b1);
-0.3333 - 0.9428i -0.3333 - 0.9428i
roots(b1)
-1.0000 + 0.0000i -1.0000 + 0.0000i 66
roots(b2)
Symmetric and Anti-Symmetric FIR :

67
Symmetric and Anti-Symmetric FIR :

68
Symmetric and Anti-Symmetric FIR :

69
Symmetric and Anti-Symmetric FIR :

70
Symmetric and Anti-Symmetric FIR :

71
Symmetric and Anti-Symmetric FIR :

72
Symmetric and Anti-Symmetric FIR :

73
Symmetric and Anti-Symmetric FIR :

74
Symmetric and Anti-Symmetric FIR :

𝑀+1
TYPE-I LP FIR FILTER 𝑀 = Odd & ℎ[𝑛] Symmetric coefficients
2
𝑀
TYPE-II LP FIR FILTER 𝑀 = Even & ℎ[𝑛] Symmetric coefficients
2
𝑀−1
TYPE-III LP FIR FILTER 𝑀 = Odd & ℎ[𝑛] Anti-symmetric coefficients
2
𝑀
TYPE-IV LP FIR FILTER 𝑀 = Even & ℎ[𝑛] Anti-symmetric coefficients
2 75
Symmetric and Anti-Symmetric FIR :

76
Symmetric and Anti-Symmetric FIR :

77
Symmetric and Anti-Symmetric FIR :

78
Symmetric and Anti-Symmetric FIR :

79
IIR Vs FIR Vs L-P FIR

80
Symmetric and Anti-Symmetric FIR :

81
Symmetric and Anti-Symmetric FIR :

Filter Filter Type


 IIR Filter
 IIR Filter
 FIR Filter with Non-linear phase
 FIR Filter with Non-linear phase
 FIR Filter with Linear phase
 FIR Filter with Non-linear phase
82
Symmetric and Anti-Symmetric FIR :
Filter Filter Type
 IIR Filter ∵ 𝒉 𝒏 is of infinite duration
 IIR Filter ∵ there are poles in 𝑯(𝒛)
FIR Filter ∵ 𝒉 𝒏 is of finite duration;

Non-linear phase ∵ 𝒉 𝒏 doesn’t possess any symmetry
FIR Filter ∵ 𝒉 𝒏 is of finite duration;

Non-linear phase ∵ 𝒉 𝒏 doesn’t possess any symmetry
FIR Filter ∵ only Zeros in pole-zero plot;

Linear phase ∵ Zeros occur in a group of fours
FIR Filter ∵ only Zeros in pole-zero plot;
 Non-linear phase ∵ Zeros are NOT in conjugate + reciprocal
group form (group of fours) 83
§10.2.2 Design of Linear-
Phase FIR filters Using Windows

84
DISCLAIMER
85
These power point slides are NOT
SUBSTITUTE of reading TEXT
BOOK(S).
You’re ALWAYS DIRECTED to
CAREFULLY READ the relevant
book chapter and SOLVE ALL
Examples and End Problems.
86
REFERENCES :
[1] [Proakis-2007] DSP 4th Ed

[2] [Proakis-2007] DSP 4th Ed


(CH 11: Solved Examples and MATLAB Solutions)

[3 [Proakis-2004] A Self-Study Guide for DSP


[4 [Inge-2017] Digital Signal Processing Using Matlab - A Problem Solving Companion
(4th Ed)

[5] [Kronenburger-2008] Analog and Digital Signal Processing

[6] [Manolakis-2011] Applied Digital Signal Processing

[7] [Sierra-2017] Digital Signal Processing with Matlab Examples, Volume 1

87

You might also like