SignalProcessing - SS2023 Part - 7-digitalFIR-IIR
SignalProcessing - SS2023 Part - 7-digitalFIR-IIR
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
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.
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(
Ω Ω
−5($ −5(%
0 5(% 5($ −5($ −5(% 0 5(% 5($
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.
§ 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!!
ñ e$H ≤ Q! , ;!)/6 ≤ ; ≤ 5
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
§ 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
Ì Ó
§ Block diagram:
387
8.1 Digital filters – FIR filter
Â(Ê) ∑V
STU ËS Ê
WS
§ Transfer function: 1 H = = ∑X
Á(Ê) òÈ STUFIR
ÍS Ê WS
Ì Ó
§ 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
# Hd 0.2
389
8.1 Digital filters – Optimization Target
§ Example: Design of a lowpass filter
1.2
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.
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.
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
394
8.2 Characteristics of FIR filters
§ Difference equation:
7
| ' = V k5 < ' − f = k# < ' + k9 < ' − 1 + k% < ' − 2 + ⋯ + k7 <['7 − e]
5-#
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
point of symmetry
396
8.2 Characteristics of FIR filters ℎ[*]
*
L
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
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.
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
402
8.2 Characteristics of FIR filters
§ Structures of FIR filters
- Direct form or tapped delay line
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
§ Initial condition:
< l = 0ÿ
:â#
405
8.2 Characteristics of FIR filters
Result
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(«)
407
8.2 Characteristics of FIR filters
|ñ(ejé)|
ñ e = 1 + 2 cos ; = 1 + 2 cos ;
3 3
Ω 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.
411
8.2 Digital filters – cascading of filters
§ Cascaded filters have a higher order, which means a longer impulse response:
1/
2
1/ 1/
4 8
' Y Y
-2 -1 2 3 4 -2 -1 2 3 4 -2 -1 2 4
412
Content - Digital filters
8.1 Basics
413
8.3 Design of FIR filters
§ Standard: Specification of the basic filter functions using standard amplitude response tolerance schema.
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 Ω[']
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:
;% ;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)
417
8.3 Design of FIR filters
§ Window method displayed in the time domain (example: rectangular window)
c) Frequency response ñ0 of
windowed 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 Ú# (∞# )
- 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
423
Jewgeni Jakowlewitsch Remes
* 1896 in Mszislau, † 1975 in Kiew
- 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
§ 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
432
8.4 Characteristics of IIR filters
§ 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
- 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
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 =
%
438
8.4 Characteristics of IIR filters
Pole-Zero point diagram
1 − ë &$
dU@ ë =QM
1 − õë &$
z-plane
|\(ej/ )|
® ñOT (−1) = 1 N®1
® É = (1 + Ø)/2
+/-
439
8.4 Characteristics of IIR filters Pole-Zero point
diagram
z-plane
(1 − « *9 )(1 + « *9 )
=É
1 − 2ficos · ( « *9 + fi % « *%
Frequency response
where:
|\(ej/ )|
∞(1 + Ø)
fi = Ø and cos · =
2 Ø
equations
*9
2Ø
3dB bandwidth: j = cos
1 + Ø%
440
8.4 Characteristics of IIR filters
§ Simple IIR bandpass filter:
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
|\(ej" )|
2Ø
3dB bandwidth: j = cos *9
1 + Ø%
1 1
⇒ Ø= − −1
cos(j) cos % ( j)
+/-
442
Content - Digital filters 8
8.1 Basics
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
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 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 ñ(«):
Stable Stable
§ 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
§ 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.
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
452
Pre-warp: 2
Ω^ = ⋅ tan( Q/2)
8.5 Design of IIR filters – a
W &4
Analog filter
Bilinear transform: pre-warp W4
W3
ú
ω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
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
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.
$
L da jΩ = :
$#'?sü
C
$
C da jΩ = ;ü
$#'? s C
459
8.5 Design of IIR filters
§ Characteristics of different IIR-filter types
Magnitude of the frequency
Filter type Order response
Phase
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.
463
8.5 Design of IIR filters - MATLAB FD&A-tool
464