You are on page 1of 31

Discrete – time systems

(digital filters)

H
{xn} {yn} = H [{xn}]

Linear system: superposition property

Input {xn} = x0, x1, x2… output {yn}= H[{xn}]


Input {un} = u0, u1, u2… output {vn}= H[{un}]
Input a {xn} + b {un} output a {yn} + b {vn}

Time invariant system:

Input {xn} output {yn}


Input {xn-m} output {yn-m}

LTI – linear and time invariant


LTI systems

H
{xn} {yn} = H [{xn}]

LTI - description in time domain

Input dn (Kronecker delta) output yn=hn (impulse response)


Input dn-k (delayed delta) output yn=hn-k
Input xk dn-k output yn= xk hn-k

Input {xn } =  xk d n−k (series of samples) output yn = xh k n−k = xn  hn
k k =−
convolution
Discrete – time LTI system is described with convolution

n
For causal systems: hn=0, n<0 yn = xh k n−k
k =−
LTI systems

H 

{xn} yn = xh k n−k = xn  hn


k =−

Y ( z) = X ( z) H ( z), H ( z) = [{hn }] transfer function of the system

The output signal: yn = Z −1[Y ( z)] = Z −1[ X ( z) H ( z)]

Stability / instability: Let us assume, that X(z) has all its poles within the unit circle. It means
that the input signal xn → 0 as n →  (see last slide „Z transform”)
For stable systems the output signal yn → 0 as n →  . That is every
pole of X(z) H(z) must be within the unit circle.

If at least one pole of H(z) stems out of this circle, then yn → 


i.e. the system H(z) is unstable.

Stable filter is a BIBO (Bounded Input – Bounded Output) filter. If the


input signal is bounded, then the output signal is also bounded.
Difference equations
Linear filters are usually described with difference equations

H(z) N M
xn yn =  bi xn −i −  ai yn −i
i =0 i =1
M N
Introducing a0=1,
a i yn −i =  bi xn −i
we obtain: i =0 i =0
M N M N
−i −i
Z transform:  ai [ yn−i ] =  bi [ xn−i ] a
 i z Y ( z ) = b z
 i X ( z)
i =0 i =0 i =0 i =0
M N
−i
Y ( z )  ai z = X ( z )  bi z −i Polynomial of degree N
i =0 i =0 has N zeros (roots)

N N
−i −N N −i
 bi z z b
i z
Y ( z) i =0 i =0 B( z )
Transfer function H ( z ) = = M
= M
=
X ( z) A( z )
a i z −i z − M  ai z M −i
i =0 i =0
Rational function, Polynomial of degree M
has N zeros and M poles Values z-M and z-N represent has M zeros (roots)
only time shift
FIR and IIR filters

N
Nonrecursive (FIR): M=0 yn =  bi xn −i
FIR – finite impulse response i =0

If the input signal is the Kronecker delta xn = d n


N
then the output signal equals: yn =  bi d n −i = bn
i =0

The impulse response: b0 , b1 ,, bN ,0,0,0,


N
Transfer function H ( z ) =  bi z −i FIR filter is always stable!
i =0

Recursive (IIR): M≠0


IIR – infinite impulse response

If N=0, we obtain the all pole filter


Transversal structure of digital filter

N M
yn =  bi xn −i −  ai yn −i
i =0 i =1

FIR part is always stable IIR part may be stable or not


LTI systems - stability analysis

H 

{xn} yn = xh k n−k = xn  hn


k =−

An example: z2
Transfer function of a filter is described with the formula: H ( z) = 2
Is this filter stable? z − z + 0.5

There is a polynomial in denominator of H(z), so it is a IIR filter.


Its stability depends on position of the poles of H(z).

These poles are the roots of the polynomial z 2 − z + 0.5


We solve the equation z 2 − z + 0.5 = 0 and obtain two roots:
z1 = 0.5 + j 0.5 and z2 = 0.5 − j 0.5

1
| z1 | = | z 2 |=  1 , poles lie in the circle of radius =1 and the filter is stable.
2
Difference equations – an example
A filter is described with the following difference equation

xn H(z) yn = xn + 14 yn−1 + 18 yn−2

Is it FIR or IIR filter? Calculate the transfer function H(z) . Is this filter stable?

y is put to the left side: yn − 14 yn−1 − 18 yn−2 = xn

Z transform: Y ( z ) − 14 z −1Y ( z ) − 18 z −2Y ( z ) = X ( z ) because Z[ yn−i ] = z −iY ( z)

Y ( z ) [1 − 14 z −1 − 18 z −2 ] = X ( z )

Y ( z) 1 z2 Rational function,
Transfer function H ( z) = = 1 −1 1 −2
= 2 1
X ( z) 1 − 4 z − 8 z z − 4 z − 18 has 2 zeros and 2 poles

This is an IIR filter, because the current output sample yn depends on previous
output samples yn-1, yn-2 (see difference equation).

Moreover, the transfer function has poles (roots of the polynomial in denominator). These roots
are z1 = 12 and z2 = − 1 . They lie in the unit circle, so the filter is stable.
4
Block diagrams
Filter may be described with the block diagram. Block diagram (block scheme) contains sufficient
information to obtain difference equation or transfer function.

Example:

Operator z-1 represents delay of one sample (T seconds, where T is sampling interval).

From the block diagram we read: yn = b( xn + a yn−1 )


y is put to the left side: yn − ab yn−1 = b xn

Z transform: Y ( z) − abz −1Y ( z) = bX ( z) because Z[ yn−i ] = z −iY ( z)


−1 Y ( z) b bz
Y ( z ) [1 − abz ] = bX ( z ) → H ( z) = = =
X ( z ) 1 − abz −1 z − ab

Transfer function may be obrained directly from the block diagram, by reading

Y ( z) = b[ X ( z) + a z −1Y ( z) ]
Frequency response

The substitution z = e j 2 f T leads us to frequency domain (DTFT)

T – sampling period
1/T – sampling frequency

frequency response of
H ( z) = H (e j 2 fT ) = H s ( f ) discrete time filter
(a complex function!)

Frequency response tells us about filter’s reaction to input signal components of


different frequencies. Are these components amplified or attenuated?
It is the steady state analysis like in analog systems, but we use sampled sine or cosine
signals:
Let this sampled cosine of frequency f0 be the input to LTI system: xn = A cos(2 f 0 nT +  )

Frequency response of this system equals H s ( f ) , but we are interested only in its value at

frequency f0: H s ( f 0 ) =| H s ( f 0 ) | e j ( f 0 ) where | H s ( f 0 ) | = frequency magnitude response

At the filter output we obtain yn = A| H s ( f 0 ) | cos(2 f 0 nT +  + ( f 0 ))


Zeros and poles of the transfer function and
their influence on frequency response

T – sampling period frequency response


1/T – sampling frequency
H ( z) = H (e j 2 fT ) = H s ( f )
We read the frequency response along the unit circle from
frequency f=0 (that is z=1) to the frequency equal to the half
of sampling frequency f=1/(2T), that is z= -1. Further we
obtain the mirror image. If we pass nearby a zero then we
observe decrease of the frequency magnitude response. If we
pass nearby a pole then the we observe increase of the
frequency magnitude response.
| s
|
r
− ln( r ) mirror image
θ B=
θ T
r

Example: M=3 poles



F=
2 T
Zeros and poles of the transfer function and
their influence on frequency response - example

Transfer function of a filter equals H ( z) = 1 − z −1


It is a FIR filter, B(z)= 1- z -1, A(z) = 1.
The coefficients b0=1 and b1= -1 are the samples
of the impulse response of this filter: h0=1 and h1= -1
As a FIR filter it is a stable filter.

z −1
H ( z ) = 1 − z −1 = z
has one zero at z=1.
Pole at z=0 has no influence on the frequency response and stability
(it is only a time shift)

Using the substitution z = e j 2 f T we read the frequency response of our filter on the unit circle:
At f=0, z=1 and H(z) for z=1 is equal to zero. Our filter stops
H s ( f ) = H (e j 2 fT )
frequency equal to zero (signals of constant values): Hs(0)=0. It is due to zero of the polynomial
(see red point).
At frequency equal to half of the sampling frequency f = 1 z = -1 and H(z) = 2 . Our filter is
2T
a highpass filter.
Zeros and poles of the transfer function and
their influence on frequency response - example

Without detailed calculation we may draw the approximate frequency magnitude response

of the filter H ( z) = 1 − z −1

We may substitute z = e j 2 f T to H(z): H s ( f ) = H[e j 2 f T ] = 1 − e− j 2 f T


and calculate frequency magnitude response |Hs(f)| for each frequency value.
Parameters of a lowpass filter

Frequency magnitude response |H(f)|

|H(f)| passband ripple

stopband attenuation

f=0 f=1/(2T)=sampling freq./2

passband stopband
transition band

required cutoff frequency


Design of finite impulse response filters
(FIR)
N
M=0, N zeros on the complex plane yn =  bi xn −i
i =0
N
Transfer function H ( z ) =  bi z −i bi = hi impulse response
i =0

1. Design by sampling in frequency

Given: H0, H1, ..., HL-1 – values of frequency response at frequencies


0, 1/(LT), 2/(LT), (L-1)/(LT)
where fs = 1/T – sampling frequency.
Searched: h0, h1, ..., hL-1 – samples of impulse response.

−1
h =W H = IDFT ( H )
The impulse response is obtained using the inverse discrete Fourier transform (IDFT)
of the frequency response values.
FIR filters
design by sampling in frequency

= 2 f T
frequency response of ideal filter
Hk
*
h0 , h1 ,, h12 = H L −k = H k
= IDFT [ H 0 ,, H12 ]
= 2 f T
12
sampled frequency response (L=13 samples)
H ( z ) =  hn z −n
n =0 H ()

H f ( f ) = H ( z ) z =e j 2 f T
H f ( LTk ) = H k
= 2 f T
transition
band the obtained frequency magnitude response
FIR filters
design by sampling in frequency

frequency magnitude response Zeros of transfer function

frequency

Design of a lowpass filter:


sampling frequency=2, passband width = 0.5, L=32 samples
FIR filters
design by Chebyshev approximation

Required frequency magnitude response: Hd(), =2fT


M
Chebyshev approximation H ( ) = c n cos(n )
n =0

Error function E() = W () H () − H d ()


(W() – weighting function)

Minimization criterion: mini-max (minimization of the greatest value of E())

Minimization procedure: Remez algorithm (looking for M+2 frequencies, at which


the error function E() exhibits the greatest values)
FIR filters
design by Chebyshev approximation

frequency magnitude response Zeros of transfer function

frequency

Design of a lowpass filter:


sampling frequency=2, passband width = 0.5, L=31 samples
FIR filters
design by windowing in time domain

time frequency

Impulse response of the ideal Ideal frequency response: Hd(f)


filter: h(t)

Limiting duration of h(t) to LT Convolution of Hd(f) with


seconds, using a window w(t): Fourier transform of the
h(t ) = h(t ) w(t ) window: H ( f ) = H d ( f ) W ( f )
Sampling: L samples, sampling Spectral copies of H ( f )
interval T, sampling frequency appear every 1/T [Hz] on
1/T frequency axis
FIR filters
design by windowing in time domain

Design of a lowpass filter: Rectangular window:


sampling frequency=2,
passband width = 0.5,
L=32 samples

zero crossings

frequency magnitude response Zeros of transfer function

frequency
FIR filters
design by windowing in time domain

Design of a lowpass filter: Rectangular window:


sampling frequency=2,
passband width = 0.5,
L=32 samples

zero crossings

frequency magnitude response Zeros of transfer function

frequency
FIR filters
design by windowing in time domain

Hamming window: Design of a lowpass filter:


sampling frequency=2, passband width = 0.5,
L=32 samples

impulse response

Hamming window:

L=32 samples of the impulse


response

Impulse response after multiplication


by Hamming window
FIR filters
design by windowing in time domain

Design of a lowpass filter:


sampling frequency=2, passband width = 0.5,
L=32 samples, Hamming window

frequency magnitude response Zeros of transfer function

frequency
Infinite impulse response filters (IIR)

Butterworth filters (number of zeros N = number of poles M)

B ( z ) g ( z + 1) M
Lowpass Butterworth filter H ( z) = = M
A( z )
 ( z − zi )
i =1

where z1,...zM – poles (real or complex conjugates)

Butterworth filter has no passband and stopband ripples.


Butterworth IIR filters

Design of a lowpass filter: B ( z ) g ( z + 1) M


sampling frequency=2, passband width = 0.3, H ( z) = = M
M=12 A( z )
 ( z − zi )
i =1
Zeros and poles of transfer function
frequency magnitude response

poles

zeros z

z-zi
zi

frequency
M

In passband i
 ( z − z ) = const
i =1
Elliptic IIR filters

Elliptic (Cauer) filters (number of zeros N = number of poles M)

Properties: narrow transition band, small passband ripples,


high stopband attenuation

Zeros and poles of transfer function

zeros
lowpass filter

poles
Elliptic IIR filters

Design of a lowpass filter:


sampling frequency=2, passband width = 0.3,
M=12

frequency magnitude response frequency magnitude response in passband (zoom)

frequency frequency
Highpass, bandpass and stopband filters

Having a lowpass filter H LP ( z )


we may obtain highpass filter with a substitution: H HP ( z) = H LP (− z)
Frequency response of highpass filter will be a mirror image of frequency response of lowpass
filter. Stability will be preserved.

Bandpass filter may be obtained by subtraction of transfer functions of two lowpass filters.

Stopband filter for suppression of narrowband distortions , e.g. hum of power network 50 Hz,
may be obtained by zeros of transfer function at
 50
z= exp( j ) , where = (fs is sampling frequency)
2 fs

In order to reduce attenuation at the other frequencies, poles may be inserted ,

at z =  exp( j ),  1
Decibels (revision)

In the last slides, frequency magnitude response is given in decibels [dB].


Decibels are used for comparison of two signal powers or amplitudes.
Ratio of a measured power P to the reference power Pr, expressed in dB, equals

P
PdB = 10 log 10
Pr
Instead of powers we may compare amplitudes od two signals of the same kind.
Because power is proportional to the squared amplitude (for example P=A2/2
for sine signals), we may rewrite the formula as follows:
2
2
A  A   A 
PdB = 10 log 10 2
= 10 log 10   = 20 log 10  
Ar  A 
 Ar   r 
In the last slides, reference power and reference amplitude are equal to one.
Frequency magnitude response equal to 0 dB means that |Hs(f)| =1.
Frequency magnitude response equal to -100 dB means that |Hs(f)| =10-5.
See table in the following slide
Decibels

P/Pr A/Ar PdB


1 1 0 dB
2 2 3 dB
4 2 6 dB
10 10 10 dB
100 10 20 dB
1000 10 10 30 dB
10n 10 n 10 n dB
1 1
2 2 -3 dB
1 1
4 2 -6 dB
0.1 0.1 -10 dB
0.01 0.1 -20 dB
0.001 0.001 -30 dB
10−n 10−n / 2 -10 n dB

You might also like