Beruflich Dokumente
Kultur Dokumente
Digital Filters
Version 3.2 Oct 2017
English
• 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.
H ( jω ) H ( jω )
−ω g ωg ω −ω g ωg ω
Low-Pass High-Pass
H ( jω ) H ( jω )
Band-Pass Band-Stop
H ( jω ) H ( jω )
−ω g ωg ω −ω g ωg ω
H ( jω ) H ( jω )
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 ω
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!).
• 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
• 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.
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.
The relation between input- and output sequence x[n] and y[n] is described by the difference equation
• 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;
The filter order corresponds to the highest number of delays in the filter.
In the example above the order is 2nd
y[n] = x[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]
• 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
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 =−∞
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
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] .
y[ n] = x[ n] + 0,8 y[n − 1]
1 δ (n) 1 h ( n)
with y[−1] = 0
• A system is causal when an response to an input sequence is zero as long as the input sequence is also zero.
x[n] x[n]
n n
y[n] y[n]
n n
• A system is stable, when the response of a finite (endlich) input sequence remains finite:
∞
∑
k = −∞
h( n) < ∞
• 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).
x1(n)
x2(n) +
y(n) = x1(n) + x2(n) + x3(n)
x3(n)
Adder / Subtracter
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.
H ( jω ) = H ( jω ) ⋅ e jϕ ( H ( jω ) )
H ( jω ) = Re { H ( jω )} + Im { H ( jω )}
2 2
• Phase Response
• Group Delay
dϕ (ω ) 1 dϕ ( f )
τ gr = − =− ⋅
dω 2 ⋅π df
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
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.
∞
H ( z) = ∑ h [ n] ⋅ z
n =−∞
−n
x[ n] = δ [ n]
∞
⇒ X ( z) = ∑ δ [n] ⋅ z
n =0
−n
= 1 ⋅ z −0 = 1
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
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
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.
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
վ
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
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
h(n)
x 1
x Re
Im
h(n)
x 1
Re
x
n
Im
h(n)
x
1
Re
x
• 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.
N M
Y (z) ∑b ⋅ z k
−k
Other Representation Of
Delay Elements
• 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
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
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
+ 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]
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
• 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
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)
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
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
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
• 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
-10
-30
-40
-50
-60
0 5 10 15 20
Frequency (kHz)
Pole/Zero Plot
Filter 5th order
- has 5 zeros 1
transfer function
5
0
-0.5
-1
-1 -0.5 0 0.5 1
Real Part
-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
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 }
1.5
1
1
0.8
Imaginary Part
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 (ω )
Filter with constant group delay can‘t have group delay distortions, all frequencies of the input signal are equally delayed.
h[n] h[n-M/2]
n n
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
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
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
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
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
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
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
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
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
Phase response
h(n) h(n)
n n
h(n) h(n)
n n
• 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
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
fg
1 fg
hS (n) = ∫
− fg
e j ⋅2⋅π ( n−τGr ) f df =
j ⋅ 2⋅ π ⋅ ( n −τGr )
⋅ e j 2π ( n−τGr ) f
− fg
……
h[ n] = hS [n] ⋅ wR [n] n
N
1 − a N +1 n
sin ce : ∑ ak = 1− a
τ gr =
M −1
= 10,5
k =0 2
Windowed impulse response
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 )
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 )
2π n
0,5 − 0,5cos 0 ≤ n ≤ N −1
w(n) = N −1
0 else
2π n 4π n
0, 42 − 0,5cos + 0,08cos 0 ≤ n ≤ N −1
w(n) = N −1 N −1
0 else
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
Rectangular Rectangular
window window
Kaiser Kaiser
window window
Hanning Hanning
window window
• 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
ω
π
sin {2 ⋅ π ⋅ f g ⋅ n}
hS [n] = 2 ⋅ f g ⋅ Si {2 ⋅ π ⋅ f g ⋅ n} = 2 ⋅ f g ⋅
1
fg =
2 ⋅π ⋅ fg ⋅ n 8
T 2T n
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
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
= 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
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
• Amplitude frequency response and phase response can independently from each other be defined in the Pass-Band.
• 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.
• 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-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.
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
fS
1 0< f < n
HL ( f ) = 2
0 fS f x ( nL )
< f < L⋅ S
2 2 1
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
• 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.
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
• 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:
Avoidance of zero-padding
• 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.
h[ n ] = ± h[ N − n ]
n fS fS f
2
Y(f)
fS fS f
2
l
fS fS 2 ⋅ fS fS f
6 3 3
• 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:
• 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.
6 1
⋅ 20 KHz = 17,143KHz
7
• Up-conversion by a factor L=6
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
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b6 b0 b6
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b5 b1 b7
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b4 b2 b8
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b3 b3 0
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
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b7 b1 b5
8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8
b6 b0 b6
• 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
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
z-1 z-1
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).
H ( s ) → h(t ) → h[nT ] → H ( z )
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.
• 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}
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
ω ⋅T
2 ⋅ j ⋅ sin D
2
⇔ j ⋅ωA = ⋅ 2 = 2 ⋅ j ⋅ tan ωD ⋅ T
T 2 ⋅ cos ωD ⋅ T T 2
2
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
[
]
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
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
[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
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]
1 1 1
y[n] = − x[n] + x[n − 1] − x[n]
4 2 4
z3 + 2 ⋅ z 2 + 3 ⋅ z + 4
H(z) =
10 ⋅ z 3
a) Is it a FIR- or a IIR-Filter?
b) Determine the group delay of this filter.
H(z) =
(
a ⋅ b + c ⋅ z −1 )
−1
1− d ⋅ z − e ⋅ z −2
b) Draw a bloc plan
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
2 ⋅ δ − δ2 ⋅δ
Pass Pass Stop
ln
1 − δStop ⋅ (1 − ∆ Pass )
2
N=
f
ln Pass
fs
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
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
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
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
Selection
filter characteristic
Selection
filter typ
• Differentiator
• Hilbert-Transformer
• Multiband-Filter
• Arbitrary Magnitude
• Raised-Cosine
• Arbitrary Group Delay
• Half-Band Low-Pass
• Half-Band High-Pass
• Nyquist
• Filter order
• Sampling frequency
• Pass band
• Stop band
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)
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)
0
ϕ ( f ) Grad
-2
-4
-6
Phase (radians)
-8
-10
-12
-14
dϕ ( ω)
-16
ϕ ( ω)
TGr = −
0 5 10 15 20
TPh = −
ω
Frequency (kHz)
dω
Phase Delay
12
6
11
10
5.5
8
5
6
4.5
4
4
0 5 10 15 20
0 5 10 15 20
Frequency (kHz)
Frequency (kHz)
3.7.3 FIR-filter:
Number of coefficients
Attenuation in
Filter specification pass band and
stop band
• 3.7.3.1 FIR-Design-Methods
• 3.7.3.2 Window
30
0.8 20
Magnitude (dB)
10
Amplitude
0.6
0
0.4 -10
-20
0.2
-30
0.8
0
Magnitude (dB)
0.6
Amplitude
-50
0.4
-100
0.2
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.
• 3.7.3.3 FIR-Equiripple
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
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
0.6
Magnitude
Raised-cosine FIR Window ß=0,5
0.4
Raised-cosine FIR Window ß=1
0.2
Cosinusförmiger Verlauf
• 3.7.4.2 Half-Band-Filter
|H(f)|
|
0 Fc Fs/2 f (Hz)
Magnitude Response
0.9
0.8
0.7
0.6
Magnitude
0.5
0.4
0.3
0.2
0.1
• 3.7.4.3 Nyquist-Filter
|H(f)|
|
0 F s /2 f (Hz )
F s /(2*B and)
cut-off Frequenz
Zero-phase Response
0.8
0.6
Amplitude
0.4
0.2
3.7.5 IIR-Filter
Mag. (dB)
• Identical for
– Butterworth
– Tschebyscheff I 0 Apass
– Tschebyscheff II
– Elliptic Astop
| |
0 Fpass Fstop Fs/2 f (Hz)
• 3.7.7.1 Differentiator
W1
A1 A3 W2 A4
| |
0 1 ω (normalized)
f f f
• 3.7.7.2 Multiband-Filter
• 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
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
y[n] = x[n] + a ⋅ x[ n − K ]
1.8 K=1
վ
1.6 K=2
H ( z) = 1 + a ⋅ z − K
1.4
Magnitude
• A comb filter is characterized by several identical 1
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 ) =
-10 9
8
-20
-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
• 3.7.7.5 Peaking-Filter
• 3.7.7.6 Notch-Filter
Single Peak
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]
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]
1 − a n +1
n y[n]=
1− a
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.
H(z) =
(
a ⋅ b + c ⋅ z −1 )
−1
1− d ⋅ z − e ⋅ z −2
b) Draw a bloc plan
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
2 ⋅ δ − δ2 ⋅δ
Pass Pass Stop
ln
1 − δStop ⋅ (1 − ∆ Pass )
2
N=
f
ln Pass
fs