0% found this document useful (0 votes)
20 views88 pages

SignalProcessing - SS2023 Part - 7-digitalFIR-IIR

This section discusses digital filters and their basics. It introduces four common filter types - lowpass, highpass, bandpass and bandstop - and explains that ideal filters cannot be physically realized due to requiring infinite length. It then covers the design of finite impulse response (FIR) and infinite impulse response (IIR) digital filters, including specifying cutoff frequencies, ripple levels, transfer functions, difference equations and block diagrams. The key goal of digital filter design is to define the filter coefficients to achieve a desired frequency response while meeting specifications like passband ripple and stopband rejection levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views88 pages

SignalProcessing - SS2023 Part - 7-digitalFIR-IIR

This section discusses digital filters and their basics. It introduces four common filter types - lowpass, highpass, bandpass and bandstop - and explains that ideal filters cannot be physically realized due to requiring infinite length. It then covers the design of finite impulse response (FIR) and infinite impulse response (IIR) digital filters, including specifying cutoff frequencies, ripple levels, transfer functions, difference equations and block diagrams. The key goal of digital filter design is to define the filter coefficients to achieve a desired frequency response while meeting specifications like passband ripple and stopband rejection levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

Content

1. Introduction
2. Characteristics of signals
3. Analog signals in frequency domain
4. Analog LTI systems
5. Sampling theorem and reconstruction
6. Discrete time signals in frequency domain
7. Discrete time LTI systems
8. Digital filters
9. Correlation
10. Advanced topics

377
Content - Digital filters

8.1 Basics

8.2 Characteristics of FIR filters

8.3 Design of FIR filters

8.4 Characteristics of IIR filters

8.5 Design of IIR filters

378
8.1 Basics

§ The theory of digital filters has been known since the early 1970s, however, only since the appearance of
DSPs in the 1980s, digital filters have become as popular as traditional LC and active RC filters.

§ Stable and causal LTI systems, which can be described by rational transfer functions with real coefficients,
play the most important role à linear digital filters.

§ In principle, all digital systems are filters.

§ Usually, one understands a filter as a system, which:


- Changes certain frequency components in comparison to others, for example by suppressing it,
amplifying it or by phase shifting it.
- Differentiates or integrates
- Calculates the Hilbert transform

379
8.1 Basics
§ Real-time system for digital filtering:

digital
filter

- TP1 (analog): Anti-aliasing filter used for band limiting to fulfill the sampling theorem.
- TP2 (analog): reconstruction filter (smoothing filter)

380
8.1 Digital filters – 4 basic filter types
Low-pass filter High-pass filter
h(ej5) h(ej5)

Q Q
−5( 0 5( −5( 0 5(

Bandpass filter Band-stop filter


h(ej5) h(ej5)

Ω Ω
−5($ −5(%
0 5(% 5($ −5($ −5(% 0 5(% 5($

These filter types can not be realized because:


§ They would need an infinitely long time domain for the vertical edges.
§ The frequency response cannot extend to infinite frequencies.

381
8.1 Digital filters – Design of FIR filters

§ Filters with rectangular-shaped amplitude responses have an infinitely high order and, thus, can not be realized.
§ In practice, one defines a tolerance scheme, in which the amplitude response of the filter is allowed.
§ The maximum feasible deviations Q9 and Q% of the ideal amplitude response are called ripples within the
pass band and side lobes in the stop band.
§ The bands, which are defined by the frequency specifications, are called pass band, transition range and
stop band. The corresponding cutoff frequencies are called pass band and stop band frequencies.

§ Usually, only the frequency domain from 0 to :4 /2 (respectively from 0 to 5) is displayed,


because after this point, the frequency response is repeated.

§ The choice of the tolerance schema is a typical engineering task and depends on the application of the filter.
§ In general, the order and, thus, the complexity of the filter increases, the smaller the tolerance scheme is
chosen. For a given application, the tolerance scheme should be chosen as relaxed as possible.

382
8.1 Basics
§ Filter types, which can be realized (this time only the positive frequency region is displayed):
Low-pass High-pass
filter filter

Bandpass Band-stop
filter filter

383
8.1 Digital filters – Filter specifications
|ñ e$H | Example for low-pass specification:
§ In the pass band 0 ≤ ; ≤ ;6Rññ, we require ñ e$H ≈1
with a maximum allowed deviation of ±Q6 , i.e.,

1 − Q6 ≤ ñ e$H ≤ 1 + Q6 , ; ≤ ;6A!!

§ In the stop band ;ñEf6 ≤ ; ≤ 5, we require ñ e$H ≈0


; with a maximum allowed deviation of Q! , i.e.,

ñ e$H ≤ Q! , ;!)/6 ≤ ; ≤ 5

The filter specification contains:


§ ;6Rññ - Cutoff frequency of the pass band
§ ;ñEf6 - Cutoff frequency of the stop band
§ Q6 - Allowed maximal ripple within the pass band (usually in dB)
§ Q! - Minimal rejection within the stop band (usually in dB)

384
8.1 Digital filters – Filter specifications
§ The cutoff frequencies of the pass band and stop band :6A!! and :!)/6 are usually given in Hz.
§ For the design of a digital filter, we need standardized frequencies:
25:6A!!
;6A!! = = 25:6A!! )4
:4
25:!)/6
;!)/6 = = 25:!)/6 )4
:4

9
§ Example: If :6A!! = 3 kHz, :!)/6 = 7 kHz and the sample rate is :4 = , = 25 kHz, it follows then:
B

%&(Xu9#a) %&(Öu9#a)
;6A!! = = 0.24 5 ;!)/6 = = 0.56 5
%Ñu9#a %Ñu9#a

385
8.1 Basics
§ We assume that a digital filter is a stable causal LTI system, which can be described with a rational
transfer function with real coefficients:
k# + k9 « *9 + ⋯ + k7 « *7
ñj « =
1 + &9 « *9 + ⋯ &i « *i

§ If all coefficients &5 equal to zero,


ñj « = k# + k9 « *9 + ⋯ + k7 « *7
§ Then this results in a non-recursive system, which is called a FIR system, otherwise it would be recursive,
i.e., a IIR system.

§ The task of filter design is to define the order and the coefficients of the filter transfer function for a given
target frequency response. We will discuss the appropriate methods for this later on.

386
8.1 Digital filters – IIR filter
Â(Ê) ∑V
STU ËS Ê
WS
§ Transfer function: 1 H = = ∑X
Á(Ê) òÈ STU ÍS Ê WS

Ì Ó

§ Difference equation: F B = N 9Î @ B − O − N 6Î F[B − O]


ÎÏó ÎÏó

§ Block diagram:

387
8.1 Digital filters – FIR filter
Â(Ê) ∑V
STU ËS Ê
WS
§ Transfer function: 1 H = = ∑X
Á(Ê) òÈ STUFIR
ÍS Ê WS

Ì Ó

§ Difference equation: F B = N 9Î @ B − O − N 6ÎFIR


F[B − O]
ÎÏó ÎÏó

§ Block diagram:

FIR

388
8.1 Digital filters – Optimization Target
§ Example: Design of a lowpass filter
1.2
ÖÜ e$H = 1, ; < ;6 (pass band region) Ripple within the pass band
ÖÜ e$H = 0, ;! ≤ |;| ≤ 5 (stop band region) 1

0.8 ¬Cutoff frequency


of the stop band
§ Optimization function could be for example:
0.6
Hp @& Cutoff frequency
of the pass band ®
ä &# , … , &B = T |Ö e$á − 1|% d; + γ T Ö% e$H d; 0.4 minimal rejection

# Hd 0.2

Observation of entire energy: pass band stop band 0


0 0.5 1 1.5 2 2.5 3

§ Parameter é enables it to adapt the filter.

389
8.1 Digital filters – Optimization Target
§ Example: Design of a lowpass filter
1.2

Ripple within the pass band


§ Alternative: ä &# , … , &B = max Ö e$á − 1 + é ( max Ö e$H 1
#àHàHe áe àH
0.8 ¬Cutoff frequency
Observation of chosen maxima: pass band stop band of the stop band
0.6
Cutoff frequency
of the pass band ®
0.4 minimal rejection
Important: Sampling theorem must be fulfilled, and one must calculate
it with high resolution. Otherwise, large outliers might show up 0.2
between the points.
0
0 0.5 1 1.5 2 2.5 3

Problem with : How does one trade off and compare the pass band
and the stop band?

390
8.1 Digital filters – FIR or IIR
§ Advantages of FIR filters
- Can be designed with a frequency response with linear phase.
(® The signal is transferred undistorted within the pass band.)
- Magnitude and phase of the pass band can be chosen independently of each other.
- Can be designed for almost every arbitrary frequency response with justifiable additional expenses.
- They are always BIBO-stable.
- Can be designed using the DFT.
- Are stable and robust with respect to quantization errors.

§ Disadvantages of FIR filters


- Require for the same specification a higher order, which yields to more coefficients than an IIR filter.
(® Requires a larger calculation time than a comparable IIR filter.)
- Require a more complex design method.
- Require more iterations until the specification is satisfied.

391
8.1 Digital filters – FIR or IIR
§ Advantages of IIR filters
- Usually for a given tolerance schema, IIR filters result in a significantly lower order, as compared to FIR
filters. (® Require a significantly lower calculation time than a comparable FIR filter.)
- Can be designed easier.

§ Disadvantages of IIR filters


- The phase of the frequency response, in contrast to symmetric FIR filters, is usually non-linear in the
pass band. ® Signal distortions will occur within the pass band.
- Magnitude and phase of the pass band cannot be chosen independently of each other.
- IIR filters can also become unstable due to the quantization of the coefficients.
- In practice, IIR filters will usually exhibit a larger quantization error when implemented
in fixed-point arithmetic.

392
8.1 Digital filters – FIR or IIR
§ Rule of thumb
- Use an IIR filter if the only requirements are sharp flanks (=smaller transition range between
pass band and stop band) and high data rates.
- Use a FIR filter if a linear phase frequency response (constant group delay, undistorted
transfer) is required.

393
Content - Digital filters 8

8.1 Basics

8.2 Characteristics of FIR filters

8.3 Design of FIR filters

8.4 Characteristics of IIR filters

8.5 Design of IIR filters

394
8.2 Characteristics of FIR filters

§ Difference equation:
7

| ' = V k5 < ' − f = k# < ' + k9 < ' − 1 + k% < ' − 2 + ⋯ + k7 <['7 − e]
5-#

§ Impulse response: ℎ ' = ℎ# , ℎ9 , … , ℎ7 = {k# , k9 , … , k7 }


- The impulse response of a non-recursive e-th order LTI system is equal to the value of the
coefficients of the difference equation.
- The length of the impulse response of a e-th order FIR system equals e + 1.

§ Transfer function: ñj « = k# +k9 « *9 + ⋯ + k7 « *7


- Through an expansion using «ç, the transfer function can be transformed
k# + k9 « *9 + ⋯ + k7 « *7
ñj « =
«7
- The result is that all the poles are in the origin and the FIR filter is always stable.

395
8.2 Characteristics of FIR filters
All the design methods for FIR filters, which we will discuss, result in symmetric FIR filters.
Type 1: axial symmetrical Type 2: axial symmetrical
N: even N: odd

§ A symmetric FIR filter is a filter, which has a


mirror or point symmetric impulse response.
§ Symmetric FIR filters have a linear phase
frequency response. (Only 180°phase-jumps by
going from positive to negative)
axis of symmetry Type 4: point symmetrical § Thus, FIR filters are also called linear-phased
Type 3: point symmetrical
N: odd
N: even filters.
§ Symmetric filters originate from an axis or
point symmetric time function through a shift
(modulation) of e)4 /2.
§ The group delay 7ó(:) of symmetric FIR filters is
constant and equal to e)4 /2.

point of symmetry

396
8.2 Characteristics of FIR filters ℎ[*]

§ Symmetric FIR filters


- A linear-phase filter can be created from a
symmetric filter by delaying the impulse *
response with half of the filter length.
- This gives causality. Symmetric filter =>
- The shift within the time domain frequency response is purely real
(corresponding to convolution with a
Dirac impulse at e)4 /2) corresponds to a
multiplication with e$%&7,B/% in the frequency ℎ1[*]
domain.

*
L

Causal filter =>


linear phase, constant group delay
397
8.2 Characteristics of FIR filters
§ Filters with constant group delay have the desirable characteristics that they do not distort signals
within the pass band, but only delay them. In addition, the symmetry of symmetric pulses is maintained
which is advantageous for many applications.
§ Example: linear-phased low-pass filter

Frequency
response

398
8.2 Characteristics of FIR filters
§ Continuing with the previous example:
- Input-output behavior (in the time domain) of a point symmetric double square pulse.

Input signal

Output signal

- The low-pass filtered square pulse is rounded by the filter, but it is still point symmetric.
- The main effect is that the output pulse is group delayed by 7P = 1.05 ms (10.5 sample points).

399
8.2 Characteristics of FIR filters
§ In the example above:

Pole zero
Impulse point diagram
response

- It is a symmetric (low-pass) type 2 FIR filter.


- Apart from 180°-phase jumps, which occur at the zero points of the amplitude response and have thus no
influence on the transfer behavior, the phase of frequency response is linear.
- The length of the filter is 22. Consequently, the transfer function has to have 21 zero points and 21 poles,
which are located in the origin.
- The zero points in the stop band are located on the unit circle. The zero points in the pass band are positioned
symmetrically about the horizontal axis, outside and inside the unit circle.
- A linear-phased filter has to have zero points outside of the unit circle.

400
8.2 Characteristics of FIR filters
§ Pole-zero point diagram of a linear-phased FIR filter
- A linear-phased filter has to have zero points outside of
the unit circle, e.g., A and C.

- The zero points within the stop band are located on the
unit circle, e.g., B, D and E.

- The zero points within the pass band are located


symmetrically to the horizontal axis, outside and inside
the unit circle, e.g., A and C. They are complex
conjugated with respect to each other and mirrored
within the pass band at the unit circle (which means
inverse to each other).

- In each case, the same letters belong together.

401
8.2 Characteristics of FIR filters
Input spectrum
§ Referring to the previous example:
Input-output behavior (in the frequency domain)
of a point symmetric double square pulse.

Frequency response

§ The main lobe and the first side lobe of the


signal spectrum are passed through the filter
without damping, whereas the higher side
lobes are suppressed.
Output spectrum

402
8.2 Characteristics of FIR filters
§ Structures of FIR filters
- Direct form or tapped delay line

x[n] z-1 z-1 z-1 z-1


b0 b1 b2 bN-1 bN

y[n]

- Simplified representation:

- Complexity: For each output value, (e + 1) multiplications and e additions have to be performed.

403
8.2 Characteristics of FIR filters
§ Cascade structure for symmetric FIR filter
- Using a zero point analysis, a FIR filter can be converted into a serial connection of elementary filters.
- This increases the stability during quantization.

b0
<['] + + + |[']

z -1 z -1 z -1
b 1,1 b 2,1 b M,1
+ + +
z -1 z -1 z -1
b 1,2 b 2,2 b M,2

- Each single elementary filter corresponds to a real (then k5,% = 0) or complex zero point.

404
8.2 Characteristics of FIR filters
Example of a FIR low-pass filter of 2nd order

§ In general:
R

| l = V ℎ['] ( <[l − '] (Moving average)


"-#
ℎ9[']
9
§ Low-pass: ℎ 0 =⋯=ℎ æ = 1/
R@9 3
'
R-% < l + < l − 1 + <[l − 2] -2 -1 1 2 3 4
|l =
3

§ Initial condition:
< l = 0ÿ
:â#

405
8.2 Characteristics of FIR filters

Result

Input and output amplitude


<[l] and |[l]
○ Input sequence <[l]
+ Output sequence |[l]

Sample l

Observation: the filter smoothes and delays the signal vector → low-pass

406
8.2 Characteristics of FIR filters
Complex plane plot
§ Frequency response plot using the z-transform Im(«)
z01
< l + < l − 1 + <[l − 2]
|l =
3
z-transform zP1,2 Re(«)

> « + > « « *9 + > « « *%


Ç « =
3 z02

§ Transfer function of sliding mean average:


Ç(«) 1 + « + «*9 *% % 9
« +« +1 Zeros: ñ «# = 0 = « % + « 9 + 1
⇒ñ « = = = «# =
9±$ X
; «# = 1
>(«) 3 3« % %
j "@j G@9
Poles: ñ «6 = ∞ =
Xj "
«T9,% = 0

407
8.2 Characteristics of FIR filters

§ Frequency response plot using the z-transform:

Ç(«) « % + « 9 + 1 1 + e*$H + e*$%H


ñ « = = %
⇔ ñ e$H =
>(«) 3« 3
$H
1 *$H $H *$H
1 *$H
⇒ñ e = e e +1+e = e 1 + 2 cos ;
3 3
$H
1 %
1

|ñ(ejé)|
ñ e = 1 + 2 cos ; = 1 + 2 cos ;
3 3

§ Dependency on sampling rate :4 :

Ω 25:
;= =
:4 :4
;

408
8.2 Characteristics of FIR filters
§ The 4 types of symmetric and anti-symmetric FIR filters
Length: ô odd even
Order (r = ô– 1): even odd

Type 1 Type 2

Symmetric

n n

Type 3 Type 4
Anti-
symmetric
n n

409
8.2 Characteristics of FIR filters
§ The 4 types of symmetric and anti-symmetric FIR filters: pole zero diagram (PZ)
Length: ô odd even
Order (r = ô– 1): even odd

Type 1 — $H )
ñ(e Type 2 — $H )
ñ(e
ω
Symmetric h[n] p h[n] p ω
n PZ D n
PZ

Type 3 — $H )
ñ(e Type 4 — $H )
ñ(e
Anti-
symmetric h[n] p ω h[n] p ω
PZ
D n PZ D n

410
8.2 Digital filters – cascading of filters
§ If multiple copies of a filter are connected in series, the impulse
responses will be convoluted and the frequency responses get multiplied.

Filter characteristics become more pronounced.


|d(ejÉ )|
d(ejÉ )
j
|d(ejÉ )|3 1

d(ejÉ ) d(ejÉ ) d(ejÉ )


Pole-Zero diagram
j

§ Multiple copies of a filter connected in series yields multiple poles and


zeros in the z-plane at the same point.

411
8.2 Digital filters – cascading of filters
§ Cascaded filters have a higher order, which means a longer impulse response:

ℎ[Y] ℎ[Y] ∗ ℎ[Y] ℎ[Y] ∗ ℎ[Y] ∗ ℎ[Y]

1/
2
1/ 1/
4 8
' Y Y
-2 -1 2 3 4 -2 -1 2 3 4 -2 -1 2 4

-1/2 -1/2 -3/8

§ Cascaded filters are in general not optimal for a given order.


§ Cascading filters increase the edge steepness, but also reduce the bandwidth.

412
Content - Digital filters

8.1 Basics

8.2 Characteristics of FIR filters

8.3 Design of FIR filters

8.4 Characteristics of IIR filters

8.5 Design of IIR filters

413
8.3 Design of FIR filters
§ Standard: Specification of the basic filter functions using standard amplitude response tolerance schema.

§ Specification: filter order e, filter coefficients k0, … , kç

414
8.3 Design of FIR filters
§ The most important design methods for FIR filters
- Window method
- Optimal method (also called Remez-exchange, Equiripple or Chebychev-Approximation)
§ Window method: 5 design steps
1. Define the cutoff frequency(ies) of the ideal rectangular-shaped frequency response ñ\òhRô(ejé)
2. Calculate (or use tables) the corresponding filter impulse response ℎ\òhRô['].
This results in an infinitely long and non-causal filter, which is therefore not realizable.
2 possibilities: sample the frequency response with the inverse discrete Fourier transform,
or analytically calculate the IFT of the frequency response, and then sample in the time domain.
3. Multiply the ideal impulse response ℎ\òhRô['] with an appropriate window function Ω[']

ℎ ' = ℎ5Ü.AW ['] ( Ω[']

4. Calculate the corresponding frequency response and compare with the specification.
If not acceptable, change ñ\òhRô(ejé) or Ω['] and repeat one or more of the previous steps.
5. Delay the resulting impulse response ℎ['], so that the filter is causal (realizable).

415
8.3 Design of FIR filters
§ Example: ideal impulse responses of basic filter functions:

- Ideal lowpass filter with the cutoff frequency ;d :


;d
ℎ5Ü.AW ' = si(';)
5

- Ideal bandpass filter with cut-off frequencies ;9 and ;% :

;% ;9
ℎ5Ü.AW ' = si ';% − si(';9 )
5 5

416
8.3 Design of FIR filters
§ Window method displayed in the time domain (example: rectangular window)

a) Ideal impulse response ℎ5Ü.AW [']


(infinite length)

b) Time domain window Ω[']


(windows with 20 data points)

c) Windowed impulse response ℎ0 [']


(convoluted)

d) Delayed impulse response


(delay about /2 = 10)

417
8.3 Design of FIR filters
§ Window method displayed in the time domain (example: rectangular window)

a) Ideal frequency response ñ5Ü.AW [']

b) Frequency response ] of window

c) Frequency response ñ0 of
windowed impulse response

d) Frequency response of delayed


impulse response

Q
418
8.3 Design of FIR filters
§ Window method – Choose a window
- Rectangular window 1 for ' < limit value
Ω=E
0 otherwise
- Result in large amplitude response ripples.
- Tolerance schema is not the input of the design, but a random result of it.

1 25'
- Hann window Ω = 1 + cos
2 e
+ Ripples within the passband are significantly smaller in comparison to designs with a rectangular window.
- As with the design using a rectangular window, the tolerance schema is not the input of the draft,
but a random result of it.
- The resulting band edges are more flat when compared to a rectangular window.

419
8.3 Design of FIR filters
%
2'
Ú# ∞ 1 −
e−1
§ Window method – Choose a window Ω=
- Kaiser window Ú# (∞# )

+ We have an additional parameter ∞, which can be freely chosen.


+ If the tolerance schema is provided, both parameters e + 1 (window length) and ∞ can be
determined from the tolerance schema, and also the filter coefficients k0, … kç can be
determined. à The Kaiser window always fulfills the specification.

- The filter order usually is relatively high, because the tolerance schema is not exploited to an optimal level.

420
8.3 Design of FIR filters
1

§ Window types

wrec [n] ®
Rectangular window 0.5

0
0 5 10 15 20 25 30 35 40
1

wH[n] ®
Hann window 0.5

0
0 5 10 15 20 25 30 35 40
1 n®

wK[n] ®
Kaiser window 0.5

0
0 5 10 15 20 25 30 35 40
421
8.3 Design of FIR filters
§ Window method
1
a) Design with rectangular window

|H(ω)| ®
- has strong overshoots before the transition 0.5

0
0 0.2 0.4 0.6 0.8 1
ω /p®
b) Design with Hann window 1

|HH( ω)| ®
- does violate specification domain at the transition edge
0.5

0
0 0.2 0.4 0.6 0.8 1
c) Design with Kaiser window ω /p®
- ideal synthesis 1

|HK(ω )| ®
- requires some calculation effort
0.5

0
0 0.2 0.4 0.6 0.8 1
ω /p®
422
8.3 Design of FIR filters – frequency responses
§ Different windows with a given filter length of 51 and Ωö = 5/2

a) Design using Hann window

b) Design using Hamming window

c) Design using Blackman window

423
Jewgeni Jakowlewitsch Remes
* 1896 in Mszislau, † 1975 in Kiew

8.3 Design of FIR filters


§ Optimal method (Remez-exchange, Equiripple, Chebychev-approximation)
- FIR filters can be designed using this method, yielding acceptable ripples within the pass band
and stop band.
- Results in a filter of order e, which is in general significantly smaller than when designed using a window.
- The theory behind the optimal method is complex and requires some time to explain.
- The optimal method is the standard method for the design of digital FIR filters and is part of almost every
program used for signal processing (e.g., MATLAB).
- It does not only allow the design of the four basic filter types, but also the design of multi-band filters,
differentiators,…

- Other methods used to design FIR filters (such as the Least-Squares method, which is implemented in
MATLAB) will not be covered here.

424
8.3 Design of FIR filters
§ Optimal method (Remez-exchange, Equiripple-method, Chebychev-Approximation)
Minimum order e. of the filter for the optimal method: 1.2

2E$ 1
ô ò ‰Z
PÛ = Ù
log òóıY ıZ ‰Z ˆ‰Y 0.8

|\(+)| ®
0.6

ü “Independent” of pass band bandwidth. 0.4

ü Weak (logarithmic) dependency of the allowed ripple 0.2


within the pass band and the stop band. E"
0
ü Linear dependency of the relative transition bandwidth. 0 0.2 0.4 0.6 0.8 1
Qf Q
Qg ®
π
Filter specification
Resultant filter
425
8.3 Design of FIR filters
§ Check the filter design
- A design always needs to be checked for functionality.
This is done by performing zero-padding in the time domain (which means adding zeros) and then by
transforming it into the frequency domain using the FFT.
- The FFT algorithms always assumes that the time domain starts at ! = 0. If not, the result needs to be
corrected „manually“.
- The impulse response of a filter should reduce to zero as time increases. If this is not the case, then
something is wrong with the design. A sharp edge in the time domain always results in large ripples in
the frequency domain.

§ Corrections
- Increase signal time span
- Smooth the transitions in the frequency domain
- Use a smoother window in the time domain

426
8.3 Design of FIR filters
MATLABâ: Signal Processing Toolbox
The MATLAB® Signal Processing Toolbox is a collection of extremely useful routines, which add improved
capabilities to the MATLAB calculation environment. The Toolbox offers a wide choice of programs for signal
processing:
§ Filter design and implementation
§ Window functions
§ Transforms
§ Statistical signal processing and spectral analysis
§ Waveform design
§ and much more...

427
8.3 Design of FIR filters - MATLAB FD&A-tool

428
8.3 Design of FIR filters - MATLAB FD&A-tool

429
8.3 Design of FIR-filters - MATLAB FD&A-tool
Impulse response of a
Hamming-filter (i.e.,
utilizing a Hamming
window for design) of
the order 40

430
8.3 Design of FIR filters - MATLAB FD&A-tool

431
Content - Digital filters

8.1 Basics

8.2 Characteristics of FIR filters

8.3 Design of FIR filters

8.4 Characteristics of IIR filters

8.5 Design of IIR filters

432
8.4 Characteristics of IIR filters

§ Difference equation: | ' = − ∑i 7


5-9 &5 | ' − f + ∑5-# k5 <[' − 1]
ãh (j) t!@tGj AG@⋯@tP j AP
§ Transfer function: ñj « = =
Ih (j) 9@AGj AG@⋯@Aij Ai

§ The impulse response of an IIR filter is in general infinitely long, but because of its stability, it converges to
zero as time increases.
§ Advantage:
- Compared to FIR filters, IIR filters can result in smaller filter orders for a given tolerance schema.
§ Disadvantages:
- The phase of the frequency response is typically non-linear for IIR filters within the pass band.
à Thus, signal distortions appear within the pass band.
- IIR filters might become unstable due to quantization of the filter coefficients.
- IIR filters typically will suffer stronger on quantization errors, when implemented using fixed-point
arithmetic processors.

433
8.4 Characteristics of IIR filters
§ Structures of IIR filters
- Direct form-I-structure (direct transfer of the difference equation)

434
8.4 Characteristics of IIR filters
§ Structures of IIR filters
- Transposed direct form-II-structure (minimal amount of delay elements)

435
8.4 Characteristics of IIR filters doubt in constructing the equation

§ Structures of IIR filters


- Cascade structure: implemented using blocks of 2nd order. Z T = ZI T [ ZH T [ …

- The cascade structure usually is implemented in DSPs, because it divides the filter in
blocks of 2nd order. Therefore, it is the most stable structure.

436
8.4 Characteristics of IIR filters
§ Example of a simple IIR low-pass filter
IIR ® feedback, has zero points and poles, limited stability,
ℎ[Y] is less useful for interpretation.

|\(ej/ )|
1 + ë &$
d%@ ë =QM a®1
1 − õë &$
z-plane

Scaled in order to set the ω/p


amplitude = 1 at the Pole-Zero point Frequency response
frequency j = 0 diagram
® Q = (1 – õ )/2

437
8.4 Characteristics of IIR filters
§ Example of a simple IIR low-pass filter

1 − Ø 1 + « *9
ñBT « = (
2 1 − Ø« *9

% 9
§ Determination of the 3dB-bandwidth ;ö : ñBT e$Hj =
%

1−Ø % 1 + e*$Hj ( 1 + e$Hj 1


⇒ ( =
4 1 − Øe*$Hj ( 1 − Øe$Hj 2

⇒ cos ;d =
1 + Ø%
$&\]^(XZ )
⇒ õ= Design equation
_`\(XZ )

438
8.4 Characteristics of IIR filters
Pole-Zero point diagram

§ Example of a simple IIR high-pass filter

1 − ë &$
dU@ ë =QM
1 − õë &$
z-plane

Scaling factor adjusted to set the amplification ˜ = 1


at the frequency ; = 5 Frequency response

|\(ej/ )|
® ñOT (−1) = 1 N®1
® É = (1 + Ø)/2

Design equation 1 − sin(;d )


Ø=
(identical to the LP) cos(;d )

+/-
439
8.4 Characteristics of IIR filters Pole-Zero point
diagram

§ Example of a simple IIR bandpass filter


1−Ø 1 − «%
ñcT « = (
2 1 − ∞ 1 + Ø « *9 + Ø« *%

z-plane
(1 − « *9 )(1 + « *9 )

1 − 2ficos · ( « *9 + fi % « *%
Frequency response
where:

|\(ej/ )|
∞(1 + Ø)
fi = Ø and cos · =
2 Ø
equations

center frequency: ;d = cos *9 (∞)


Design

*9

3dB bandwidth: j = cos
1 + Ø%

440
8.4 Characteristics of IIR filters
§ Simple IIR bandpass filter:

Design of a simple 2-pole IIR bandpass filter where ;d = 0.45


and the 3dB-Bandwidth = 0.15

;d = 0.45 ⇒ ∞ = cos ;d = 0.3090


Ø
j = 0.15 ⇒ = cos 0.15 ⇒ Ø = 0.7265
1 + Ø%
1−Ø 1 − «%
⇒ñcT « =
2 1 − ∞ 1 + Ø « *9 + Ø« *%
0.1367 (1 − « *% )
Reasonable, which means that
= the poles are close, but not too
1 − 0.5335« *9 + 0.7265« *%
close to the unit circle.

441
8.4 Characteristics of IIR filters
Pole-Zero point
t ;ö diagram
ts a
§ Example of a simple IIR band-stop filter o in
o p
Zer
1+Ø 1 − 2∞« *9 + « %
ñc4 « = (
2 1 − ∞ 1 + Ø « *9 + Ø« *%
Same poles a
where: s ñõl z-plane
∞(1 + Ø)
fi = Ø and cos · =
2 Ø
Frequency response
equations

center frequency: ;d = cos *9 (∞)


Design

|\(ej" )|

3dB bandwidth: j = cos *9
1 + Ø%

1 1
⇒ Ø= − −1
cos(j) cos % ( j)
+/-
442
Content - Digital filters 8

8.1 Basics

8.2 Characteristics of FIR filters

8.3 Design of FIR filters

8.4 Characteristics of IIR filters

8.5 Design of IIR filters

443
8.5 Design of IIR filters
§ Digital IIR filters are based on the methods used for the design of analog filters.
§ In the first step of the IIR filter design, the tolerance schema of the digital filter is specified.
§ In a next step, the specification of the digital filter is transferred (pre-warp) into the corresponding
specification of an analog low-pass filter.
§ Design an analog filter (Butterworth, Chebychev, Cauer).
§ From this analog lowpass filter, the filter transfer function ñA (.) is then calculated.
§ In the final step, the filter transfer function ñA (.) is transformed into the transfer function of the
digital filter ñ(«) (bilinear transform).
§ The good news:
- All these steps are implemented in modern filter design tools (e.g., sptool in MATLAB) and do not have
to be executed „by hand“ by the filter designer.
- The filter designer simply has to define the specification as well as the choice of the filter type
(Butterworth, Chebychev, Cauer).

444
8.5 Design of IIR filters
This design method got accepted for the following reasons:
§ Nobody knows, how to design a digital filter in the digital domain.
§ Analog design methods are well researched and developed.
§ Analog design methods often lead to closed solutions.
§ Elaborate tables for analog filter design can be found in the literature.
§ For a lot of applications of digital filters (e.g., control technique), digital simulations of analog systems
are needed.

445
8.5 Design of IIR filters –
Transform of an analog design into a digital design

§ Impulse response-invariant method


An obvious method would be the following approach:
IFT Discretization z-transform
1 ; ℎ $ à ℎ B=ü à 1(H)

This method, however, has not become accepted.


- Aliasing effects (especially for high-pass filter) are not treated correctly.
- Using this method, the stability of a digital filter is not always guaranteed, even if the underlying
analog filter was stable.
§ One needs a method, which guarantees the following:
A stable analog filter (i.e., all poles are in the left semi-plane in the s-plane) is transformed into a
stable digital filter (i.e., all poles are located within the inside of the unit circle in the z-plane).

446
8.5 Design of IIR filters –
Transform of an analog design into a digital design
§ The transfer function of the analog filter is:
ÇA (.)
ñA . =
>A (.)
where the index „a“ indicates the analog characteristic.

§ The transfer function of the digital filter is:


Ç(«)
ñ « =
>(«)

§ The transformation of ñA . function into the ñ(«) function should keep the main characteristics
of the frequency response of the analog filter:
- The imaginary (j;-) axis should be transformed onto the unit circle. (frequency axis → unit circle)
- A stable analog transfer function should be converted into a stable digital transfer function.
(left half space of the complex plane → inner circle area)

447
8.5 Design of IIR filters – Bilinear transform
§ General approach for the transformation of ñA . into ñ(«): . ⟶ :(«)
§ Boundary conditions for ñ(«):

ñ(«) Given characteristic of ñA .

Stable Stable

Real and rational in « Real and rational in .


Order e Order e

Low-pass cutoff frequency Ω3 Low-pass cutoff frequency ;c)4

§ Mapping function :(«) is real and rational in « and of the order one.
*ë + (
§ For a lowpass-lowpass-transform, one requires: 3 ë =
Kë + a

448
8.5 Design of IIR filters – Bilinear transform
*ë + (
8=3 ë =
Kë + a

§ 8 = 0 ⟶ ë = 1: 3(1) = 0 *+( =0 resp. ( = −*

§ 8 = ±j¥ ⟶ ë = −1: 3(−1) = ±j¥ K– a = 0 resp. K=a


* ë−1
3 ë = M
K ë+1

§ The value of &/q results from the mapping of the cut-off frequencies Ωc )4 « ;c .
One typically chooses (for compactness )4 = )):
* 2 2 ë−1
= 8= M
K %5 % ë+1
449
8.5 Design of IIR filters
§ The transfer function ñA (.) of an analog filter is transformed into the transfer function ñ(«) of a digital
filter using the bilinear transform:
2 «−1 2 «−1
.= ( ñj « = ñA . = ( = ñA . ÿ % 9*j AG
) «+1 ) « + 1 !- u
, 9@j AG
§ The bilinear transform
- Transforms the left s-semi-plane into the unit circle of the z-plane.
- Maps all poles, situated on the left side s-semi-plane, into the inside of the unit circle of the z-plane, yielding to a
stable digital filter from a stable analog filter.

- The jW-axis of the s-semi-plane is transformed onto the ej5-unit


Wa ω circle of the z-plane.
® The frequency response of the analog filter is converted
into the frequency response of the digital filter.
- However, the relation between the standardized angular
frequency Q of the digital filter and the angular frequency Ω^
of the analog filter is non-linear:
2 ;
ΩA = tan
) 2
450
8.5 Design of IIR filters – Bilinear transform
However, the relation between the standardized angular frequency ; of the Pre-warp:
digital filter and the angular frequency ΩA of the analog filter is non-linear. 2
% j*9 Wa Ω^ = tan( Q/2)
§ Let « = e $H
with the magnitude 1. Then it applies . = &4
,B j@9

Analog filter
2 1 − « *9 2 1 − e*$H W4
¯ΩA = = W3
)4 1 + « *9 )4 1 + e*$H
*$H $H *$H ;
2 e % e% −e % 2 j2 sin 2 2 ; W2
W1
= = = j tan |û# (jW)|
)4 *$H *$H *rH )4 2 cos ; )4 2 ú
e % e % +e % 2 |û(ej*)|

ω
2 j
Ω6 = tan
%5 2
Wa
ú
ω1 ω2 ω3ω4

Digital filter
451
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4

Analog filter
Bilinear transform: pre-warp W4
W3
3.14
3

Radians/sample
2.355 W2
|û# (jW)| W1
ω
1.57
|û(ej*)|
0.785
Radians/second
0
-12 -10 -8 -6 -4 -2 0 2 4 6 8 10 12
-0.785
=ü ΩÍ ú
-1.57 ω1ω2 ω3 ω4
Digital filter
-2.355

-3.14

§ The region −¥ until +¥ of )4 ΩA is transformed to −5 until 5 for ;.


§ Within the region: )4 ΩA = −2 until 2, this transformation is approximately linear.
§ Within the region: )4 ΩA > 2, an increase of ΩA produces a steadily smaller increase of ;.

452
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4

Analog filter
Bilinear transform: pre-warp W4
W3

§ Within the domain )4 ΩA > 2, an increase of ΩA produces a W2


steadily smaller increase of ;. |û# (jW)| W1
ω
§ This frequency skip has to be considered in the filter design. |û(ej*)|

|d6 (jW)| |d(exp(jj)|

ú
ω1ω2 ω3 ω4
Digital filter

p %ç Ω6 p/2 p
Analog frequency response Corresponding digital frequency response
after a bilinear transformation.

453
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4

Analog filter
Bilinear transform: pre-warp W4
W3

Example: Butterworth-lowpass filter 1st order W2


ΩA |û# (jW)| W1
ñA . = ω
. + ΩA
|û(ej*)|
§ Bilinear transform:
Digital Butterworth-lowpass filter 1st order
) *9
2 Ω A (1 + « )
ñ « = ñA . ÿ % j*9 = ú
!-, j@9 ) ω1ω2 ω3 ω4
1 − « *9 + ΩA (1 + « *9 )
2 Digital filter

M ]
9*o 9@j AG 9* éW 9*èZG
" "
ñ « = with Ø= M = ]
% 9*oj AG 9@ éW 9@èZG "
"

454
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4

Analog filter
Bilinear transform: pre-warp W4
W3

9
Example: ñA . = 9@L3! RC − low − pass W2
|û# (jW)| W1
ω
9
ñA . = " hAG
|û(ej*)|
9@L3 M h`G

, (j@9)
=
,@%L3 j@(,*%L3)
ú
9@j AG ω1ω2 ω3 ω4
ñ « = É 9@t j AG
G Digital filter
, ,*%L3
where É = ,@%L3 and k9 = ,@%L3

455
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4

Analog filter
Bilinear transform: pre-warp W4
W3

Example: Design of a Butterworth IIR low-pass filter of 2nd order, W2


& |û# (jW)| W1
where ;d = ω
K
|û(ej*)|
&
§ Solution: The pre-warped frequency is Ωd = 2 tan V
= 0.828
§ The analogue Butterworth low-pass filter 2nd order with a cutoff frequency of
1 radian/second is:
1
ñA . = ω1ω2 ω3 ω4
ú
1 + 2. + . %
Digital filter
§ Scaling for the cutoff frequency 0.828:
1
ñA . =
2. . %
1+ +
0.828 0.828
% j*9
§ Transformation using the bilinear transform where . = :
, j@9
« % + 2« + 1
ñ « = %
« − 9.7« + 3.4

456
8.5 Design of IIR filters
§ Digital IIR designs are based upon the reliable methods used for analog filters.
§ In a first step of the IIR filter design, the tolerance schema of the digital filter is determined. ü
§ In a next step, the specification of the digital filter is transferred into the corresponding specification of an
analog low-pass (pre-warp). (half ü)
§ Design an analog filter (Butterworth, Chebychev, Cauer).
§ From this analog lowpass the filter, the transfer function ñA (.) is then determined.
§ In the final step, the filter transfer function ñA (.) is transformed into the transfer function of the
digital filter ñ(«) (bilinear transform). ü
§ Note that the bilinear transform does not contain the phase gradient of the analog filter.

457
8.5 Design of IIR filters
Comparison of a Butterworth with a Tschebyscheff and an elliptical low-pass filter.

Specification: 200 Hz cutoff frequency (3dB)


458
8.5 Design of IIR filters
Example of a Butterworth filter design
§ Two possible designs of an analog Butterworth lowpass filter:

$
L da jΩ = :
$#'?sü
C

$
C da jΩ = ;ü
$#'? s C

§ There are multiple ways to design a filter.

459
8.5 Design of IIR filters
§ Characteristics of different IIR-filter types
Magnitude of the frequency
Filter type Order response
Phase

Flat in the pass band


Butterworth High Flat in the stop band
Slightly non-linear

Ripple in the pass band


Chebychev I Average Flat in the stop band Non-linear

Flat in the pass band Non-linear


Chebychev II Average Ripple in the stop band
Ripple in the pass band
Cauer Low Ripple in the stop band
Heavily non-linear

§ Designer chooses the filter type:


- Cauer design is often used because this results in low order filter designs.
- A final decision regarding the filter type is often determined by performing a simulation of the filter
embedded into the complete system (for example with MATLAB).

460
8.5 Design of IIR filters – MATLAB FD&A-tool

461
8.5 Design of IIR filters – MATLAB FD&A-tool

462
8.5 Design of IIR filters
Non-ideal effects when implementing filter designs using fixed-point arithmetic
§ Effects of filter coefficient quantization
- Quantization of the coefficients can alter the tolerance schema of the desired filter.
- IIR filters can become instable.

§ When numbers are added, overrange can occur because of the limited number range.

§ Signal errors can occur during multiplication à quantization error.

463
8.5 Design of IIR filters - MATLAB FD&A-tool

464

You might also like