Sie sind auf Seite 1von 171

Chapter 03

Digital Filters
Version 3.2 Oct 2017
English

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-1


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
Content
3.2.2 Various filter types Verschiederen FIR Filtertypen 51
Chapter 3 Digital filters Digitale Filter 3.2.2.1 Filters for linear phase response Linearer Phasengang 52
3.2.2.2 Example Beispiel 54
Content Inhalt 2 3.2.2.3 Odd number symmetrical coefficients: Ungerade Anzahl symmetrischer Koeffizien 55
3.1 Basics Grundlagen 4 3.2.2.4 Odd number anti-symmetrical coefficients: Ungerade Anzahl antisymmetrischer Koeffizienten 56
3.1.1 History of digital filters Historie digitaler Filter 4 3.2.2.5 Even number of coefficients (symmetrical andGerade
antisymmetrical)
Anzahl von Koeffizienten 58
3.1.2 Different filter types Grundlegende Filterarten 5 3.2.2.6 Example Beispiel 60
3.1.3 Signal representation in time domain Signaldarstellung im Zeitbereich 8 3.2.3 Different options to scale the frequency response
Möglichkeiten zur Skalierung des Filte 61
3.1.4 FIR- and IIR-filters FIR und IIR Filter 9 3.2.4 FIR filter design according to the window method
Filterentwurf nach Fenstermethode 62
3.1.5 Linear difference equation Lineare Differenzgleichung 11 3.2.4.1 Window method principle approach Prinzipielle Vorgehensweise 62
3.2.4.2 Hanning window Hanning Fenster 66
3.1.6 LTI-systems LTI Systeme 12
3.2.4.3 Blackmann window Blackmann Fenster 67
3.1.6.1 Time invariance Lineare System 12
3.2.4.4 Kaiser window Kaiser Fenster 68
3.1.6.2 Time invariance Zeitinvariante Systeme 13
3.2.5 Optimal method Optimalmethode 70
3.1.7 Discrete convolution Diskrete Faltung 14
3.2.6 Half-Band Filter Half-Band Filter 71
3.1.7.1 Rules Regeln 14
3.2.7 Low-pass to High pass transformation Tiefpass >> Hochpass Transformation 72
3.1.7.2 Example Beispiel 15
3.2.7.1 Example Beispiel 73
3.1.8 Impulse response Impulsantwort 17
3.2.8 Summary FIR Zusammenfasdsung FIR Filter 77
3.1.8.1 Example IIR Beispiel Impulsantwort IIR 17
3.3 Sample rate conversion Abtastratenumsetzung 78
3.1.8.2 Example FIR Beispiel Impulsantwort FIR 18
3.3.1 Up-conversion Aufwärtskonversion 78
3.1.9 Causality Kausalität 19
3.3.1.1 Example Beispiel 78
3.1.10 Stability Stabilität 20
3.3.1.1 Application in audio area Anwendung im Audiobereich 81
3.1.11 Digital signal processing components Komponenten digitaler Netzwerke 21
3.3.2 Poly-phase filter Polyphasenfilter 83
3.1.12 System description in frequency domain Systembeschreibung im Frequenzbereich 22
3.3.3 Coefficient sharing Koeffizienten Sharing 86
3.1.12.1 Transfer function Übertragungsfunktion 22
3.3.4 Decimation Dezimation 87
3.1.12.2 Example Beispiel 24 3.3.4.1 Example re-sampling Beispiel Resampling 88
3.1.13 z-Transformation z-Transformation 25 3.3.4.2 Example sample rate converion by 7/8 Beispiel Sample Rate Vonversion um 7/8 89
3.1.13.1 Unilateral z.transformation Einseitige z- Transformation 26 3.4 IIR-filter IIR-Filter 99
3.1.13.2 Examples Beispiel 27 3.4.1 Properties of IIR - filters Eigenschaften rekursiver Filter 99
3.1.13.3 Rules of z transformation Gesetzmäßigkeiten der z-Transformation 28 3.4.2 Cascading of IIR filters Kaskadierung von IIR-Filtern 102
3.1.13.4 Examples of various z-transformations Auflistung verschiedener z-Transformationen 29 3.4.3 IIR filter design IIR-Filter Entwurf 103
3.1.13.5 z transformation applied on difference equationsAnwendung der z-Transformation auf Differenzgleichungen30 3.4.3.1 IIR filter design by bilinear transformation Bilineare Transformation 104
3.1.14 Causality Kausalität und Stabilität im z-Bereich 31 3.4.3.2 Filter pre-warping Pre-Warping der Eckfrequenzen 107
3.1.14.1 Examples Beispiele 31 3.4.3.3 Example bilinear transformation Beispiel Bilineare Transformation 108
3.1.14.2 Examples Impulse response and pols Beispiele Impulsantwort und Polstellenverteilung 32 3.4.3.4 Some bilinear filter transformation Bilineare Transformation Filter Umformungen 109
3.1.15 Structure of digital filters Aufbau Filter 33 3.4.4 Filter transformation Filtertransformationenen 110
3.1.15.1 Polynomial form Polynomform 33 3.4.4.1 Basics Grundlagen 110
3.1.15.2 Modification to direct form II Direktform II und Direktform II 36 3.4.4.2 Low-pass >>> High-pass transformation TP>>HP Transformation 111
3.1.15.3 Example: IIR- filter transformation in product form
Beispiel Umwandlung in Produktform 38 3.4.4.3 Low-pass >>> Pass-band transformation TP>>BP Transformation 112
3.1.15.4 Partial fraction form Parrtialbruchform 39 3.4.4.4 Low-pass >>> Bandstop transformation TP>>BS Transformation 113
3.2 FIR Filter FIR Filter 42 3.5 Non linear effects Nichtideale Effekte 114
3.2.1 Properties of FIR filters Eigenschaften von FIR-Filtern 42 3.5.1 Reasons for non linear effects Ursachen für nichtideale Effekte 114
3.2.1.1 Examples Beispiele 43 3.5.2 Number formats Zahlenformate 115
3.2.1.2 Transfer function Übertragungsfunktion 45 3.5.2.1 Fix point numbers in two's complement Festkomma Zahlen im Zweierkomplement 115
3.2.1.3 Relation between number of zeros and transfer Zusammenhang
function zwischen Nullstellen und Übertragungsfunktion
46 3.5.2.2 Floating point numbers Gleitkomma Zahlen 116

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-2


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
Content
3.5.2.2 Floating point numbers Gleitkomma Zahlen 116
3.5.3 Clipping and overflow Sättigung und Überlauf 117
3.5.4 Filter implementation Filteraufbau 118
3.5.4.1 Floating point filter implementation Filteraufbau in Gleitkommadarstellung 118
3.5.4.2 Fix point filter implementation Filteraufbau in Festkommadarstellung 118
3.5.4.3 Quantization errors caused by multiplication Quantisierungsfehler bei der Multiplikation 118
3.5.4.4 Rounding Runden 119
3.5.4.5 Truncation Abschneiden 119
3.5.4.6 Overflow of FIR filters in case of addition of individual
Überlaufresults
bei der Addition von Einzelergebnissen bei FIR-Filtern
120
3.5.4.7 FIR filter coefficient scaling Koeffizientenskalierung bei FIR-Filtern 122
3.5.4.8 IIR filter coefficient scaling Koeffizientenskalierung bei IIR-Filtern 123
3.5.5 Small limit cycles Kleine Grenzzyklen 124
3.5.6 Word length reduction of filter coefficients Wortlängenreduktion bei Koeffizienten 125
3.5.6.1 Cascade structure Kaskadenstruktur 126
3.5.6.2 Pole thinning Polausdünnung 130
3.5.6.3 Pole sensitivity Polsensitivität 132
3.5.6.4 Example: Conversion of 2nd order IIR-filter Beispiel 133
3.5.6.5 Parallel structure Parallelstruktur 134
3.5.6.6 Example transformation in parallel structure Beispiel Umwandlung in Parallelstruktur 135
3.5.7 Summary Zusammenfassung nichtidealer Effekte bei Filtern 137
3.6 Multi-demensional filters Mehrdimensionale Filter 138
3.6.1 Two-dimensional sampling Zweidimensionale Abtastung 138
3.6.2 Two dimensional spectrum Zweidimensionale Spektren 139
3.6.2.1 Example Beispiel 140
3.6.2.2 Two dimensional diagonal filter 2 dimensionales Diagonalfilter 141
3.7 Matlab Filter Design Toll Matlab Filter Design Toll 142
3.8 Annex Anhang 185
3.8.1 Bibliography Literartur 185
3.8.1 Exercises Übungen 186

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-3


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.1 History Of Digital Filters

• The theoretical background of digital filters became just known at the beginning of the 70s of last century.

• But just with introduction of digital signal processors (DSP) digital filters were introduced in electronics.

• In the following chapter only causal LTI (Linear Time Invariant) systems are considered, which can be described by
real coefficients.

• In principle all digital systems can be described as linear difference equations.

• In general terms it doesn’t make a difference to describe a LTI-System or a LTI-Filter.


In the following chapter we will focus on systems (filters) which:
– change the frequency response
– differentiate or integrate an signal

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-4


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.2 Different Filter Types

H ( jω ) H ( jω )

−ω g ωg ω −ω g ωg ω

Low-Pass High-Pass

H ( jω ) H ( jω )

−ω go −ω gu ω gu ωgo ω −ωgo −ωgu ωgu ωgo ω

Band-Pass Band-Stop

• Filters with such a shape can‘t be realized in practice:


− In time domain an infinite number of samples would be necessary to realize such a steep slope in frequency domain.
− A flat frequency response over the complete frequency range can’t be realized.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-5


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• Rectangular amplitude frequency responses can‘t be realized.
• Therefore a transition range between pass-band and rejection-band is defined.
• Tolerance scheme:
– Deviations in the pass-band and rejection-band the amplitude frequency responses can change -ripple mark-
(Rippel).
– The frequency range is typically defined in the range from 0 to half the sampling frequency (0 to fs/2) since the
frequency is repeated then.
• With smaller tolerances the filter order increases. This affords a higher implementation effort filter more complex.

H ( jω ) H ( jω )

−ω g ωg ω −ω g ωg ω

H ( jω ) H ( jω )

−ωgo −ω gu ωgu ωgo ω −ω go −ω gu ωgu ω go ω


Real Filters

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-6


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• Differentiator H ( jω ) arg { H ( jω )}
H( jω) = j ⋅ ω
+90°

0,5 ⋅ ωs ω 0,5 ⋅ ωs ω

• Integrator
1 H ( jω ) arg { H ( jω )}
H( jω) =
j ⋅ω

−90°
0,5 ⋅ ωs ω 0,5 ⋅ ωs

• Allpass-Filter H ( jω ) arg { H ( jω )}
• Constant amplitude frequency
response, 0,5 ⋅ ωs ω
1
Frequency dependant phase

0,5 ⋅ ωs ω

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-7


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.3 Signal Representation in Time Domain
• In the following chapter we will focus on the most important part of digital signal processing: Digital Filters
• We start with a sampled signal x[n].

T = 1/fS
Digital
Digitale
ADC Signal-
Signal DAC
x(t) x[n] Processing
verarbeitung y[n] y(t)
Digital - Postfilter
Prefilter Sampling Analog -
Analog
Digital
Converter
Converter
Scheme Of A Digital Signal Processing Unit

• We assume that the sampling theorem is fulfilled. The sampling period T is normalized to 1, so that for the sampled
signal we can write x[n]:
+∞
x (t ) ⋅ ∑ δ (t − nT ) = x(n ⋅ T ) ≜ x[n]
n =−∞

– The output sequence y[n] corresponds to the processed input sequence x[n].
– y[n0] at sample point n0 is the result of any input samples x[n].
– Due to practical consideration values n > n0 are excluded. (Otherwise the output signal would be based on future
input samples!).

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-8


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.4 FIR- and IIR-Filters

• In principle we can distinguish between the following filter types:


– Finite Impulse Response (FIR) filter
– Infinite Impulse Response (IIR) filter (recursive filter)

• Example: FIR-filter
1 1 1
y[n] = x[ n] + x[n − 1] + x[n − 2]
4 2 4

– In case of FIR filters, the output values depends on 3 input samples, which are generated at the same point in time
x[n] and two from previous sample points: x[n-1] and x[n-2]. That’s a non-recursive system.

• Example: IIR-Filter

y[n] = x[n] + 1,5 ⋅ y[n − 1] − 0,9 ⋅ y[n − 2]


• In this example the output value y[n] not only depends on the input value(s), but also on previous output values.
That’s a recursive system.
• In the following we will only consider linear and time-invariant systems (not non-linear ones and such systems which
change with the time).

• FIR-filters are used, when a linear phase response is required (linear phase response constant group delay!).
• When step filter shapes are required and a linear phase response isn´t so important. Then IIR-Filters are used,
because the IIR-filters are not so complex, what reduces the needed processing power.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-9


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
FIR-filter
• Can be realized with linear phase response.
• Magnitude and phase in pass band are independent from each other.
• Are always stable.
• Remain also stable in case of quantization errors.
• Have a much higher order compared with IIR filters (more complex)
– Higher processing power needed
– More complex design methods

IIR-Filter
• Have with comparable filter characteristic a lower order than FIR filters.
• Essentially lower processing power necessary.
• No linear phase response ( no constant group delay)
• Can already be designed as instable systems!
• Can get instable in case of quantization errors (fix point processors)
• In case of fix point implementation IIF filters have higher noise level from scaling and rounding.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-10


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.5 Linear Difference Equation (Differenzgleichung)

The relation between input- and output sequence x[n] and y[n] is described by the difference equation

• This linear difference equation has constant coefficients:


N M
y[ n] = ∑a
k =1
k y[ n − k ⋅ T ] + ∑b
k =0
k x[ n − k ⋅ T ]

• With T=1:
N M
y[ n] = ∑ ak y[n − k ] +
k =1
∑b
k =0
k x[ n − k ]

• The coefficients ak, bk are real coefficients (not complex) and N as well as M are positive integer numbers.
• In case of causal systems (filters) y[n] must consist of input samples from the same point of time x[n] or of previous
samples x[n-1] , x[n-2]Tand y[n-1], y[n-2]T;

• Example 2nd. order filter


y[n] = b0 ⋅ x[n] + b1 ⋅ x[n − 1] + b2 ⋅ x[n − 2] + a1 ⋅ y[n − 1] + a2 ⋅ y[n − 2]

The filter order corresponds to the highest number of delays in the filter.
In the example above the order is 2nd

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-11


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.6 LTI-Systems (Linear Time Invariant) X1(n)
X2(n)
+ F {x(n)} y(n)
• 3.1.6.1 Linearity
X3(n)
A system is linear when the response to a linear combination of several
input signals is identical to the linear combination of the different system
responses. F {x(n)}
X1(n)
y1[n] = FF { x1[n]}
y [n] = a ⋅ y1[n] + b ⋅ y2 [ n] = F {a ⋅ x1[ n] + b ⋅ x2 [n]} X2(n) F {x(n)} +
y2 [ n] = F { x2 [n]} y(n)
X3(n) F {x(n)}

• Example Linear System: Linearity

y[ n] = a ⋅ x[n] + b ⋅ x[n − 1] + c ⋅ x[n − 2]

• Example Nonlinear System:

y[n] = x[n]

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-12


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.6.2 Time Invariance x(n )

A system is time-invariant when an input signal delay by several


samples delays the output signal by the same number of samples. n
x(n )

• Example time-invariant systems:


y[ n] = a ⋅ x[n] + b ⋅ x[ n − 1] + c ⋅ x[ n − 2] y(n )
Delay by m samples: y(n )

x[ n] → x[n − m ]; x[ n − 1] → x[ n − 1 − m]...
since : y[n − m ] = a ⋅ x[ n − m ] + b ⋅ x[ n − 1 − m] + c ⋅ x[ n − 2 − m ] n
Time-invariant System
• Example of a non time-invariant system:
Time Invariance
y[n] = n ⋅ x[n]
since : y[ n − m] = n ⋅ x[ n − m] ≠ [n − m] ⋅ x[ n − m]

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-13


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.7 Discrete Convolution (Diskrete Faltung)
δ [(n])
• 3.1.7.1 Rules
1 δ ( n)

• Dirac Impulse
1 für n = 0
δ [ n] = 
0 für n ≠ 0
Dirac Impulse n
• Jump Sequence (Sprungfolge)

1 für n ≥ 0 σ [(n])
σ [n] = 
0 für n < 0 1

• Convolution (Faltung)

y[ n] = x[ n] ∗ h[n] = ∑ x[k ] ⋅ h[n − k ]
k =−∞
Jump Sequence n
• Each data sequence x[n] can be expressed as:

x[n] = ∑ x[k ] ⋅ δ [n − k ]
k =−∞

• A linear, time-invariant system responds to an input sequence x[n] with the output sequence y[n], which consists of
the responses to the each delayed input signal.
∞ ∞
y[ n ] = ∑
k =−∞
x[ k ] ⋅ h[ n − k ] = x[ n ] ∗ h[ n ] = h[ n ] ∗ x[ n ] = ∑ h[k ] ⋅ x[n − k ] = .... h[0] ⋅ x[n] + h[1] ⋅ x[n − 1] + h[2] ⋅ x[n − 2]....
k =−∞
causal

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-14


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.7.2 Example Discrete Convolution:

y[n] = x[n] ∗ h[n]


1. Replace the discrete variables n by summation variable k:
x[n] → x[k ]; h[n] → h[k ]
2. Mirror h[k] at the y axis: h[k] h[-k]:

h[k ] → h[− k ]
3. Shift h[-k] by n samples h[n-k]:
h[−k ] → h[−k + n] = h[n − k ]
4. Multiply x[k] with h[n-k]:

x[k ] ⋅ h[n − k ]
5. Sum up x[k] h[n-k] over all k y[n]:

y[n] = ∑ x[k ] ⋅ h[n − k ] = x[n] ∗ h[n]
k =−∞

• The length of the output signal y[n] is:

length {y[n]} = length {h[n]} + length {x[n]} - 1

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-15


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• Example Discrete Convolution: x[n]
1
1 for n ≥ 0
x[n] = σ [n] = 
0 for n < 0

and n
a n
for n ≥ 0, 0 ≤ a <1 h (n )
h[n] =  1
0 for n < 0

It follows:
n n
y[n] = ∑a
k =−∞
k
⋅ σ [n − k ] = ∑ a k
k =0
n
x(-k-2 )
0 for n < 0 1

⇒ y[ n] =  n k 1 − a n +1
∑ a = 1 − a for n ≥ 0,
 k =0
Bsp.: a = 0,5 k
0 x(-k+ 3
y[0] = ∑ 0,5k = 0,50 = 1 1
k =0
1
y[1] = ∑ a k = 0,50 + 0,51 = 1,5
k =0
2 k
y[2] = ∑ a = 0,5 + 0,5 + 0,5 = 1, 75
k 0 1 2
y(n )
k =0


n
1 − 0,5n +1
y[ n] = ∑ a = 0,5 + 0,5 + … 0,5 =
k 0 1 n

k =0 1 − 0,5
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-16
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.8 Impulse Response

The answer of a system to an input impulse is called impulse response.

y[n] = F { x[n]}
⇒ h[n] = F {δ [n]}

• The impulse response of an non recursive LTI system of order N is identical with the coefficients of the difference
equation.
• Knowing h[n] of a LTS system it’s directly possible to describe the impulse response to any input sequence x[n] .

• 3.1.8.1 Example Impulse Response:

y[ n] = x[ n] + 0,8 y[n − 1]
1 δ (n) 1 h ( n)
with y[−1] = 0

h[0] = δ [0] + 0,8 ⋅ y[ −1] = 1


h[1] = δ [1] + 0,8 ⋅ y[0] = 0,8
h[2] = δ [2] + 0,8 ⋅ y[1] = 0,82 n n
h[3] = δ [3] + 0,8〈 y[2] = 0,8 3

Example Impulse Response



h[n] = δ [n] + 0,8 ⋅ y[n − 1] = 0,8n

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-17


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.8.2 Example Impulse Response of a FIR-filter
1
y[ n] = 1 ⋅ x[n] + ⋅ x[n − 1] + 2 ⋅ x[n − 2]
2
 1 
h[ n] = {h0 , h1 , h2 ,} = 1, ; 2 
 2 
h0 = 1 + 0 + 0 = 1
h1 = 0 + 0,5 + 0 = 0,5
h2 = 0 + 0 + 2 = 2
h3 = 0
h4 = 0

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-18


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.9 Causality

• A system is causal when an response to an input sequence is zero as long as the input sequence is also zero.

• For causal systems the discrete convolution is simplified to:



y[n] = x[n] ∗ h[n] = ∑ x[k ] ⋅ h[n − k ]
k =0

x[n] x[n]

n n

y[n] y[n]

n n

Example Causal System Example Non-Causal System

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-19


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.10 Stability

• A system is stable, when the response of a finite (endlich) input sequence remains finite:


k = −∞
h( n) < ∞

• That means that FIR filters must always be stabile.

• In case of IIR filters this kind of stability consideration is only possible via series expansion:
• Previous example:

y[ n] = x[ n] + 0,8 ⋅ y[ n − 1]
with y[ −1] = 0
∞ ∞


n =−∞
h(n) = ∑ h(n) = 1 + 0,8 + 0, 064 + … < ∞
n=0

• In case of IIR filters the stability consideration can also be determined through the positions of the poles (explained
later).

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-20


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.11 Digital Signal Processing Components
• For representation of a digital signal processing networks just the following elements are necessary:

• A digital network is described according to the difference equation:


– Delay line
– Multiplier and
– Adder / Subtracter

x1(n)

x2(n) +
y(n) = x1(n) + x2(n) + x3(n)
x3(n)
Adder / Subtracter

x (n) T y(n) = x (n-1)


Digital Delay Element

x(n) ai y(n) = ai x(n)


Multiplier

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-21


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.12 System Description In Frequency Domain
• As well as in analog area, a digital system is explicitly (eindeutig) described by it’s impulse response h[n].
• This way it’s possible to determine the response to any input signal.
• In similarity to the analog view the description of the system is easier in the frequency (Systembetrachtung).

• 3.1.12.1 Transfer Function (Übertragungsfunktion)


• The transfer function is derived from the impulse response h[n], when choosing the circular function (Kreisfunktion) as input
signal:

x[ n ] = e j ⋅2⋅π ⋅ f ⋅n
∞ ∞
⇒ y[ n ] = x[ n ] ∗ h[ n ] = ∑ h[ k ] ⋅ e j ⋅ 2⋅π ⋅ f ⋅( n − k )
=e j ⋅ 2⋅π ⋅ f ⋅n
⋅ ∑ h[ k ] ⋅ e − j ⋅2⋅π ⋅ f ⋅k
k =0 k =0

H(f )

• The infinite series (unendliche Reihe) is consisting of complex terms and a complex limit (Grenzwert) with independent
variable f.

H ( f ) = ∑ h[k ] ⋅ e − j ⋅2⋅π ⋅ f ⋅k
k =0

• This way:
x[n] = e j ⋅2⋅π ⋅ f ⋅n ⇒
y[n] = H ( f ) ⋅ e j ⋅2⋅π ⋅ f ⋅n

• This means, that a LTI-System responds to a complex input circular function with frequency f also with a complex circular
function of same frequency, but with different amplitude and phase.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-22


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• Amplitude Frequency Response

H ( jω ) = H ( jω ) ⋅ e jϕ ( H ( jω ) )

H ( jω ) = Re { H ( jω )} + Im { H ( jω )}
2 2

• Phase Response

 Im( H ( jω ))   Im(numerator [ H ( jω ) ])   Im(denominator [ H ( jω ) ]) 


∡ ( H ( jω ) ) = ϕ (ω ) = arctan   = arctan   − arctan  
 Re( H ( jω ))   Re(numerator [ H ( jω ) ])   Re(denominator [ H ( jω ) ]) 

• Group Delay

dϕ (ω ) 1 dϕ ( f )
τ gr = − =− ⋅
dω 2 ⋅π df

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-23


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.12.2 Example Frequency Response FIR-filter
x[n]

1 1 1
y[n] = x[n] + x[ n − 1] + x[ n − 2]
4 2 4
1 1 1
h[ n] = δ [n] + δ [ n − 1] + δ [ n − 2]
4 2 4

1 1 1
H ( f ) = ∑ h[ k ] ⋅ e − j ⋅2⋅π ⋅ f ⋅k = + e − j ⋅2⋅π ⋅ f ⋅1 + e − j ⋅2⋅π ⋅ f ⋅2 y[n]
k =0 4 2 4 f

1 1 1 
= e − j 2π f  e + j 2π f + + e − j 2π f 
4 2 4  H(f )
1
= e − j 2π f 1 + cos ( 2 π f ) 
2

1
H( f ) = 1 + cos ( 2 π f ) 
2

∠H(f ) f
Im  − sin 2 π f 
ϕ ( f ) = arctan = arctan   = − arctan {tan 2 π f } = −2 π f
Re  cos 2 π f 

dϕ (ω ) 1 dϕ ( f ) 1
TGr = − =− =+ 2π = 1 f
dω 2π df 2π

FIR-filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-24


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics

3.1.13 z-transform
Im
• The z-transform is an extension of the discrete Fourier-Transform to
complex frequencies, same as the Laplace-Transform, is an extension in the
z
analog area.
• Advantage of z- and Laplace-transform is an easy description (with zeros
and poles) of the transfer function.
• the advantage of the z-transform is the representation of the recursive
system with an infinite sequence of sampled values in an limited area
(geschlossen beschreiben). Re
• This way there is a correspondence between z- and Laplace-transform.
• In principle it’s possible to distinguish between:
– unilateral (einseitiger) and
– bilateral (zweiseitiger) z-transform.
• The general form (bilateral) of the z-Transform is given:
Convergence Area Of Bilateral Z-Transform

X ( z) = ∑ x[n] ⋅ z
n =−∞
−n

• The z-Transform consists of an infinite series and converges for each signal
in a certain conversion-area of the z-plane, which is hatched.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-25


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• For causal systems, by means: x[n]=0, n<0:
z
∞ Im
X ( z) = ∑ x[n]⋅ z
n =0
−n

• 3.1.13.1 Unilateral z-transform


• In case of the unilateral z-transform this convergence area is enlarged to the
complete z-plane outside of the inner convergence radius.
• While the definition range of H(f) only corresponds to the unit circle Re
(Einheitskreis) , H(z) - as function of the complex variable z - is an extension in
the complete complex area.
• That means that H(f) is identical to H(z) on the unit circle.

H ( f ) = H ( z ) z =esT Convergence Area Of Unilateral Z-


Transform
• For the z-transform of the impulse response – by means the system function –
we can write:


H ( z) = ∑ h [ n] ⋅ z
n =−∞
−n

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-26


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.13.2 Examples

x[ n] = δ [ n]

⇒ X ( z) = ∑ δ [n] ⋅ z
n =0
−n
= 1 ⋅ z −0 = 1

The system converts for all z.

Example:
1 for 0 ≤ n ≤ 3
x[n] = 
0 else

⇒ X ( z) = ∑ x[n]⋅ z
n =0
−n
= 1⋅ z 0 + 1⋅ z −1 + 1⋅ z −2 + 1⋅ z −3

The system converts for all z except z=0.

Example:

a n for n ≥ 0
x[n] = 
0 else
∞ ∞
X ( z ) = ∑ a n ⋅ z − n = ∑ ( a ⋅ z −1 ) =
n 1
n=0 n =0 1 − a ⋅ z −1

X(z) is an infinite geometric series (geometrischen Reihe); this series converts for |(a z-1)|<1.
Convergence is given outside the circle with radius a.

a ⋅ z −1 < 1 ⇔ a < z

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-27


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.13.3 Rules of z-transform

Displacement Law (Verschiebungssatz)

A displacement by k sample periods means a multiplication in z-areas by z-k:

x[n] ↔ X ( z ) ⇒ x[n − k ] ↔ X ( z ) ⋅ z − k

x[n] ↔ X ( z )
x[n − 1] ↔ X ( z ) ⋅ z −1
x[n − 2] ↔ X ( z ) ⋅ z −2
x[n − k ] ↔ X ( z ) ⋅ z − k

Linearity Law

• Sum of linear difference equations corresponds to a sum of corresponding system function in the Z-Domain.

x1[n] ↔ X 1 ( z ) and x2 [n] ↔ X 2 ( z )


x3[n] = a ⋅ x1[n] + b ⋅ x2 [n]
⇒ x3 [n] ↔ X 3 ( z ) = a ⋅ X 1 ( z ) + b ⋅ X 2 ( z )

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-28


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.13.4 Examples of various z-transforms

x[n] X [z] Convergence

1 n=0 1 z plane
δ [ n] = 
0 sonst

1 für n ≥ 0 1
σ [ n] =  z >1
0 sonst 1 − z −1

a n für n ≥ 0 1
a ⋅ σ [ n] = 
n
z > a
0 sonst 1 − a ⋅ z −1

a ⋅ z −1
z > a
n ⋅ an (1 − a ⋅ z ) −1 2

sin ( 2 ⋅ π ⋅ f 0 ⋅ n ⋅ T ) ⋅ z −1
sin ( 2 ⋅ π ⋅ f 0 ⋅ n ⋅ T ) z >1
1 − 2 ⋅ cos ( 2 ⋅ π ⋅ f 0 ⋅ n ⋅ T ) ⋅ z −1 + z −2

cos ( 2 ⋅ π ⋅ f0 ⋅ n ⋅ T ) 1 − cos ( 2 ⋅ π ⋅ f 0 ⋅ n ⋅ T ) ⋅ z −1
z >1
1 − 2 ⋅ cos ( 2 ⋅ π ⋅ f 0 ⋅ n ⋅ T ) ⋅ z −1 + z −2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-29


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.13.7 z - transform applied on difference equations
• From the difference equation y[n] the system function H(z) or transfer function is derived:
N M
y[n] = ∑ ak y[n − k ] + ∑b k x[n − k ]
k =1 k =0

վ
N M
Y ( z) = ∑ ak Y ( z) ⋅ z − k +
k =1
∑b
k =0
k X ( z) ⋅ z −k
recursive part nonrecursive part

 N
−k 
M
⇔ Y ( z ) ⋅ 1 − ∑ ak ⋅ z  = X ( z ) ⋅ ∑ bk ⋅ z − k
 k =1  k =0
M

∑b ⋅ z k
−k

⇔ Y ( z) = X ( z) ⋅ k =0
N

1 − ∑ ak ⋅ z −k

k =1
M

Y (z) ∑b ⋅ z k
−k

H (z) = = k =0
N
X ( z)
1 − ∑ ak ⋅ z − k
k =1

• The system function is a rational function of z-1.


• It can be described only by the coefficients of the difference equation ak, bk . This kind of system function is called
polynomial form.
• In case of non-recursive systems all ak=0. Recursive systems have at least one coefficient in denominator ak≠0.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-30


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.14 Causality and stability in z-domain

A stable system requires that the convergence range in the z-domain includes the unit circle and that all poles
are within this unit circle.

• Knowledge of poles is necessary: The system function H(z) can be transformed in the product form:
M M M M

∑ bk ⋅ z − k z − M ∑ bk ⋅ z − k ⋅ z M z − M ∑ bk ⋅ z M −k z − M ⋅ ∑ bM − k ⋅ z k
z − M Z '( z )
H (z) = k =0
= k =0
= k =0
= = −N ⋅
k =0
N −1
N
 N N N −N  N
N
N −k  −N  N k z N '( z )
1 − ∑ ak ⋅ z −k
z−N  z − ∑ ak ⋅ z ⋅ z  z  z − ∑ ak ⋅ z  z ⋅  z − ∑ aN − k ⋅ z 
−k

k =1  k =1   k =1   k =0 

zz
Example stable filter:
1 x
H (z) = z P = 0, 7 1
1 − 0, 7 ⋅ z −1 n

• Stable, since pole is inside of unit circle

Example instable filter:


zz
1
H ( z) = z P = 1, 2
1 − 1, 2 ⋅ z −1
x
1

• Unstable, since pole is outside of unit circle n

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-31


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics

• 3.1.14.2 Examples impulse response and poles

h(n)

x 1

x Re

Im
h(n)
x 1

Re
x
n

Im
h(n)
x
1

Re
x

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-32


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.15 Structure of digital filters
• 3.1.13.1 Polynomial form
N M
y[n] = ∑ ak y[n − k ] +
k =1
∑b
k =0
k x[n − k ]

• The first sum of the difference equation is called recursive term and the second one non-recursive term.
• This filter represents a recursive and non-recursive system.

Digital Filter Structure In


Polynomial Form

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-33


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics

N M
Y (z) ∑b ⋅ z k
−k

y[n] = ∑ ak y[n − k ] + ∑ bk x[n − k ] ↔ H ( z) = = k =0


N
X ( z)
k =1 k =0
1 − ∑ ak ⋅ z − k
k =1

Other Representation Of
Delay Elements

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-34


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• This way non-recursive systems are subset of recursive ones.
• Non-recursive systems are stable per definition, while recursive systems need to be checked whether they are
stable.
• The impulse response is given by:
N M
h[n] = ∑ ak ⋅ y[n − k ] +
k =1
∑b
k =0
k ⋅ δ [n − k ]

A system should not consist of delay-free loops.

• Example: Recursive Systems of 2nd. Order • Example: Recursive System, which can not be
(can be realized) realized transformation necessary
y[n] = x[n] + a1 ⋅ y[n − 1] + a2 ⋅ y[n − 2] y[n] = x[n] + a1 ⋅ y[n] + a2 ⋅ y[n − 1]

+ +
x[n] y[n] x[n] y[n]

a1 a1

T T

a2 a2

Recursive System 2nd Order Not Feasible

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-35


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
3.1.13.2 Modification to Direct Form II

N M
b0 + y [n] = ∑a k y[n − k] + ∑b k x[n − k]
x[n] z-1 z-1 y[n]
k =1 k =0
b1 a1
+
Direct Form II z-1 z-1
b2 + a2

bM-1 + aN-1
z-1 z-1
bM + aN

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-36


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
u[n]
b0 + +
x[n] z-1 z-1 y[n]

b1 a1
+ +
z-1 z-1
Direct Form
b2 + + a2 N M
y [n] = ∑ a y [n − k] + ∑ b x [n − k]
k k
k =1 k =0

vereinfachte Annahme N = M
bM-1 + + aN-1 N

z-1 z-1 y [n] = ∑ a y [n − k] + u [n]


k
Non-Recursive Recursive k =1
Filter Part bM + + aN Filter Part M
u [n] = ∑ b x [n − k]
k
x[n] + b0 + y[n] k =0
z-1 z-1
a1 b1
+ +
2nd Canonical z-1 z-1
Direct Form + a2 b2 +

+ aN-1 bM-1 +
z-1 z-1
+ aN bM +
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-37
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
• 3.1.13.3 Example: IIR-Filter-Transform In Product Form
• Filter in polynomial form
Y ( z) 1
H ( z) = =
X ( z ) 1 − 1,5 ⋅ z + 1⋅ z −2 − 0, 25 ⋅ z −3
−1

⇔ Y ( z ) − 1,5 ⋅ Y ( z ) ⋅ z −1 + Y ( z ) ⋅ z −2 − 0, 25 ⋅ Y ( z ) ⋅ z −3 = X ( z )
վ
y[n] = 1,5 ⋅ y[n − 1] − y[n − 2] + 0, 25 ⋅ y[n − 3] + x[n]
• Transform on product form
1 z3
H ( z ) = −3 3 =
z ( z − 1,5 z 2 + z − 0, 25 ) ( z − 0,5) ⋅ ( z 2 − z + 0,5 )
1
=
(1 − 0,5 ⋅ z −1 ) ⋅ (1 − z −1 + 0,5 ⋅ z −2 )
zP1 = 0,5
zP 2 = 0,5 + j 0,5; zP 3 = 0,5 − j 0, 5
1 1
H ( z) = ⋅
1 − 0,5 ⋅ z −1  1 − (0,5 + j 0,5) z −1  ⋅ 1 − (0,5 − j 0,5) z −1 
1 1
= −1
⋅ −1 −2
1 − 0, 5 ⋅ z  1 − z + 0,5 z

= H1 ( z ) ⋅ H 2 ( z )
H1 ( z ) ↔ y[n] = x[n] + 0,5 y[n − 1] Transformation Polynomial Product Form
H 2 ( z ) ↔ y[ n] = x[n] + 1y[n − 1] − 0,5 y[n − 2]

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-38


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics

• 3.1.13.4 Partial Fraction Form (Partialbruchform)


• A system function in polynomial form can be transformed in partial fraction form:

M
H1 ( z )
∑b ⋅ z k
−k
N
ki
H ( z) = k =0
= K0 + ∑ −1
i =1 1 − z P ⋅ z
N
H 2 ( z)
1 − ∑ ak ⋅ z − k
k =1

T.
The coefficients Ki are still unknown and have to be defined.
• The coefficient K0 is defined by limit analysis (Grenzwertbildung): H k ( z)

K 0 = lim H ( z )
z →0

• Computation of Ki (see example):


– Set up of H(z) in product form and in general partial fraction form.
– For definition of coefficients Ki both sides are multiplied with (1-zpi/z).
– Since H(z) has in denominator the factor (1-zpi/z), this term will be reduced (herausgekürzt).
– Ki is obtained by replacement of z = zpi.

• Example:
1 1 j j
H ( z) = = − +
1 − 1,5 ⋅ z + 1⋅ z −2 − 0, 25 ⋅ z −3
−1
(1 − 0,5 ⋅ z ) (1 − (0,5 + j 0,5) ⋅ z ) (1 − (0,5 − j 0,5) ⋅ z −1 )
−1 −1

Polynomial form
Partial fraction form

1⋅ 0,5n − j ⋅ (0,5 + j 0,5)n + j ⋅ (0,5 − j 0,5)n n≥0


h ( n) = 
0 else

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-39


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.1 Basics
(1 − 0,5 ⋅ z −1 ) 1 −1 K1 (1 − 0,5 ⋅ z −1 ) K 2 (1 − 0,5 ⋅ z −1 ) K 3 (1 − 0,5 ⋅ z −1 )
1) ⋅ = K 0 (1 − 0,5 ⋅ z ) + + + z = z = 0,5
1 − 0,5 ⋅ z −1  1 − (0,5 + j 0,5) z −1  ⋅ 1 − (0,5 − j 0,5) z −1  (1 − 0,5 ⋅ z −1 ) (1 − (0,5 + j0,5) ⋅ z −1 ) (1 − (0,5 − j0,5) ⋅ z −1 ) p1
1
⇔ = K1
  0,5 + j 0,5     0,5 − j 0,5  
1 −  ⋅ 1−
0,5     0,5  
 
1
⇔ = K ⇔ K =1
[ j ] ⋅[− j ] 1

1 1 − (0,5 + j 0,5) z −1 


2) ⋅ = K 2 z = z p 2 = 0,5 + j 0,5
1 − 0,5 ⋅ z −1  1 − (0,5 + j 0,5) z −1  ⋅ 1 − (0,5 − j 0,5) z −1 
⇒ K 2 = − j; K3 = j

Y (z) 1 j j
H ( z) = = − +
X ( z ) (1 − 0,5 ⋅ z ) (1 − (0,5 + j 0,5) ⋅ z ) (1 − (0,5 − j 0,5) ⋅ z −1 )
−1 −1

1 a n n≥0
X ( z) = ↔ x ( n ) = 
1 − a ⋅ z −1 0 else
H1 ( z )
1 ⋅ 0,5n − j ⋅ (0,5 + j 0,5) n + j ⋅ (0,5 − j 0,5) n n≥0
⇒ h( n) = 
0 else
H 2 ( z)

T.
H k ( z)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-40


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
FIR-filter (Non-Recursive Filter)

3.2.1 Properties of FIR-filters


• When all denominator coefficients in the system function are set to zero, an non-recursive filter (FIR-filter) is obtained.
• In case of causal, Non-Recursive Filters, the output sequence only depends on present and previous input samples.
• The impulse response of a Non-Recursive System or Filter consists of a finite number of output impulses. Therefore
these systems are also called FIR (Finite Impulse Response)-Filter.

FIR-filters of order M have M zeros and also m poles but at the zero-point (Ursprung).

M M M ∑b k ⋅ z M −k
y [ n] = ∑ bk ⋅ x [ n − k ] ↔ H ( z ) = ∑ bk ⋅ z − k = z − M ∑ bk ⋅ z M − k = k =0

k =0 k =0 k =0 zM

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-41


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.1.1 Example a)
• Please check whether the following filter is a FIR or IIR-Filter?

1 − z −2 − 5 ⋅ z −3 − z −4 − 2 ⋅ z −5
H ( z) =
1 − 2 ⋅ z −1
• Check whether numerator and denominator have common poles and zeros!

1 − z −2 − 5 ⋅ z −3 − z −4 − 2 ⋅ z −5 z ⋅ ( z − z − 5 ⋅ z − z − 2 )
−5 5 3 2

H ( z) = =
1 − 2 ⋅ z −1 z −5 ⋅ ( z 5 − 2 ⋅ z 4 )

(z 5
− z 3 − 5 ⋅ z 2 − z − 2 ) : ( z 5 − 2 ⋅ z 4 ) = 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + z −3 + z −4

• FIR-filter, because denominator-polynomial fully disposes.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-42


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Example b)
• Check whether the following filter is a FIR or IIR-Filter!
1 − z −1 + z −2 − 3 ⋅ z −3
H ( z) =
z −2 (1 − z −1 )

• Check whether H(z) has common poles and zeroes!

1 − z −1 + z −2 − 3 ⋅ z −3 z ( z − z + z − 3 ) z 3 − z 2 + z − 3
−3 3 2

H ( z) = = =
z −2 (1 − z −1 ) z −3 ( z − 1) z −1
2
 z 3 − z 2 + z − 3 : [ z − 1] = z 2 + 1 −
z −1
−  z 3 − z 2 
z −3
− [ z − 1]
−2
IIR filter since denominator doesn’t totally disappear.
• Calculate the impulse response, is this filter causal or non-causal?

1 z
H ( z) = z + 1 −
2 2 2 ⋅ z −2 mit : z 2 ↔ δ [n + 2] = ↔ σ [n]
z −1 H ( z )* = H ( z ) ⋅ z −2 = 1 + z −2 − 1 − z1 z − 1
z −1 1 ↔ δ [ n] z
վ վ ⋅ z −1 ↔ σ [ n − 1]
z −1 ↔ δ [n − 1] z −1
h[ n] = δ [ n + 2] + δ [n] − 2 ⋅ σ [ n − 1] h[n]* = δ [n] + δ [n − 2] − 2 ⋅ σ [ n − 2] z
Non causal ⋅ z −2 ↔ σ [ n − 2]
z −1
causal

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-43


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.1.2 Transfer function
• The transfer function is derived by replacing z-1 exp{ -j 2 π f t}
M M
H ( z ) = ∑ h[n] ⋅ z − n ⇒ H ( f ) = ∑ h[n] ⋅ e − j ⋅2⋅π ⋅n⋅ f
n=0 n =0

• Transfer function at f = 0 of a FIR-filter corresponds to the sum of all filter coefficients:


M
H (0) = ∑ h[n]
k =0

• The transfer function at half the sampling frequency f = fS/2 corresponds to the sum of all filter coefficients weighted
alternately with +1, -1, +1 T
f
 fS  M − j ⋅2⋅π ⋅n⋅ S M M
H   = ∑ h[ n] ⋅ e = ∑ h[ n] ⋅ e − j ⋅π ⋅n
= ∑ h[ n ] ⋅ ( −1) mit T = 1
n
2

 2  n =0 n =0 n =0

• Multiplication of all filter coefficients with a constant value V just means an multiplication of the transfer function with
V. The frequency characteristic of the filter is not affected.
M

∑ V ⋅ h[n] ⋅ e
n =0
− j ⋅2⋅π ⋅n⋅ f
=V ⋅H( f )

• The impulse response of a FIR-filter is the series of its coefficients. The impulse response length is M+1.
 
 
h[n] = b0 , b1 , b2 …bM 
 M +1 Werte 
• The number of filter coefficients corresponds to the filter order M + 1

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-44


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.1.3 Relation between number of zeros and transfer function
Magnitude Response (dB)

-10

Magnitude (dB) -20

-30

-40

-50

-60

0 5 10 15 20
Frequency (kHz)

Pole/Zero Plot
Filter 5th order
- has 5 zeros 1

- has 5 poles at zero point


- has 6 coefficients 0.5
- has 5 zero points in
Imaginary Part

transfer function
5
0

-0.5

-1
-1 -0.5 0 0.5 1
Real Part

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-45


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Magnitude Response (dB)

-10

-20

Magnitude (dB)
-30

-40

-50

-60

-70
0 5 10 15 20
Frequency (kHz)

Pole/Zero Plot

0.5
Imaginary Part

15
0

-0.5

-1
-1 -0.5 0 0.5 1 1.5
Real Part

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-46


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Magnitude Response
Pole/Zero Plot
1 1

0.8
0.5 Real Part: -0.7299386
Imaginary Part: 0.6835127
Imaginary Part

Magnitude
0.6
2
0
0.4
Real Part: -0.7299386
-0.5 Imaginary Part: -0.6835127
0.2

-1 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
-1.5 -1 -0.5 0 0.5 1 1.5
Normalized Frequency ( ×π rad/sample)
Real Part

a
r
c
c
o
s
R
e
,

,
*

R
e
(
H)z = ( z − zn ) ⋅ ( z − zn ) = z 2 − z ( z n + z n ) + zn ⋅ z n = z 2 − z ⋅ 2 { zn } + zn
2 ω0 = {0 73} = 2 389
R
e

R
e
H ( e jωT ) = e2 jωT − 2 ⋅ e jωT ⋅ { zn } + 1 = e jωT ( e jωT − 2 ⋅ { zn } + e − jωT )
normalized to π

,
c
o
s

R
e

ω0
H (ω ) = 2 ⋅ ωT − { z n } π
= 0 76

T =1
c
o
s

R
e

a
r
c
c
o
s
R
e

H (ω ) = 0 ⇔ ω0 = { zn } ⇔ ω 0
= { zn }

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-47


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Pole/Zero Plot Magnitude Response

1.5
1
1
0.8
Imaginary Part

0.5 Real Part: -4 Real Part: -0.25

Magnitude
Imaginary Part: 0 Imaginary Part: 0
4 0.6
0

-0.5 0.4

-1
0.2

-1.5
0
-4 -3 -2 -1 0 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Real Part Normalized Frequency ( ×π rad/sample)
*

(
H)z = ( z − zn ) ⋅ ( z − zn ) ⋅ ( z − zn 2 ) ⋅ ( z − zn 3 )
'

()
H z
' '

()
H z = z 2 − z ( zn 2 + z n 3 ) + zn 2 ⋅ zn 3 ok

( )
H e jω = e2 jωT − e jωT ⋅ ( zn 2 + zn3 ) + zn 2 ⋅ zn3
'

c
o
s
1

H (ω ) = e jωT
− ( zn 2 + zn 3 ) + e − jωT
= − ( zn 2 + zn 3 ) + 2 ωT
'

a
r
c
c
o
s

H (ω ) = 0 ⇔ ωT =
1
2
{− ( zn2 + zn3 )} zn 2 + z n 3 > 1
c
o
s

R
e

'

H (ω ) = 2 ⋅ ωT − { z n } ⋅ H (ω )

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-48


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

Filter with constant group delay can‘t have group delay distortions, all frequencies of the input signal are equally delayed.

Frequency-response and phase-response of a linear-phase LF filter

• 17 coefficients (M = 17) Order =16

• Zeros are conjugate complex or reciprocally


• Group delay: T=M/2=8

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-49


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

3.2.2 Various FIR-types

h[n] h[n-M/2]

n n

• Length of impulse response M is odd.


• The filter order Order = M-1 (even).
• A linear phase response always means a symmetrical filter.
• Shifting the impulse response by half the filter length makes the filter causal.
• A delay in time domains corresponds to a phase shift in frequency domain.
• The impulse response is symmetrical.
• Corresponding to the filter length the transfer function has M-1 zeros and M-1 poles at the zero point.
• All zeros in the Stop-Band are located on the unit circle.
• The zeros in the Pass-Band are symmetrically located to the unit circle.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-50


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

• 3.2.2.2 Example: M=3 Order =2


1 1 1
h(n) = ⋅ δ (n) + ⋅ δ (n − 1) + ⋅ δ (n − 2)
4 2 4
վ
1
H ( f ) = e− j ⋅2⋅π ⋅1⋅ f ⋅ ⋅ {1 + cos ( 2 ⋅ π ⋅1 ⋅ f )}
2
1
⇒ H ( f ) = ⋅ {1 + cos ( 2 ⋅ π ⋅1 ⋅ f )}
2
• For the phase response::
Im
ϕ ( f ) = arctan = −2 ⋅ π ⋅ f
Re

• For the group delay:


1 dϕ
τ gr = − ⋅ =1
2π df

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-51


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Magnitude Response Pole/Zero Plot
1
1

0.8 0.5

Imaginary Part
Magnitude

0.6 5
0

0.4
-0.5
0.2

0 -1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -1.5 -1 -0.5 0 0.5 1 1.5
Normalized Frequency ( ×π rad/sample) Real Part
5 tap FIR LP filter without real zeros

Pole/Zero Plot
Magnitude Response
1
1

0.5
0.8

Imaginary Part
Magnitude

0.6 5
0

0.4
-0.5

0.2

-1
0
-1.5 -1 -0.5 0 0.5 1 1.5
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Real Part
Normalized Frequency ( ×π rad/sample) 5 tap FIR HP filter without real zeros

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-52


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Magnitude Response Pole/Zero Plot
0.8
1
0.7

0.6 0.5

Imaginary Part
0.5
Magnitude

0.4
5
0

0.3

0.2 -0.5

0.1

0 -1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -1.5 -1 -0.5 0 0.5 1 1.5
Normalized Frequency ( ×π rad/sample) Real Part
5 tap FIR filter with real zeros

Magnitude Response Pole/Zero Plot


1
1.1
1

0.9 0.5

Imaginary Part
0.8
Magnitude

0.7 6
0
0.6
0.5
-0.5
0.4
0.3
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -1.5 -1 -0.5 0 0.5 1 1.5
Normalized Frequency ( ×π rad/sample) Real Part
6 tap FIR filter without real zeros

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-53


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.2.1 Filter for linear phase response Symmetrical coefficients
Impulse Response Magnitude Response (dB)
0.25 Pole/Zero Plot
Odd Number Of Coefficients

0
1
M=7
0.2 -10
0.5

Imaginary Part
-20

Magnitude (dB)
0.15 6
Amplitude

0
-30

0.1
-40 -0.5

0.05 -50
-1
-1.5 -1 -0.5 0 0.5 1 1.5
-60
0 Real Part

0 1 2 3 4 5 6 7 0 0.2 0.4 0.6 0.8


Typ 1 Samples fs/2
Normalized Frequency ( ×π rad/sample)

Impulse Response Magnitude Response (dB)


Pole/Zero Plot
M=8
Even Number Of Coefficients

0
0.26
1
0.24 -10

Imaginary Part
0.5
0.22
-20 7
Magnitude (dB)

0.2 0
Amplitude

0.18 -30
-0.5
0.16 -40
-1
0.14
-50
0.12 -2 -1 0 1
Real Part
0.1 -60

0 0.2 0.4 0.6 0.8 fs/2


0 1 2 3 4 5 6 7
Typ 2 Samples Normalized Frequency ( ×π rad/sample)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-54


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Asymmetrical coefficents
Magnitude Response (dB)
Impulse Response
Odd Number Of Coefficients

Pole/Zero Plot
-20
0.05 1

-30
0.5
-40

Imaginary Part
M agnitude (dB)
4
Am plitude

-50 0
0
-60
-0.5

-70
-1
-80
-1.5 -1 -0.5 0 0.5 1 1.5
-0.05 Real Part
0 5 10 15 20
Typ 3 0 0.5 1 1.5 2 2.5 3 3.5 4 Frequency (kHz)
Samples
Impulse Response Magnitude Response (dB) Pole/Zero Plot
1.5
0.6 0
Even Number Of Coefficients

1
0.4 -10

Imaginary Part
0.5

0.2 -20 7
0
Magnitude (dB)
Amplitude

-30 -0.5
0

-40 -1
-0.2
-1.5
-50
-2 -1 0 1 2
-0.4 Real Part
-60

Typ 4 -0.6
0 0.2 0.4 0.6 0.8
0 1 2 3 4 5 6 7
Samples Normalized Frequency ( ×π rad/sample) fs/2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-55


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.2.1 Linear phase response with odd number of symmetrical coefficients
M −1
 M − 3  M − 1
H ( f ) = ∑ h[n] ⋅ e− j ⋅2⋅π ⋅n⋅ f h h
 2 
n =0
 2 
h[n-M/2]

M −1
M −3 M −3
h[0] h[ M − 1]
 M − 1 − j ⋅2⋅π ⋅ ⋅f 2 2
= h
 2 
⋅e 2
+ ∑ h [ n] ⋅ e
n =0
− j ⋅2⋅π ⋅n⋅ f
+ ∑ h [ L − n − 1] ⋅ e
n =0
− j ⋅2⋅π ⋅( M − n −1) f

• With symmetrical coefficients:


M −3
M −1
 M − 1
∑ h [ n] ⋅ {e }
− j ⋅2⋅π ⋅ ⋅f 2
− j ⋅2⋅π ⋅n⋅ f − j ⋅2⋅π ⋅( M − n −1) f
H( f ) = h ⋅e 2
+ +e
 2  n =0
M −1
 M − 1  − j⋅2⋅π ⋅ 2 ⋅ f
= h ⋅e
 2 
M −3
 − j ⋅2⋅π ⋅n⋅ f + j ⋅2⋅π ⋅ M2−1  f f 
 M −1   M −1 
 2  
2 − j ⋅2⋅π ⋅ − j ⋅2⋅π ⋅ f
+ ∑ h [ n ] ⋅ e ⋅e  
+e + j ⋅2⋅π ⋅n⋅ f
⋅e  ⋅ e  2 

n =0  
M −3
M −1  
− j ⋅2⋅π ⋅ ⋅ f   M − 1 2
  M − 1  
=e ⋅ h   + 2 ⋅ ∑ h [ n ] ⋅ cos  2 ⋅ π ⋅  n − 2  ⋅ f  
2

  2 n=0  
 

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-56


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.2.4 Odd number anti-symmetrical coefficients (M = odd) :
M −3

 − j ⋅2⋅π ⋅n⋅ f + j ⋅2⋅π ⋅ 2  f  − j ⋅2⋅π ⋅ 2  f


M −1  M −1   M −1 
 M −1  − j ⋅2⋅π ⋅ ⋅f 2
+ ∑ h( n) ⋅ e
− j ⋅2⋅π ⋅( )f
H( f ) = h ⋅e
2
⋅e − e+ j ⋅2⋅π ⋅n⋅ f ⋅ e e û
 2  n =0  
M −3
M −1  
− j ⋅2⋅π ⋅ ⋅f   M −1  2
  M − 1  
=e ⋅ h   + 2 ⋅ ∑ h(n) ⋅ sin  2 ⋅ π ⋅  n −  ⋅ f 
2

  2  n=0   2  
 

M −1
h[ n] h[n − ]
2

n n

• Phase response:

Im M −1
ϕ ( f ) = arctan = −2 ⋅ π ⋅ ⋅f
Re 2
• Group delay:

1 dϕ M − 1
τ gr = − ⋅ =
2π df 2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-57


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
h n = {0,5 1 0 −1 −0.5}

H(f ) = e − j⋅2⋅π⋅f ⋅2 {sin ( 2 ⋅ π ⋅ f ⋅ 2 ) + 2 ⋅ sin ( 2 ⋅ π ⋅ f )}

H(f ) = 0,5 + 1⋅ e − j⋅2⋅π⋅f ⋅1 + 0 − 1⋅ e − j⋅2⋅π⋅f ⋅3 − 0,5 ⋅ e − j⋅2⋅π⋅f ⋅4


= e − j⋅2⋅π⋅f ⋅2 {0,5 ⋅ e + j⋅2⋅π⋅f ⋅2 + 1⋅ e+ j⋅2⋅π⋅f ⋅1 + 0 − 1⋅ e− j⋅2⋅π⋅f ⋅1 − 0,5 ⋅ e− j⋅2⋅π⋅f ⋅2 }
= e − j⋅2⋅π⋅f ⋅2 ⋅ j ⋅ {sin ( 2 ⋅ π ⋅ f ⋅ 2 ) + 2 ⋅ sin ( 2 ⋅ π ⋅ f )}
π
= e − j⋅2⋅π⋅f ⋅2 ⋅ e 2 ⋅ {sin ( 2 ⋅ π ⋅ f ⋅ 2 ) + 2 ⋅ sin ( 2 ⋅ π ⋅ f )}
j

Amplitude frequency response

H(f ) = sin ( 2 ⋅ π ⋅ f ⋅ 2 ) + 2 ⋅ sin ( 2 ⋅ π ⋅ f )


π
ϕ ( ω ) = −2 ⋅ π ⋅ f ⋅ 2 +
2
dϕ ( ω)
TGr = − =2

e jx − e− jx e jx + e − jx
sin x = ; cos x =
2⋅ j 2

Phase response

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-58


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.2.5 Even number of coefficients (Symmetrical and anti-symmetrical) M = even

h(n) h(n)

n n

Even coefficient number and symmetrical coefficients

h(n) h(n)

n n

Even coefficient number and anti-symmetrical coefficients

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-59


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Even Number Of Coefficients In General Form:
M M
−1 −1
M −1  + j ⋅2⋅π ⋅ M2−1− n ⋅ f − n ⋅ f 
 M −1 
 
2 2 − j ⋅2⋅π ⋅
∑ h(n) ⋅ {e }=e
− j ⋅2⋅π ⋅( )⋅ f
H( f ) = − j ⋅2⋅π ⋅n⋅ f
±e j ⋅2⋅π ⋅( M −1− n⋅ f ) 2
⋅ ∑ h( n) ⋅ e  
±e  2

n =0 n =0  

• With symmetrical coefficients:


M
M −1 −1
− j ⋅2⋅π ⋅( )⋅ f 2
  M −1  
H( f ) = e 2
⋅ ∑ 2 ⋅ h( n) ⋅ cos  2 ⋅ π ⋅  − n⋅ f 
n=0   2  

• With anti-symmetrical coefficients:


M
M −1 −1
− j ⋅2⋅π ⋅( )⋅ f 2
  M −1  
H( f ) = e 2
⋅ ∑ 2 ⋅ h(n) ⋅ sin 2 ⋅ π ⋅  − n⋅ f
n =0   2  

• Phase response:
Im M −1
ϕ ( f ) = arctan = −2 ⋅ π ⋅ ⋅f
Re 2

• Group delay:

1 dϕ M − 1
τ gr = − ⋅ =
2π df 2
• With sampling period T:
1
τ gr = ( M − 1) ) ⋅ T
2
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-60
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.2.6 Example M=4
• With symmetrical coefficients and M = 4 Order =3:

1 1 1 1
h(n) = − ⋅ δ (n) + ⋅ δ ( n − 1) + ⋅ δ (n − 2) − ⋅ δ ( n − 3)
4 2 2 4

3 3
− j ⋅2⋅π ⋅ ⋅ f 1  1  1  3 
H ( f ) = ∑ h ( n) ⋅ e − j ⋅2⋅π ⋅n⋅ f
=e 2
 ⋅ 2 ⋅ cos  2 ⋅ π ⋅ ⋅ f  − ⋅ 2 ⋅ cos  2 ⋅ π ⋅ ⋅ f 
n =0 2  2  4  2 
 1  1  3 
⇒ H ( f ) = cos  2 ⋅ π ⋅ ⋅ f  − ⋅ cos  2 ⋅ π ⋅ ⋅ f
 2  2  2 

h[n] h[n-3/2]
• For the phase response:

Im 3
ϕ ( f ) = arctan = −2 ⋅ π ⋅ ⋅ f
Re 2
n n
• For the group delay::

1 dϕ 3
τ gr = − ⋅ = Delay to get a causal filter
2π df 2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-61


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
3.2.3 Different options to scale the frequency response
Mag. (dB)

0 A pass

A stop

| |
Fs/2
0 fs
f pass f stop f [ Hz ]
2

0 f pass f stop 1 f
fs fs 2 fs

ω
0 ω pass ωstop 1 π ⋅ fs

ω
0 ω pass ωstop π
fs

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-62


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
3.2.4 FIR-filter design according to window method
HS ( f )
• There are different filter design methodologies:
– Window method
– Optimal method

• 3.2.4.1 Window method principle approach


• The principle FIR-filter design approach according to the window
method is as follows:
– First, an ideal filter with rectangular amplitude, frequency and linear
phase response is defined.
– In practice such a filter isn´t realizable, since it would have an
infinite impulse response!

1 ⋅ e − j ⋅2⋅π ⋅ f ⋅τ Gr − fg ≤ f ≤ fg Reference filter


HS ( f ) = 
0 else

– Next the impulse response hS[n]:out of HS(f) is calculated:


+ fg

hS (n) = ∫ HS ( f ) ⋅ e j ⋅2⋅π ⋅n ⋅ f df = 2 ⋅ fg ⋅ Si{2π fg (n −τGr )}


− fg

fg
1 fg
hS (n) = ∫
− fg
e j ⋅2⋅π ( n−τGr ) f df =
j ⋅ 2⋅ π ⋅ ( n −τGr )
⋅ e j 2π ( n−τGr ) f
− fg

1 e j 2π ( n−τGr ) fg − e − j 2π ( n−τGr ) fg  2


= ⋅ = ⋅ sin[2π fg (n −τGr )] = 2 ⋅ fg ⋅ Si{2π fg (n −τGr )}
π ⋅ ( n −τGr )  j ⋅ 2  2π ⋅ ( n − τ Gr )
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-63
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• This impulse response in infinite ranging from -∞ to +∞. hS (n)
• Furthermore it‘s not causal!
− In next step the number of coefficients is limited (e.g. 22).
− Then the impulse response is shifted in order to get a causal
impulse response. (τgr=10,5 T)
− All other coefficients are simply cut away, by means set to
zero.

……

h[ n] = hS [n] ⋅ wR [n] n

1 0 ≤ n ≤ N −1 Impulse response reference filter


Window function wR [ n] = 
0 else
h (n)
wR [n]
վ
N −1
1 − e − j ⋅2⋅π ⋅ N ⋅ f
WR ( f ) = ∑ e − j ⋅ 2 ⋅π ⋅ n ⋅ f
=
n=0 1 − e − j ⋅2⋅π ⋅ f
⋅ f sin ( π ⋅ f ⋅ N )
N −1
e − j ⋅π ⋅ N ⋅ f e + j ⋅π ⋅ N ⋅ f − e − j ⋅π ⋅ N ⋅ f j − j ⋅ 2 ⋅π ⋅
= ⋅ = e 2

e − j ⋅π ⋅ f e + j ⋅π ⋅ f − e − j ⋅π ⋅ f j sin(π ⋅ f )

 N
1 − a N +1  n
 sin ce : ∑ ak = 1− a 
 τ gr =
M −1
= 10,5
 k =0 2
Windowed impulse response

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-64


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• For the resulting filter function H(f):

sin (π ⋅ ( f − f *) ⋅ N )
N −1 fg
− j 2π f
H ( f ) = H S ( f ) ∗WR ( f ) = e 2
⋅ ∫
− fg
sin(π ⋅ ( f − f *))
⋅ df *

H(f )

• As can bee seen, the abrupt cut away of coefficients results


in overshoots in the frequency domain.
• A possible alternative is a coefficient windowing, whereby
the coefficients on the left and right border are more or less
smoothly attenuated.
• This windowing influences the frequency response of cause.

0,5

H ( f ) = H S ( f ) ∗WR ( f ) = ∫
−0,5
H S ( f * ) ⋅WR ( f − f * )df *

sin (π ⋅ ( f − f *) ⋅ N ) sin (π ⋅ ( f − f *) ⋅ N )
fg N −1 * N −1 N −1 fg N −1 * N −1
− j 2π f − j ⋅2⋅π ⋅ ⋅( f − f *) − j 2π f − j 2π f + j ⋅2⋅π ⋅ ⋅f*
= ∫ ⋅ ⋅e ⋅ df = e ⋅ ∫ ⋅e ⋅ ⋅ df *
2 2 * 2 2 2
e e
− fg HS ( f * )
sin(π ⋅ ( f − f *)) − fg
sin(π ⋅ ( f − f *))
WR ( f − f * )

sin (π ⋅ ( f − f *) ⋅ N ) sin (π ⋅ ( f − f *) ⋅ N )
N −1 fg N −1 fg
− j 2π f − j 2π f
=e ⋅ ∫ ⋅ df = e ⋅ ∫ ⋅ df *
2 * 2

− fg
sin(π ⋅ ( f − f *)) − fg
sin(π ⋅ ( f − f *))
H( f ) H( f )

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-65


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-66


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.4.2 Hanning-window

• A Hanning-window has a very smooth behavior, by means the


coefficients a weighted with a cosine shape.
• That means that the ripples of the transfer function are filtered, but also
that the transition shape between Pass- and Stop-Band is not very steep.

  2π n 
0,5 − 0,5cos   0 ≤ n ≤ N −1
w(n) =   N −1
0 else

• Application of Hanning-window allows to reduce the frequency ripples in


Pass- and Stop-Band, compared with the rectangular window.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-67


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.4.3 Blackmann-window
• Here further cosine terms are added, whereby the remaining
Stop-Band ripples are furthermore attenuated by 20dB.
• As can be seen in the figure right bottom the transition shape
between Pass- and Stop-Band is even further reduced.
• For a steeper transition shape more coefficients are
necessary (higher order filter).

  2π n   4π n 
 0, 42 − 0,5cos   + 0,08cos   0 ≤ n ≤ N −1
w(n) =   N −1  N −1
0 else

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-68


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.4.4 Kaiser-window
• The Kaiser-window allows a more flexible parameter
choice.
– Io(x): modified Bessel-Function first kind and
order zero.

  2 2 
 I 0  α  N − 1  −  n − N − 1  
   2   2  
   0 ≤ n ≤ N −1
w(n) = 
 N −1
 I0  α 
  2 
0 else
( x / 2)
2k

mit I 0 ( x) = 1+ ∑
K =1 (k !)2

• These are just several of the window functions applied.


Further windows can be found in literature and filter
design programs.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-69


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

Rectangular Rectangular
window window

Kaiser Kaiser
window window

Hanning Hanning
window window

Comparison different windows Filter characteristic

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-70


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
3.2.5 Optimal Method
(Remez-Exchange-design method , Equiripple-design also called Tschebyscheff approximation)

• These methods are more efficient than the filter methods, because comparable filters can be designed with lower
filter order, by means with less coefficients.
• Filter can be designed with equal ripple in the Pass-and Stop-Band.
• The optimal method is usually implemented in all commercial filter design tools.
• The theory of the optimal method is very complex and isn´t explained in this course.
• The filter order is calculated:

2  1  ωS H ( jω)
M = ⋅ log  ⋅
3 10 ⋅ δ D ⋅ δ S  ωS − ωD }δ D
1
– δD: Pass-Band ripple
– δS: Stop-Band ripple 0,8
– ωD: Edge of Pass-Band
– ωS: Edge of Stop-band 0,6

0,4

0,2

δS {
0
0 0,2 0,6 0,8 1
ω ω
D S
ω
π

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-71


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
3.2.6 Half-band-filter hS (n)
• For an ideal filter (not considering the causality) follows:

sin {2 ⋅ π ⋅ f g ⋅ n}
hS [n] = 2 ⋅ f g ⋅ Si {2 ⋅ π ⋅ f g ⋅ n} = 2 ⋅ f g ⋅
1
fg =
2 ⋅π ⋅ fg ⋅ n 8

• At first zero crossing of the frequency response:


2 ⋅π ⋅ n ⋅ f g = π
2 ⋅π ⋅ fg ⋅ n = π

• Since (like in this example) this is the fourth sample, n=4:


T 2T n
n
1 1 1
fg = = T=
2⋅n 8 fS

• As can be seen every fourth sample is zero. hS (n)


• Increasing the cut-off frequency (Grenzfrequenz) to
fg=1/4 then already every second sample gets zero as
can be seen in the figure right bottom.

• Half-Band Filter have a cut-off frequency at:


1
fg =
1 4
fg =
2⋅n

T 2T n

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-72


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
Magnitude Response
3.2.7 Low-pass High-pass transform
1

• A given Low-Pass FIR-filter with hTP[n] can easily be 0.8


transformed in a corresponding High-Pass by:

Magnitude
0.6
Numerator:
hHP [n] = (−1) ⋅ hTP [n]
n
0.11022663401416945 0.4
0.19247766169773028
0.24442705970158446
• Description I Z-Domain: 0.2
0.24442705970158446
0.19247766169773028
H HP ( z ) = HTP ( − z ) 0.11022663401416945 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
hTP [n] = hTP1[n] + hTP 2 [n] Normalized Frequency ( ×π rad/sample)

n even n odd

hHP [ n] = (−1) n ⋅ hTP [n] = hTP1[n] − hTP 2 [n] Magnitude Response

n even n odd
1
H TP ( z ) = H TP1 ( z ) + H TP 2 ( z )
H HP ( z ) = H TP1 ( z ) − H TP 2 ( z ) = H TP (− z ) 0.8

Magnitude
0.6
sin ce H TP (− z ) = HTP1 (− z ) + HTP 2 (− z ) = H TP1 ( z ) − H TP 2 ( z )
0.4
Numerator:
-0.11022663401416945 0.2
0.19247766169773028
-0.24442705970158446
0
0.24442705970158446
-0.19247766169773028 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
0.11022663401416945 Normalized Frequency ( ×π rad/sample)

LP HP Transformation if FIR-filters

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-73


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
• 3.2.7.1 Example:
1
yTP [n] = ⋅ ( x[n] + x[n − 1] + x[n − 2])
3
վ
e− j⋅2⋅π⋅ f
H TP ( f ) = ⋅ (1 + e− j⋅2⋅π⋅ f + e − j⋅4⋅π⋅ f ) = ⋅ ( e + j⋅2⋅π⋅ f + 1 + e − j⋅2⋅π⋅ f )
1
3 3

= e − j⋅2⋅π⋅ f ⋅
(1 + 2 cos ( 2 ⋅ π ⋅ f ) )
3
1
yHP [n] = ⋅ ( x[n] − x[n − 1] + x[n − 2])
3
վ
e − j⋅2⋅π⋅ f
H HP ( f ) = ⋅ (1 − e− j⋅2⋅π⋅ f + e− j⋅4⋅π⋅ f ) = ⋅ ( e+ j⋅2⋅π⋅ f − 1 + e − j⋅2⋅π⋅ f )
1
3 3

= e − j⋅2⋅π⋅ f ⋅
( −1 + 2 cos ( 2 ⋅ π ⋅ f ) )
3

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-74


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter

Im { z}
1 zN1
yTP [n] = ⋅ ( x[n] + x[n − 1] + x[n − 2])
3
վ
1 z2 + z +1 z P1,2
H TP ( z ) = ⋅ (1 + z −1 + z −2 ) = ⋅
1
x
3 3 z2 Re { z}
−1 ± j 3
z N 1,2 =
2
z p1,2 = 0 Low-Pass Filter
zN 2
Zero – Pol
1
yHP [n] = ⋅ ( x[n] − x[n − 1] + x[n − 2])
Distribution
3
վ
1 z2 − z +1
H TP ( z ) = ⋅ (1 − z −1 + z −2 ) = ⋅
1
3 3 z2 Im { z}
+1 ± j 3 zN1
z N 1,2 =
2
z p1,2 = 0

z P1,2
x
Re { z}

High-Pass Filter
H HP [ z ] = H TP [− z ] Zero – Pol Distribution
zN 2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-75


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.2 FIR-filter
3.2.8 Summary FIR-filter

• FIR-filter can be designed with a linear phase response.

• Amplitude frequency response and phase response can independently from each other be defined in the Pass-Band.

• Can be deigned for practically all frequency responses desired.

• Are always stable.

• Are insensitive against rounding- and quantization errors.

• FIR-filter have the disadvantage that sometimes an extremely high implementation effort is necessary (High Order
Filters). They require a relatively high processing power.

• As more fare away the cut-off frequency from half the sampling frequency is, as higher is the filter order necessary
higher implementation effort.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-76


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
3.3.1 Up-conversion

• Sample rate conversion is used to increase or reduce the sample rate of a digital signal.
– Example is the sample rate reduction of a digital audio signal recorded with fS=48 KHz to 44,1KHz used for audio
CDs.
– A sample rate up-conversion is for example also used in DA converters, since this was it’s possible the extend the
repetition spectrums and to reduce the post filter requirements accordingly.
– An other application is sigma delta converters, since due to an increased sample rate it’s possible to increase the
effective number of bits. In the following digital signal processing a down-conversion is necessary.
– When the ADC runs with an higher sample rate, the anti-aliasing pre-filter can easier be designed. A digital down-
conversion in the following digital signal processing unit is needed, to limit the DSP processing power to the
amount necessary.
• Sample rate conversion is done with help of so called interpolation filters.
– Task of the interpolation filter is to increase the sample rate by a factor of L (Up-Sampling) or to reduce it by a
factor M (Down-Sampling).

• Up-Sampling is performed in two steps:


– increase of the sampling rate by introduction of zeros, so called “zero padding”
– filtering of unwanted repetition spectrums

• The principle of Up-Conversion is shown in the following example with L = 8.

• Up-Conversion or interpolation filtering means introduction of additional sample values. In frequency domain this
introduction of new values means a filtering of the original repetition spectrum.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-77


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x(n)
• 3.3.1.1 Example up-conversion L=8
• The sampled input signal, which should fulfill 1
the Nyquist Criteria is given by:

x[n] = x[n ⋅ T ] = s (t ) ⋅ ∑ δ (t − n ⋅ T )
n

վ n

1 xɶ ( nL )
X ( f ) = S ( f ) ∗ ∑ δ ( f − n ⋅ f S ); fS =
T 1
n

• For the interpolation filter we assume:

 fS
1 0< f < n
HL ( f ) =  2
0 fS f x ( nL )
< f < L⋅ S
 2 2 1

• As can be seen in the figure right, only every


8th value of the zero padded input signal is
n
different to zero.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-78


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x(n)

xɶ ( nL) X(f)
1

fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f
n

x( nL) X(f)
1

fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f
n

Up-conversion by factor of L =8

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-79


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
• An other even more drastically example is the interpolation filter of a Sigma-Delta DA-converter, which makes an up-
conversion by a factor of L = 128.
• Interpolation filters or commonly used in the audio and video area.

• 3.3.1.2 Applications in audio area


• Audio signals (studio requirements) should have a frequency ripple of less than 0,005 dB an a Stop-Band attenuation
in then range of 75 dB to120 dB .

Abtastrate Passband Transition Stopband


44,1 KHz 0Hz 20,0KHz 20,0KHz 24,1KHz 24,1KHz
48,0 KHz 0Hz 21,8KHz 21,8KHz 26,2KHz 26,2 KHz
96,0 KHz 0Hz 43,5KHz 43,5KHz 52,5KHz 52,5KHz
192,0 KHz 0Hz 87,1KHz 87,1KHz 104,9KHz 104,9KHz

• Calculation an interpolation-filter taking into account these requirements a filter with 5677 coefficients is needed.
– Such a filter is also called a 5677 Tap-filter.
– Such a filter requires a dramatically high processing power.
• Cascading of various filter types is an alternative to reduce the signal processing effort necessary.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-80


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
X(f) • Cascading allows an efficient reduction of the
processing requirements.
• Applied to the previous example with L=128
means a reduction of the filter coefficients from
5677 to 127, when the filter is split in 7 cascaded
sub-filters.
fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f

X(f) Filter Coefficients

Filter 1 89

Filter 2 15

fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f Filter 3 07

X(f) Filter 4 05

Filter 5 05

Filter 6 03

fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f Filter 7 03

X(f)

fS 2⋅ fS 3⋅ fS 4⋅ fS 5⋅ fS 6⋅ fS 7⋅ fS 8⋅ fS f Cascading of sub-filters

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-81


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
3.3.2 Poly-Phase filter
• FIR-filter can be implemented in direct form. Remember that a lot of zeros are introduced to the filter coefficients,
whereby the filter processes many data with value zero, which don’t have an impact on the filter result.
• In case of L = 128 only every 128th input value is different from zero.

Structure Interpolation filter

• The following simplification is explained in the example of a 9 tap filter, which is used for a factor 3 (L=3)
interpolation.

H ( z ) = b0 + b1 ⋅ z −1 + b2 ⋅ z −2 + b3 ⋅ z −3 + b4 ⋅ z −4 + b5 ⋅ z −5 + b6 ⋅ z −6 + b7 ⋅ z −7 + b8 ⋅ z −8
• In this case only every third input data is unequal to zero, by means two filter operations (multiplication and addition)
have no usable result for the output signal. This filter in the z-domain can differently be described:

H ( z ) = {b0 + b3 ⋅ z −3 + b6 ⋅ z −6 } + {b1 ⋅ z −1 + b4 ⋅ z −4 + b7 ⋅ z −7 } + {b2 ⋅ z −2 + b5 ⋅ z −5 + b8 ⋅ z −8 }


= {b0 + b3 ⋅ z −3 + b6 ⋅ z −6 } + z −1 ⋅ {b1 + b4 ⋅ z −3 + b7 ⋅ z −6 } + z −2 ⋅ {b2 + b5 ⋅ z −3 + b8 ⋅ z −6 }
= H1 ( z 3 ) + z −1 ⋅ H 2 ( z 3 ) + z −2 ⋅ H 3 ( z 3 )

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-82


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion

Structure of a poly-phase filter with L = 3

Avoidance of zero-padding

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-83


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion

• For an interpolation filter with interpolation factor L, this FIR-filter implementation as poly-phase filter results in a l times
processing power reduction. The number of filter coefficients is untouched.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-84


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
3.3.3 Coefficient sharing

• Linear phase FIR-filters have symmetrical or anti-


symmetrical filter coefficients.
• Therefore it‘s possible to add (subtract) the
corresponding input data before multiplying with the
filter coefficient.

h[ n ] = ± h[ N − n ]

• In case of odd coefficient numbers, the center


coefficient is treated separately.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-85


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
3.3.4 Decimation

• Reduction of a higher sampling frequency by a reduction factor of R.


− Pre-filtering of the data sequence with the high data rate.
− Decimation of the filtered data sequence by simple cut away of samples.
− The pre-filtering must be done in that way that after the decimation, the Nyquist criteria is still met (no alias!).
x( n)
X(f)
1

n fS fS f
2

Y(f)

fS fS f
2
l

Sample rate reduction in time-domain Y( f )

fS fS 2 ⋅ fS fS f
6 3 3

Sample rate reduction in frequency-domain

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-86


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
• 3.3.4.1 Example re-sampling

• An audio signal is recoded with 48 KHz. This signal should be down-sampled to 44,1 KHz for recording on a CD
• The relation from 48KHz to 44,1 KHz results in a fractured rational (gebrochen rationale) number:

48 KHz 48.000 160


= =
44,1KHz 44.100 147
• This means that in a first step the sample rate is up-converted from 48Khz by a factor of L=147 to 7,056 MHz (147 x
48KHz=7,056MHz) and then down-converted by a factor R = 160 to 44,1 KHz (7,056MHz / 160 = 44,1KHz).

• Of cause it doesn’t make sense to carry out a zero padding with 146 introduced zero values between the original
ones and up-convert to 7,056 MHz.
• Instead we will only calculate those values which are finally after the down conversion needed, so that values which
would thrown away are not at all calculated.

• Processing steps
– First the 48 KHz signal is lo-pass filtered to 20KHz.
– The 44,1 KHz output samples are directly calculated with a poly-phase filter.

• The processing steps are furthermore explained in an example.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-87


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
• 3.3.4.2 Example
• Sampling frequency e.g. 20 KHz
• Re-sampling to 17,143 KHz x (n)

6 1
⋅ 20 KHz = 17,143KHz
7
• Up-conversion by a factor L=6

6 ⋅ 20 KHz = 120 KHz


y (m)
• Decimation ba y factor R=7:
1
1
⋅120 KHz = 17,143KHz
7

• Direct implementation as poly-phase filter.


y (l )
1

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-88


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x ( n)
x ( n)
1
1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
n
n
y (l ) y (l )
1 1
Phase 1

Phase 3

l l

x ( n)
x ( n)
1
1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 n
n

y (l ) y (l )
1 1
1
Phase 2
Phase 4

l l

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-89


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x (n)
1
h(8)
h(7)
x(0) h(6)
h(5)
h(4)
h(3)
h(2)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
h(1) h(8)
y(0) x(1) h(0) y(0) h(7)
n h(1) h(6)
h(2) h(5)
y (l ) h(3)
h(4)
h(4)
h(3)
1 h(5) h(2)
1 x(2) h(6) h(1) h(8)
Phase 5 y(1) h(7) h(0) y(1) h(7)
h(8) h(1) h(6)
h(2) h(5)
h(3) h(4)
h(4) h(3)
x(3) h(5) h(2)
h(6) h(1) h(8)
y(2) h(7) h(0) y(2) h(7)
l h(8) h(1) h(6)
h(2) h(5)
h(3) h(4)
x(4) h(4) h(3)
h(5) h(2)
x ( n) h(6) h(1) h(8)
y(3) h(7) h(0) y(3) h(7)
h(8) h(1) h(6)
1 h(2) h(5)
x(5) h(3) h(4)
h(4) h(3)
h(5) h(2)
h(6) h(1)
y(4) h(7) h(0) y(4) h(8)
h(8) h(1) h(7)
x(6) h(2) h(6)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 h(3) h(5)
n h(4)
h(5)
h(4)
h(3)
h(6) h(2)
y (l ) x(7)
h(7)
h(8)
h(1)
h(0) y(5)
1 h(1)
1 h(2)
Phase 6 h(3)
h(4)
h(5)
x(8) h(6)
h(7)
h(8)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-90


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[2] x[1] x[0]


z-1 z-1
Phase 1

b6 b0 b6

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-91


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[3] x[2] x[1]


z-1 z-1
Phase 2

b5 b1 b7

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-92


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[4] x[3] x[2]


z-1 z-1
Phase 3

b4 b2 b8

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-93


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[5] x[4] x[3]


z-1 z-1
Phase 4

b3 b3 0

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-94


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[6]
x[7] x[5]
x[6] x[4]
x[5]
z-1 z-1
Phase 5

b8
0 b
02 b
04

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-95


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[8] x[7] x[6]


z-1 z-1
Phase 6

b7 b1 b5

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-96


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.3 Sample Rate Conversion
x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[8] x[9]

8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8

x[9] x[8] x[7]


z-1 z-1
Phase 1

b6 b0 b6

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-97


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter
3.4.1 IIR-Filters (recursive)

• Recursive (IIR) Filters have at least one denominator coefficient unequal to zero. That means that recursive filter
must have at least one pole.
• For a recursive filter in the z-domain:
M

Y (z) ∑b ⋅ z k
−k

H ( z) = = k =0
N
X (z)
1 − ∑ ak ⋅ z − k
k =1

• For practical implementation that means that recursive filters have at least one feedback loop (Rückkopplungszweig).
• For the difference equation:

[
]

[
]
M N
b0 +
xn yn
y ( n) = ∑ bk x (n − k ) + ∑ ak y ( n − k ) x(n) z -1
z-1 y(n)
k =0 k =1
b1 a1
+
• The impulse response of a recursive filter has an infinite z-1 z-1
number of output values different from zero. b2 + a2
• Therefore recursive filters are also called IIR-(Infinite
Impulse Response)Filters.

N M
h ( n) = ∑a
k =1
k y (n − k ) + ∑ b δ (n − k )
k =0
k bM-1 + aN-1
z-1 z-1
bM + aN
Direct Form I

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-98


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

b0 + + b0 +
x(n)
x[n] z-1 z-1 y(n)
y[n] x[n]
x(n) y(n)
y[n]
z-1 z-1
b1 a1
+ + a1 b1
+
z -1
z -1
z-1 z-1
b2 + a2 + a2 b2 +

+ aN-1 bM-1 +
bM-1 + aN-1
z-1 z-1
z-1 z-1 + aN bM +
Direct Form I
bM + aN

w(n) x[n]
x(n) + b0 + y(n)
y[n]
b0 + + y[n]
zz-1-1
x(n)
x[n] z-1 z-1 y(n)
a1 b1
b1 a1 Direct Form II + +
+ + (Minimum Number Of zz-1-1
z-1 z-1 Delay Elements
b2 + + a2 + a2 b2 +

bM-1 + + aN-1
+ aN-1 bM-1 +
Non Recursive z-1 z-1 zz-1-1
Nichtrekursives Rekursives
Recursive
Filter Part
Filterteil bM + + aN Filterteil
Filter Part + aN bM +
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-99
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

b0 + x[n]
b0 +
x(n)
x[n] z-1 z-1 y(n)
y[n] y(n)
y[n]
z-1
b1 a1
+
z-1 z-1 b1
+ a1
b2 + a2
z-1

aN-1
b2 + a2
bM-1 +
z-1 z-1
bM + aN
bM-1 + aN-1

z-1

bM + aN

Direct Form II In Different Presentation

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-100


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

3.4.2 IIR-Filter Cascading


• IIR-filter can be reduced to a cascading of several filters of 2nd order.
b0,1 + T.. b0,k +
x[n]
x(n) yy11[n]
(n) y[n]
y(n)
-1 -1
z z

b1,1 + a1,1 b1,k + a1,k


T..

z-1 z-1

b2,1 + a2,1 b2,k + a2,k

Cascaded IIR-Filters Of 2nd Order

• Design Methods For IIR-Filters


• Digital IIR-Filter design methods are similar to those of analog filters:
– Definition of tolerance scheme
– Definition as corresponding analog filter
– Design as analog filter e.g. Butterworth, Tschebyscheff etc.
– Transformation of analog filter into the digital domain wanted digital filter
• Digital signal processing is often used to process analog signals by digital systems, e.g. digital filtering etc.
• In case that an analog system is replaced by a time discrete system, this method is called “digital simulation”.
• Digital simulation is extensively used for synthesis of digital IIR filters.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-101


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

3.4.3 IIR-Filter-Design
• Design of IIR-Filters based on analog filter design:
− Specification of digital filter using the tolerance scheme.
− Transfer of digital filter into a corresponding analog one (pre-warp).
− Design as conventional analog filter (Bessel, Butterwoth, Tschebyscheff).
− Transformation of analog filter into a digital filter (Bilinear transformation).

• Impulse Invariant Transform (alternative transform method):


– The impulse invariant transform has clearly deficits:
• stability problems
• alias effects

H ( s ) → h(t ) → h[nT ] → H ( z )

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-102


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

• 3.4.3.1 IIR-Filter Design Using The Bilinear Transform


• The bilinear transform is a substitution method whereby H(s) is transformed into an expression H(z).
• Target of the bilinear transform is to meet the frequency response (frequency domain) of the digital filter as much as
even possible.
• The impulse invariant transform however has the target to meet the impulse response (Time domain) as good as
possible.
• Theoretical background of bilinear transform:
– We assume that the digital system is defined by the sampling frequency fs.
– We further assume that the frequency response of the digital system is periodic to 2·π·fs.
– In the z-domain s is just defined on the unit circle, (see chapter z-transform).
1 1
z = e s⋅T ⇔ s = ⋅ ln ( z ) T=
T fS

– The ln-function (natural logarithm) can be described as potency series (Potenzreihe):

1 1  z − 1  1  z − 1 3 1  z − 1 5 
s = ⋅ ln ( z ) = ⋅ 2 ⋅   + ⋅  + ⋅  … z > 0
T T  z + 1  3  z + 1  5  z + 1  

– Cut-off of the potency series after the linear element we obtain the Bilinear Transform:

2 z − 1 2 1 − z −1
s= ⋅ = ⋅
T z + 1 T 1 + z −1

• The name bilinear transforma is a bit misleading, since it’s not a linear transform at all.
• Bilinear just means a transform where numerator and denominator are represented by linear functions.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-103


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

• Bilinear Transform
– Transforms the left s-plane (Laplace transform) inside the unit circle of the z-plane (z-transform)
– Poles from the left plane are transformed within the unit circle.
– A stable analog filter is transformed into a stable digital filter.
– The jω-axis of the s-plane is transformed to the unit circle of the z-plane.
– The relationship between analog frequencies ωA and digital frequencies ωD is nonlinear.

Im {s} Im { z}
ωD Z-Plane
S-Plane
ωA

s = j∞ s=0

ℜe {s} s = − j∞ ℜe { z}

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-104


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

• Considering how analog frequencies are transformed into digital ones, 1


so we can derive from the bilinear transform:
0.9
2 z − 1 2 1 − z −1
s= ⋅ = ⋅ ⇒ 0.8
T z + 1 T 1 + z −1
0.7
2 ω ⋅T
ω A = ⋅ tan D 0.6
T 2

fA/fS
and 0.5

2 ω ⋅T 0.4
ωD = ⋅ arctan A
T 2 0.3

• For |fD / fS| < 0,1 T0,15 there is a quite acceptable approximation 0.2

between digital and analog frequency response. 0.1


• For higher frequency a pre-correction is necessary (pre-warping)
0
• Once again the bilinear transform transforms a stable analog system 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4
fD/fS
into a stable digital one and vice versa.
• The nonlinear mapping between analog and digital frequencies causes Bilinear transformation, scaled to sampling frequency
phase distortions.
– Therefore it makes no sense to transform Bessel filters with linear
phase response from the analog to the digital domain..
T T T
jωD jωD − jωD
jωDT
2 z −1 2 e −1 2 e e −e 2 2 2
s= ⋅ ⇔ j ⋅ ω A = ⋅ jωDT = ⋅ ⋅
T z +1 T e + 1 T jωD 2 jωD 2
T T
− jωD
T
e e +e 2

ω ⋅T
2 ⋅ j ⋅ sin D
2
⇔ j ⋅ωA = ⋅ 2 = 2 ⋅ j ⋅ tan ωD ⋅ T
T 2 ⋅ cos ωD ⋅ T T 2
2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-105


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

• 3.4.3.2 Filter Pre-Warping


• Example: Implementation of a digital filter with cut-off frequency of 10KHz and a sampling frequency of 44,1 KHz.

2 ω ⋅ T 
ωA = ⋅ tan  D 
T  2  T  ω ⋅T 
ωA ⋅ = tan  D 
fs π ⋅ fD  T T 2  2 
⇔ fA = ⋅ tan  
ωA ⋅ ωA ⋅
π 2 2
 fs 
12,12
• The analog filter must be designed as KHz
low-pass filter with a cut-off frequency
of 12,12 KHz!
• As mentioned before just for quite low
frequencies |fD / fS| < 0,1 the analog
frequencies are identical to the digital
ones.

T
H A ( jω A ) ωD ⋅
10 KHz 2
H D ( jωD )

T
ωD ⋅
Pre-Warping in case of a band-pass filter 2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-106


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

• 3.4.3.3 Example: Transformation of a Low-Pass Filter Of 1st Order Into


A Digital Filter

[
]
z-1
1 ωg T ⋅ ωg 1+ z −1
xn
x(n)
H A (s) = = ⇒ H D ( z) = ⋅
1+
s ωg + s T ⋅ ωg + 2  T ⋅ ω g − 2  −1 T ⋅ ωg
1− − ⋅z 1 1
ωg  T ⋅ ω + 2  T ⋅ ωg + 2
 g 

[
]
+
ωg −1
1+ z yy(n)
n
H D ( z) = =
2 1 − z −1  2   2  −1
ωg + ⋅  1+ + 1 −
 T ⋅ ω   T ⋅ ω 

−1 z
T 1+ z T ⋅ ωg − 2
 g   g  −
−1
T ⋅ ωg T ⋅ ωg + 2
1+ z 1 + z −1
= = ⋅
 T ⋅ ω g + 2   T ⋅ ω g − 2  −1 T ⋅ ω g + 2  T ⋅ ω g − 2 T ⋅ ω g  −1 z-1
  +   z 1+ 
 T ⋅ω
⋅  ⋅ z
 T ⋅ ω g   T ⋅ ω g   g T ⋅ ω g + 2 
T ⋅ ωg 1+ z −1
= ⋅
T ⋅ ωg + 2  T ⋅ ω g − 2  −1
1−  − ⋅z
 T ⋅ ω + 2 
 g 

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-107


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.4 IIR-Filter

3.4.3.4 Some Bilinear Filter Transform

H ( s) H ( z)

Identity 1 1

1 T 1 + z −1
Integrator ⋅
s ⋅τ 2 ⋅ τ 1 − z −1

1 1 + z −1
Low-pass s  2   2  −1
1. order 1+ 1 +  + 1 − ⋅ z
ω0  ω0 ⋅ T   ω0 ⋅ T 
1 1 − 2 ⋅ z −1 + z −2
Low-pass
D s2  4⋅ D  −1   −2  4⋅ D 
2. order 1+ s ⋅ 2 ⋅ + 2 1 + +
4
+ z 2−
8
+ z 1 − +
4
ω0 ω0 2  2  2 
 ω0 ⋅ T ( ω ⋅ T )   (ω0 ⋅ T )   ω0 ⋅ T ( ω ⋅ T ) 
 0    0 
s 2 1 − z −2
Low-pass ω1 ω1 ⋅ T  4⋅ D 4  −1  8  −2  4⋅ D 4 
D s2 1 + +  + z  2 −  + z  1 − + 
2. order 1+ s ⋅ 2 ⋅ +  ω0 ⋅ T (ω ⋅ T )2   ( ω ⋅ T )
2
  ω0 ⋅ T (ω ⋅ T ) 2 
ω0 ω02  0   0   0 

Summary Of Some Bilinear Z-Transform

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-108


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.5.1 Bibliographie

[1] Seyed Ali Azizi: Entwurf und Realisierung digitaler Filter. Verlag Oldenbourg München Wien 1983
[2] Martin Meyer: Signalverarbeitung
[3] Reindl L: Vorlesung digitale Signalvcerarbeitung, 2004
[4] Weeks Michael: Digital Signal Processing,Infinity Science Press, 2006

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-109


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.5.3 Exercises
3.1 Linearity
Check whether the following systems are linear:
a) y[n] = n2 · x[n]
b) y[n] = n · x [n]2
c) y[n]) = x[n]

3.2 Time Invariance


Check whether the following systems are time invariant:
a) y[n] = x [n]2
b) y[n] = n · x [n]

3.3 System Response


Determine for systems with impulse response h[n] the response y[n] to the input sequence x[n]:
a n n ≥ 0, with0 ≤ a < 1
h[n] = 
0 else
and the input sequence
1 n≥0
x[n] = 
0 else

3.4 Recursive Filter 1st Order


Determine the transfer function H(f), |H(f)| und φ(ω) for the following first order IIR-Filter:
y[n] = x[n] + 0,5y[n-1]

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-110


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.5 Non-Recursive Filter
Determine the transfer function H(f), |H(f)| und φ(ω) for the following FIR-filter:
1
y[n] = {x[n] + x[n − 1] + x[n − 2] + x[n − 3] + x[n − 4] + x[n − 5]}
6

3.6 System Function


Define the system function of the following filters:
a) Delay element
y[n] = b ⋅ x[n − 2]

b) Recursive filter
y[n] = x[n] + a1 ⋅ y[n − 1] + a 2 ⋅ y[n − 2]

c) Recursive filter
y[n] = x[n] + 0, 5 ⋅ y[n − 1]

d) Non recursive filter 2nd order

1 1 1
y[n] = − x[n] + x[n − 1] − x[n]
4 2 4

3.7 System Function


Assume a filter with the following system function:

z3 + 2 ⋅ z 2 + 3 ⋅ z + 4
H(z) =
10 ⋅ z 3

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-111


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
a) What kind of filter is it IIR or FIR?
b) Does this filter has a linear phase response?
c) Determine the difference equation.

3.7 Jump Response


• Assume the jump response of a filter is given by:

y[n] = {1,3, 4,8,9,13,14,16,17,17,17,17,...}

a) Is it a FIR- or a IIR-Filter?
b) Determine the group delay of this filter.

3.9 Recursive Filter


Assume a recursive filter with sampling period T and a system function:
b 0 + b1 ⋅ z −1
H(z) =
1 + a1 ⋅ z −1

a) Determine the transfer function H(f).


b) With b0 = 0,4, determine the other coefficients in case that:
f 
H(0) = 0dB; H  S  = −40dB
2

c) Sketch a possible filter implementation.


d) Calculate the output sequence y[n] for the following input sequence x[n]:

y[n] = {1,1, −1, −1,1,1. − 1....} for n = {0...6}

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-112


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.10 System Function
a) Determine the difference equation:

H(z) =
(
a ⋅ b + c ⋅ z −1 )
−1
1− d ⋅ z − e ⋅ z −2
b) Draw a bloc plan

3.11 FIR- or IIR-Filter?


Are the following filters FIR or IIR filters?
a)
1 − z −1 − 5 ⋅ z −2 − 3 ⋅ z −3
H(z) =
1 − 3 ⋅ z −1
b)
1 − z −1 − 5 ⋅ z −2 − 3 ⋅ z −3
H(z) =
z −2 − z −3
3.12 Linear Phase Response?
Doe the following filters have a linear phase response?
a) H(z) = 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + 2 ⋅ z −3 + z −4

b) H(z) = −1 + 3 ⋅ z −1 − 5 ⋅ z −2 − 5 ⋅ z −3 + 3 ⋅ z −4 − z −5

c) H(z) = 1 − 2 ⋅ z −1 + z −2 − 7 ⋅ z −3 + 7 ⋅ z −5 − z −6 + 2 ⋅ z −7 − z −8

d) H(z) = 1 + 3 ⋅ z −1 − 7 ⋅ z −3 + 12 ⋅ z −4 − 12 ⋅ z −5 + 7 ⋅ z −6 − 3 ⋅ z −8 − z −9

z3 + 2 ⋅ z 2 + 3 ⋅ z + 4
e) H(z) =
10 ⋅ z3
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-113
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.13 FIR- High-Pass-Filter
For a FIR-High-Pass-Filter with b0=0,5, b1=-0,5 determine:
a) Cut-off frequency fg
b) Phase response
c) Group delay

3.14 Bilinear Transform


Determine a digital high-pass filter using the bilinear transform with:
– stop-band frequency fStop=15,44 KHz
– Pass-band frequency fPass=22 KHz
– Sampling frequency fS= 48KHz
For determination of the filter order with δStop = 4·10-3 , δPass = 0,1

 2 ⋅ δ − δ2 ⋅δ 
 Pass Pass Stop 
ln  
 1 − δStop ⋅ (1 − ∆ Pass ) 
2

N=
f 
ln  Pass 
 fs 

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-114


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.5 Annex
3.15 FIR-filter
a) Explain how the relation between cut-off frequency and sampling frequency fg/fs influences the coefficient
number of FIR-filters.
b) Assume a FIR-Interpolation-Filter using a rectangular window. Calculate the number of coefficients
necessary, when the window only considers coefficients with magnitude larger than 0,015.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-115


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.15 FIR filter
a) Explain how the relation between cut-off frequency and sampling frequency fg/fs influences the coefficient
number of FIR filters.
b) Assume a FIR interpolation filter using a rectangular window. Calculate the number of coefficients
necessary, when the window only considers coefficients with magnitude larger than 0,015.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-116


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.6 Derivation of formulas
@ 3.1.8.1 @ 3.1.12.2

y[n] = x[n] + 0,8 y[n − 1]


1 1 1
mit y[−1] = 0 y[n] = x[n] + x[n − 1] + x[n − 2]
4 2 4
1 1 1
h[0] = δ [0] + 0,8 ⋅ y[−1] = 1 h[ n] = δ [n] + δ [ n − 1] + δ [n − 2]
4 2 4
h[1] = δ [1] + 0,8 ⋅ y[0] = 0,8 ∞
1 1 1
h[2] = δ [2] + 0,8 ⋅ y[1] = 0,82 H ( f ) = ∑ h[k ] ⋅ e − j ⋅2⋅π ⋅ f ⋅k = + e − j ⋅2⋅π ⋅ f ⋅1 + e − j ⋅2⋅π ⋅ f ⋅2
k =0 4 2 4
h[3] = δ [3] + 0,8〈 y[2] = 0,83
1 1 1 
⋮ = e − j 2π f  e + j 2π f + + e − j 2π f 
4 2 4 
h[n] = δ [n] + 0,8 ⋅ y[n − 1] = 0, 8n 1
= e − j 2π f 1 + cos ( 2 π f ) 
2
@ 3.1.8.2
1
H( f ) = 1 + cos ( 2 π f ) 
2
1
y[ n] = 1 ⋅ x[n] + ⋅ x[ n − 1] + 2 ⋅ x[n − 2]
2
 1 
h[ n] = {h0 , h1 , h2 ,} = 1, ; 2  Im  − sin 2 π f 
 2  ϕ ( f ) = arctan = arctan   = − arctan {tan 2 π f } = −2 π f
Re  cos 2 π f 
h0 = 1 + 0 + 0 = 1
h1 = 0 + 0,5 + 0 = 0,5
dϕ (ω ) 1 dϕ ( f ) 1
h2 = 0 + 0 + 2 = 2 TGr = − =− =+ 2π = 1
dω 2π df 2π
h3 = 0
h4 = 0

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-117


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.6 Derivation of formulas
• @3.1.13.4

1 1 1
H ( z) = −1 −2 −3
= =
1 − 1, 5 ⋅ z + 1 ⋅ z − 0, 25 ⋅ z  z P1   z P 2   z P 3  1 − 0, 5 ⋅ z  ⋅ 1 − (0, 5 + j 0, 5) z −1  ⋅ 1 − (0, 5 − j 0, 5) z − 1 
−1

1 − z  ⋅ 1 − z  ⋅ 1 − z 


z P1 = 0, 5; z P 2 = 0, 5 + j 0, 5; z P 3 = 0, 5 − j 0, 5

K1 K2 K3
H ( z) = K0 + −1
+ −1
+
1 − 0, 5 ⋅ z 1 − (0, 5 + j 0, 5) z 1 − (0, 5 − j 0, 5) z −1

 1   z3 
K 0 = lim H ( z ) ⇒ lim  − − −  = lim   = 0 ⇒ K0 = 0
z → 0 1 − 1, 5 ⋅ z 1
+ 1 ⋅ z − 0, 25 ⋅ z  z → 0  z − 1, 5 ⋅ z + 1 ⋅ z − 0, 25 
2 3 3 2
z→0

1 K1 K2 K3
= −1
+ −1
+
1 − 0, 5 ⋅ z  ⋅ 1 − (0, 5 + j 0, 5) z  ⋅ 1 − (0, 5 − j 0, 5) z  1 − 0, 5 ⋅ z
−1 −1 −1
1 − (0, 5 + j 0, 5) z 1 − (0, 5 − j 0, 5) z − 1

1 K 1 ⋅ 1 − 0, 5 ⋅ z − 1  K 2 ⋅ 1 − 0, 5 ⋅ z −1  K 3 ⋅ 1 − 0, 5 ⋅ z − 1 


⇔ = + +
1 − (0, 5 + j 0, 5) z −1  ⋅ 1 − (0, 5 − j 0, 5) z −1  1 − 0, 5 ⋅ z − 1 1 − (0, 5 + j 0, 5) z −1 1 − (0, 5 − j 0, 5) z −1
für : z = z P1 = 0, 5
1 1
⇔ K1 = = = +1
 (0, 5 + j 0, 5)   (0, 5 − j 0, 5)  [− j ] ⋅ [+ j ]
1 −  ⋅ 1 − 
 0, 5   0, 5 

K 2 = H 2' ( z p 2 ) =
1
=
1
=
[1 + j ] ⋅ [1 + j ] =
1+ 2 j −1 2 j
= =−j
 0, 5   0, 5 − j 0, 5   1   1− j [1 + j − 1] ⋅ [1 + j − 1 + j ] j⋅2⋅ j −2
1 − 0, 5 + j 0, 5  ⋅ 1 − 0, 5 + j 0, 5  1 − 1 + ⋅ 1−
j   1 + j 
    
K3 = H 3 ( z p3 ) = + j
'

1 j j
⇔ H (z) = − +
(1 − 0, 5 ⋅ z ) (1 − (0, 5 + j 0, 5) ) (1 − (0, 5 − j 0, 5) )
−1

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-118


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.6 Derivation of formulas
• @3.2.11 a
• @3.2.7.1
.
1 − z −2 − 5 ⋅ z −3 − z −4 − 2 ⋅ z −5 z ⋅ ( z − z − 5 ⋅ z − z − 2 )
−5 5 3 2

H ( z) = =
z −5 ⋅ ( z 5 − 2 ⋅ z 4 )
1
1 − 2 ⋅ z −1 yTP [n] = ⋅ ( x[n] + x[n − 1] + x[n − 2])
3
(z 5
− z 3 − 5 ⋅ z 2 − z − 2 ) : ( z 5 − 2 ⋅ z 4 ) = 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + z −3 + z −4 վ
e− j⋅2⋅π⋅ f
H TP ( f ) = ⋅ (1 + e− j⋅2⋅π⋅ f + e − j⋅4⋅π⋅ f ) = ⋅ ( e + j⋅2⋅π⋅ f + 1 + e − j⋅2⋅π⋅ f )
1
– FIR filter 3 3

= e − j⋅2⋅π⋅ f ⋅
(1 + 2 cos ( 2 ⋅ π ⋅ f ) )
• @3.2.11 b
3
1
yHP [n] = ⋅ ( x[n] − x[n − 1] + x[n − 2])
1 − z −1 + z −2 − 3 ⋅ z −3 z ( z − z + z − 3) z 3 − z 2 + z − 3
−3 3 2
3
H ( z) = = =
z −2 (1 − z −1 ) z −3 ( z − 1) z −1 վ
e − j⋅2⋅π⋅ f
H HP ( f ) = ⋅ (1 − e− j⋅2⋅π⋅ f + e− j⋅4⋅π⋅ f ) = ⋅ ( e+ j⋅2⋅π⋅ f − 1 + e − j⋅2⋅π⋅ f )
2 1
 z − z + z − 3 : [ z − 1] = z + 1 −
3 2 2
3 3
z −1
= e − j⋅2⋅π⋅ f ⋅
( −1 + 2 cos ( 2 ⋅ π ⋅ f ) )
−  z 3 − z 2 
3
z −3
− [ z − 1]
−2
• IIR filter since denominator doesn’t totally disappear. 1 z
= ↔ σ [n]
2 ⋅ z −2 1− z 1
z −1
−2 −2
H ( z )* = H ( z ) ⋅ z = 1+ z − mit : z 2 ↔ δ [n + 2] z
z −1 ⋅ z −1 ↔ σ [ n − 1]
1 ↔ δ [ n] z −1
վ
z −1 ↔ δ [n − 1] z
h[n]* = δ [n] + δ [n − 2] − 2 ⋅ σ [ n − 2] ⋅ z −2 ↔ σ [ n − 2]
z −1
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-119
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.6 Derivation of formulas
• @3.2.7.1 • @3.4.3.3

1 1 ωg
yTP [n] = ⋅ ( x[n] + x[n − 1] + x[n − 2]) H A ( s) = =
3 1+
s ωg + s
վ ωg
e− j⋅2⋅π⋅ f T ⋅ ωg 1 + z −1
H TP ( f ) = ⋅ (1 + e− j⋅2⋅π⋅ f + e − j⋅4⋅π⋅ f ) = ⋅ ( e + j⋅2⋅π⋅ f + 1 + e − j⋅2⋅π⋅ f )
1
3 3 ⇒ H D ( z) = ⋅
T ⋅ ωg + 2  T ⋅ ω g − 2  −1
= e − j⋅2⋅π⋅ f ⋅
(1 + 2 cos ( 2 ⋅ π ⋅ f ) ) 1−  −
 T ⋅ ω + 2 
⋅z
3  g 
1
yHP [n] = ⋅ ( x[n] − x[n − 1] + x[n − 2])
3
վ ωg 1 + z −1
− j ⋅2⋅π⋅ f H D ( z) = =
H HP ( f ) = ⋅ (1 − e− j⋅2⋅π⋅ f + e− j⋅4⋅π⋅ f ) = ⋅ ( e+ j⋅2⋅π⋅ f − 1 + e − j⋅2⋅π⋅ f )
1 e 2 1 − z −1 
ωg + ⋅ 2   2  −1
3 3
T 1 + z −1  1 +  +  1 −  z
( −1 + 2 cos ( 2 ⋅ π ⋅ f ) )  T ⋅ ωg   T ⋅ ωg 
= e − j⋅2⋅π⋅ f ⋅
3 1 + z −1
=
 T ⋅ ω g + 2   T ⋅ ω g − 2  −1
  +   z
 T ⋅ ω g   T ⋅ ω g 
T ⋅ ωg 1 + z −1
= ⋅
T ⋅ ωg + 2  T ⋅ ω g − 2 T ⋅ ω g  −1
1+  ⋅  ⋅ z
 T ⋅ω T ⋅ ω + 2
 g g 
T ⋅ ωg 1 + z −1
= ⋅
T ⋅ ωg + 2  T ⋅ ω g − 2  −1
1−  − ⋅z
 T ⋅ ω + 2 
 g 

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-120


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.1 Start fda program


• When the Matlab program is started
we see the following window

• Enter fdatool>> in the command


window.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-121


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.2 Filter input

Selection
filter characteristic

Selection
filter typ

Filter input menu

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-122


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.2.1 Selection menu for FIR - filter - design:


– Least squares
– Window
– Maximally Flat
– Least Pth-norm
– Constrained Equiripple

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-123


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.2.2 Selection menu for IIR filter design:


– Butterworth
– Chebyshev I
– Chebyshev II
– Elliptic
– Maximally flat
– Least Pth-norm
– Constrained Least Pth-norm

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-124


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.2.3 Other Filters:

• Differentiator
• Hilbert-Transformer
• Multiband-Filter
• Arbitrary Magnitude
• Raised-Cosine
• Arbitrary Group Delay
• Half-Band Low-Pass
• Half-Band High-Pass
• Nyquist

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-125


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• Filter order

• Selection of filter type


• Selection of filter characteristic

• Selection frequency units

• Sampling frequency

• Pass band

• Stop band

• Pass band ripple

• Stop band attenuation

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-126


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
• 3.7.2.4 Analysis Tools

• Full view analysis

• Amplitude frequency response


• Phase response
• Amplitude- and phase response
• Group delay
• Impulse response
• Step response
• Pole- zero diagram
• Filter coefficients
• Quantization

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-127


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Continuous Phase Response

0
Group Delay
-100

−900°
-200
ϕ ( f ) Grad = ⋅f ⇔
50Hz
−900° π −900° 1 1
-300
Continuous Phase (degrees)

ϕ ( f ) rad = ⋅ ⋅f = ⋅ ⋅ ⋅2⋅π⋅f
-400
50Hz 180° 50Hz 180° 2
-500 ϕ ( ω) rad = −0, 05 ⋅ ω
dϕ ( ω) 5
TGr = − = −0, 05sec = 5 ⋅ Ts =
-600

-700
dω fs

-800

-900

0 5 10 15 20 25 30 35 40 45
Frequency (Hz)
Phase Delay
5.5

5.4
Phase Delay

5.3

ϕ ( ω) rad = −0,05 ⋅ ω
5.2

ϕ ( ω)
TPh = − = 0, 05sec = 0, 05sec = 5 ⋅ Ts
Phase Delay (radians/Hz)

5.1

ω
5

4.9

4.8

4.7

4.6

4.5
0 5 10 15 20 25 30 35 40 45
Frequency (Hz)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-128


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Phase Delay

286.9 TPh = 5 ⋅ Ts ⇔
180° Grad
286.8
TPh = 5 ⋅ Ts ⋅ = 286,5
286.7
π ⋅ Ts Hz
286.6
Phase Delay (degrees/Hz)

286.5

286.4

286.3

286.2

286.1

286
0 5 10 15 20 25 30 35 40 45
Frequency (Hz)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-129


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Phase Response

0
ϕ ( f ) Grad
-2

-4

-6

Phase (radians)
-8

-10

-12

-14

dϕ ( ω)
-16
ϕ ( ω)
TGr = −
0 5 10 15 20
TPh = −
ω
Frequency (kHz)


Phase Delay

12
6

11

10
5.5

Phase Delay (radians/Hz)


Group delay (in samples)

8
5

6
4.5

4
4

0 5 10 15 20
0 5 10 15 20
Frequency (kHz)
Frequency (kHz)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-130


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.3 FIR-filter:

Number of coefficients

Attenuation in
Filter specification pass band and
stop band

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-131


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.1 FIR-Design-Methods

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-132


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.2 Window

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-133


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Time domain Frequency domain
Rechteck 1
40

30

0.8 20

Magnitude (dB)
10

Amplitude
0.6
0

0.4 -10

-20
0.2
-30

+ High spectral resolution 0


20 40 60 80 100
-40
0 0.2 0.4 0.6 0.8
Samples Normalized Frequency (×π rad/sample)
- Poor attenuation of minor lobes (Nebenkeulen)

Time domain Frequency domain


Blackmann 1 50

0.8
0

Magnitude (dB)
0.6

Amplitude
-50

0.4

-100
0.2

- Poor spectral resolution 0


20 40 60 80 100
-150
0 0.2 0.4 0.6 0.8
Samples Normalized Frequency (×π rad/sample)
+ Good attenuation of minor lobes

Time domain Frequency domain


Bartlett 1
40

20

0.8
0

Magnitude (dB)
Amplitude
0.6
-20

0.4
-40

0.2 -60
o Compromise between spectral
resolution and attenuation of minor 0
20 40 60 80 100
-80
0 0.2 0.4 0.6 0.8
Samples Normalized Frequency (×π rad/sample)
lobes.

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-134


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.3 FIR-Equiripple

Emphasis (Gewichtung) can be


modified

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-135


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.4 Constrained Least Square

Different emphasis in pass


band and stop band

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-136


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.5 Constrained Equiripple

Selection of cutt-off, pass band-


edge und stop band-edge as
parameter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-137


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.6 Generalized Equiripple

Selection of phase behavior

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-138


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• Different Group Delays Of Generalized Equiripple Design Method

Group Delay

45

40

35

30
Group delay (in samples)

25

20

15

10

0
0 5 10 15 20
Frequency (kHz)
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-139
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.7 Interpolation-Filter

Target frequency
fs=12,5kHz
12,5KHz x 8 = 100 KHz

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-140


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.4 FIR-Response Typ

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-141


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.4.1 Raised-Cosine-Filter |H(f)|

 1− ß
1 f ≤
2 ⋅T

1   π ⋅T  1− ß    1− ß 1+ ß
H ( f ) =  ⋅ 1 + cos   f −  < f ≤
2   ß  2 ⋅ T    2 ⋅T 2 ⋅T BW

0 sonst

 |
0 Fc Fs/2 f (Hz)

• ß: Roll-off factor
Magnitude Response
• Application area: Vestigal sideband modulation
(Restseitenband) of TV transmitters
1

0.8
Raised-cosine FIR Window ß=0

Raised-cosine FIR Window ß=0,25

0.6

Magnitude
Raised-cosine FIR Window ß=0,5

Raised-cosine FIR Window ß=0,75

0.4
Raised-cosine FIR Window ß=1

0.2

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9


Normalized Frequency (×π rad/sample)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-142


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Raised-Cosine-Filter

Cosinusförmiger Verlauf

Roll-off Faktor oder


Bandbreite

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-143


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.4.2 Half-Band-Filter
|H(f)|

|
0 Fc Fs/2 f (Hz)

Amplitude frequency response


go through fs/4

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-144


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

Magnitude Response

0.9

0.8

0.7

0.6
Magnitude

0.5

0.4

0.3

0.2

0.1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9


Normalized Frequency (×π rad/sample)

Half band filter with ωpass=0,49; 0,4; 0,2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-145


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.4.3 Nyquist-Filter
|H(f)|

|
0 F s /2 f (Hz )
F s /(2*B and)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-146


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.4.3 Inverse Silow-Pass

cut-off Frequenz

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-147


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

Zero-phase Response

Nyquist FIR Window


1 Raised-cosine FIR Window

0.8

0.6

Amplitude
0.4

0.2

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9


Normalized Frequency (×π rad/sample)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-148


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.5 IIR-Filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-149


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.3.1 Filter Specification

Mag. (dB)
• Identical for
– Butterworth
– Tschebyscheff I 0 Apass
– Tschebyscheff II
– Elliptic Astop

| |
0 Fpass Fstop Fs/2 f (Hz)

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-150


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.6 Pass-Band Filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-151


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.6.1 Band-Stop Filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-152


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.7 Other Filters

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-153


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.1 Differentiator

|H(ω)| Freq. v ector = [f f ... f


1 2 2n
]
Mag. v ector = [A A ... A ]
1 2 2n
Weight v ector = [W W .. W ]
1 2 n
A2

W1

A1 A3 W2 A4
| |
0 1 ω (normalized)
f f f

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-154


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.2 Multiband-Filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-155


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.3 Hilbert-Transformer
|H(ω)| Freq. v ector = [f f ... f
1 2 2n
]
Mag. v ector = [A A ... A ]
1 2 2n

1 A1 Weight v ector = [W W .. W ]
s Hil ( t ) = s ( t ) ∗
1 2 n
W1
π⋅ t
A2
վ
π
− j⋅ ⋅sign ( ω)
SHil ( ω) = S ( ω) ⋅  − j ⋅ sign ( ω)  = e 2

| |
0 1 ω (normalized)
f1 f2

Impuls e Res pons e

0.6

0.4

Amplitude 0.2

-0.2

-0.4

-0.6

0 2 4 6 8 10 12 14 16 18 20
Samples

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-156


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.4 Comb-Filter (Kamm Filter) Magnitude Response

y[n] = x[n] + a ⋅ x[ n − K ]
1.8 K=1
վ
1.6 K=2
H ( z) = 1 + a ⋅ z − K
1.4

• A comb-filter filters different frequencies in the signal


1.2 K=3
spectrum.

Magnitude
• A comb filter is characterized by several identical 1

frequency responses with equidistant distances in the K=4


frequency band. 0.8

• The amplitude frequency response has comb like shape. 0.6

M a g n it u d e R e s p o n s e 0.4
2

1 .8

1 .6
0.2

1 .4

1 .2 0
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
0 .8
Normalized Frequency (×π rad/sample)
0 .6

0 .4

0 .2

0 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7 0 .8 0 .9
× π

• Frequency response:

H ( f ) = 1 + a ⋅ e − j ⋅2⋅π⋅K ⋅ f − a ⋅ sin ( 2 ⋅ π ⋅ f ⋅ K )
ϕ(ω) = arctan
= 1 + a ⋅ cos ( 2 ⋅ π ⋅ f ⋅ K ) − j ⋅ a ⋅ sin ( 2 ⋅ π ⋅ f ⋅ K ) 1 + a ⋅ cos ( 2 ⋅ π ⋅ f ⋅ K )

(1 + a ⋅ cos ( 2 ⋅ π ⋅ f ⋅ K ) ) + ( a ⋅ sin ( 2 ⋅ π ⋅ f ⋅ K ) )
2 2
H( f ) =

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-157


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool
Magnitude Response (dB) Group Delay
0 10

-10 9

8
-20

Group delay (in samples)


7
Magnitude (dB)

-30
6

-40
5

-50 4

-60 3

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
Normalized Frequency (×π rad/sample) Normalized Frequency (×π rad/sample)

Phase Response
Pole/Zero Plot

1.5 1

0.8
1
0.6

0.4
0.5
Phase (radians)

Imaginary Part
0.2

0 0

-0.2
-0.5
-0.4

-0.6
-1
-0.8

-1.5 -1

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 -1.5 -1 -0.5 0 0.5 1 1.5
Normalized Frequency (×π rad/sample) Real Part

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-158


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.5 Peaking-Filter

Order is important for number


of peaking frequencies

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-159


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

• 3.7.7.6 Notch-Filter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-160


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

Single Peak

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-161


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.8 Import Of Filter Coefficients

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-162


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Matlab Filter Design Tool

3.7.9 Sample Rate Converter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-163


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
End of chapter

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-164


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.7.2 Exercises
3.1 Linearity
Check whether the following systems are linear:
a) y[n] = n2 · x[n]
linear, since:
?
n² ⋅ a1 ⋅ x1[n] + n² ⋅ a2 ⋅ x2[n] = n² {⋅a1 ⋅ x1[n] + ⋅a2 ⋅ x2[n]} = n² ⋅ a1 ⋅ x1[n] + n² ⋅ a2 ⋅ x2 [n]

b) y[n] = n · x [n]2
non linear, since:
n ⋅ a1 ⋅ x1[n]² + n ⋅ a2 ⋅ x2[n]² ≠ n {⋅a1 ⋅ x1[n] + ⋅a2 ⋅ x2[n]} ² = n ⋅ a1 ⋅ x1[n]² + n ⋅ a2 ⋅ x2 [n]² + 2n ⋅ a1 ⋅ a2 ⋅ x1[n] ⋅ x2 [n]
c) y[n] = |x[n]|
non linear, since:
a1 ⋅ x1[n] + a2 ⋅ x2 [n] ≠ a1 ⋅ x1[n] + a2 ⋅ x2 [n]

3.2 Time invariance


Check whether the following systems are time invariant:
a) y[n] = x [n]2
time-invariant but non linear:
y[n] = x[n]² → y[n + m] = x[n + m]²

b) y[n] = n · x [n]
not time-invariant but linear:
y[n] = n ⋅ x[n] → y[n + m] = ( n + m ) ⋅ x[n + m] ≠ n ⋅ x[n + m]

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-165


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.3 System response
Determine for systems with impulse response h[n] the response y[n] to the input sequence x[n]:
a n n ≥ 0, with 0 ≤ a < 1
h[n] = 
0 else
and the input sequence
1 n≥0
x[n] = 
0 else
n
1 − a n +1
y[n] = ∑ a k =
0 1− a
n=0 y[0]=1
n=1 y[1]=1+a
n=2 y[2]=1+a+a²
n=3 y[2]=1+a+a²+a³

1 − a n +1
n y[n]=
1− a

3.4 Recursive filter 1. order


Determine the transfer function H(f), |H(f)| und φ(ω) for the following first order IIR filter:
y[n] = x[n] + 0,5y[n-1] 1 n=0
Impulse response: 0,5 n =1

0, 25 n = 2 0,5
n
n≥0
h[n] =  =
0,5³ n = 3 0 else

 n
0,5 n

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-166


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
• Transformation in H(f) out of impulse response with input sequence e-j2πfk.

H( f ) = ∑ h[k ] ⋅ e− j 2π ⋅ f ⋅k
k =0

• With impulse response:


k
∞ ∞ ∞   1
− j 2π ⋅ f ⋅k − j 2π ⋅ f ⋅k
H ( f ) = ∑ h[ k ] ⋅ e = ∑ 0,5 ⋅ e k
= ∑ 0,5 ⋅ e − j 2π ⋅ f  =
k =0   1− a
k =0 k =0  a
1 1
H( f ) = − j 2π ⋅ f
=
1 − 0,5 ⋅ e 1 − 0,5 ⋅ cos ( 2π ⋅ f ) + j ⋅ 0,5sin ( 2π ⋅ f )
1
H( f ) =
{1 − 0,5 ⋅ cos ( 2π ⋅ f )}
2 2
+ 0,5 ⋅ sin ( 2π ⋅ f ) 
0,5sin ( 2π ⋅ f )
ϕ (ω ) = − arc tan
1 − 0,5 ⋅ cos ( 2π ⋅ f )
3.5 Non recursive filter
Determine the transfer function H(f), |H(f)| und φ(ω) for the following FIR filter:
1
y[n] = {x[n] + x[n − 1] + x[n − 2] + x[n − 3] + x[n − 4] + x[n − 5]}
6
Impulse response function h[n]: 1 sin ( 6π ⋅ f ) − jπ⋅f ⋅5
⇔ H(f ) = ⋅ ⋅e
1 6 sin ( π ⋅ f )
h[n] = {δ[n] + δ[n − 1] + δ[n − 2] + δ[n − 3] + δ[n − 4] + δ[n − 5]}
6
1 sin ( 6π ⋅ f )
1 H(f ) = ⋅
 0≤n≤5 6 sin ( π ⋅ f )
→ h[n] =  6
0 5
else ϕ ( ω) = −2π ⋅ f ⋅
2

1 5 − j2π⋅f ⋅k 1 1 − e − j2 π⋅f ⋅6 1 e− jπ⋅f ⋅6 e+ jπ⋅f ⋅6 − e− jπ⋅f ⋅6
→ H(f ) = ∑ h[k] ⋅ e− j2π⋅f ⋅k = ⋅ ∑e = ⋅ = ⋅ − jπ⋅f ⋅ + jπ⋅f dϕ ( ω ) dϕ ( f ) 5
k =0 6 k =0 6 1 − e− j2π⋅f 6 e e − e− jπ⋅f τgr = − =− =+
dω 2π ⋅ df 2

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-167


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.6 System function
Define the system function of the following filters:
a) Delay element
Y (z)
y[n] = b ⋅ x[n − 2] Y ( z ) = b ⋅ X ( z ) ⋅ z −2 ⇔ H ( z ) = = b ⋅ z −2
X (z)

b) Recursive filter
Y ( z ) = X ( z ) + a1 ⋅ Y ( z ) ⋅ z −1 + a2 ⋅ Y ( z ) ⋅ z −2
y[n] = x[n] + a1 ⋅ y[n − 1] + a 2 ⋅ y[n − 2] Y (z) 1
⇔ H ( z) = =
X ( z ) 1 − a1 ⋅ z −1 − a2 ⋅ z −2

( )
c) Recursive filter
Y ( z ) = X ( z ) + 0,5 ⋅ Y ( z ) ⋅ z −1 ⇔ Y ( z ) ⋅ 1 − 0,5 ⋅ z −1 = X ( z )
y[n] = x[n] + 0, 5 ⋅ y[n − 1] Y (z) 1
⇔ H ( z) = =
X ( z ) 1 − 0,5 z −1
d) Non recursive filter 2. order
1 1 1
Y (z) = X ( z ) + ⋅ X ( z ) ⋅ z −1 + ⋅ X ( z ) ⋅ z −2
1 1 1 4 2 4
y[n] = − x[n] + x[n − 1] − x[n]
4 2 4 Y ( z ) 1 1 −1 1 −2
⇔ H ( z) = = + ⋅z + ⋅z
3.7 System function X (z) 4 2 4
Assume a filter with the following system function:
z3 + 2 ⋅ z2 + 3 ⋅ z + 4 1
H(z) =
z3 + 2 ⋅ z 2 + 3 ⋅ z + 4 H(z) =
10 ⋅ z 3
10
{
= ⋅ 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + 4 ⋅ z −3 }
10 ⋅ z 3
no rest FIR filter
no linear phase response, since coefficients are not (anti) symmetrical
Difference equation: 1
{ }
Y(z) = ⋅ 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + 4 ⋅ z −3 ⋅ X(z)
10
1
y[n] = ⋅ {x[n] + 2 ⋅ x[n − 1] + 3 ⋅ x[n − 2] + 4 ⋅ x[n − 3]}
10
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-168
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
a) What kind of filter is it IIR or FIR?
b) Does this filter has a linear phase response?
c) Determine the difference equation.

3.7 Jump response


• Assume the jump response of a filter is given by:

y[n] = {1, 3, 4,8,9,13,14,16,17,17,17,17,...}

a) Is it a FIR or a IIR filter?


b) Determine the group delay of this filter.

3.9 Recursive filter


Assume a recursive filter with sampling period T and a system function:
b 0 + b1 ⋅ z −1
H(z) =
1 + a1 ⋅ z −1

a) Determine the transfer function H(f).


b) With b0 = 0,4, determine the other coefficients in case that:
f 
H(0) = 0dB; H  S  = −40dB
2

c) Sketch a possible filter implementation.


d) Calculate the output sequence y[n] for the following input sequence x[n]:

y[n] = {1,1, −1, −1,1,1. − 1....} for n = {0...6}

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-169


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.10 System function
a) Determine the difference equation:

H(z) =
(
a ⋅ b + c ⋅ z −1 )
−1
1− d ⋅ z − e ⋅ z −2
b) Draw a bloc plan

3.11 FIR or IIR filter?


Are the following filters FIR or IIR filters?
a)
1 − z −1 − 5 ⋅ z −2 − 3 ⋅ z −3
H(z) =
1 − 3 ⋅ z −1
b)
1 − z −1 − 5 ⋅ z −2 − 3 ⋅ z −3
H(z) =
z −2 − z −3
3.12 Linear phase response?
Doe the following filters have a linear phase response?
a) H(z) = 1 + 2 ⋅ z −1 + 3 ⋅ z −2 + 2 ⋅ z −3 + z −4

b) H(z) = −1 + 3 ⋅ z −1 − 5 ⋅ z −2 − 5 ⋅ z −3 + 3 ⋅ z −4 − z −5

c) H(z) = 1 − 2 ⋅ z −1 + z −2 − 7 ⋅ z −3 + 7 ⋅ z −5 − z −6 + 2 ⋅ z −7 − z −8

d) H(z) = 1 + 3 ⋅ z −1 − 7 ⋅ z −3 + 12 ⋅ z −4 − 12 ⋅ z −5 + 7 ⋅ z −6 − 3 ⋅ z −8 − z −9

z3 + 2 ⋅ z 2 + 3 ⋅ z + 4
e) H(z) =
10 ⋅ z3
Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-170
Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017
3.7 Annex
3.13 FIR High-pass filter
For a FIR high-pass filter with b0=0,5, b1=-0,5 determine:
a) Cut-off frequency fg
b) Phase response
c) Group delay

3.14 Bilinear transformation


Determine a digital high-pass filter using the bilinear transformation with:
– stop-band frequency fStop=15,44 KHz
– Pass-band frequency fPass=22 KHz
– Sampling frequency fS= 48KHz
For determination of the filter order with δStop = 4·10-3 , δPass = 0,1

 2 ⋅ δ − δ2 ⋅δ 
 Pass Pass Stop 
ln  
 1 − δStop ⋅ (1 − ∆ Pass ) 
2

N=
f 
ln  Pass 
 fs 

Professur Digital- und Schaltungstechnik Digital Signal Processing I 3-171


Prof. Dr.-Ing. Gangolf Hirtz Version vom Oct. 2017