Sunteți pe pagina 1din 16

ECE 3027 - Bio signal Processing

Module 1 - filters
Digital Filtering
Noise suppression
(a) imaging devices (medical, etc)
(b) biosignals (heart, brain)
(c) signals stored on analog media (tapes)

Enhancement of selected frequency ranges


(a) equalizers for audio systems (increasing the bass)
(b) edge enhancement in images

Removal or attenuation of selected frequencies


(a) removing the DC component of a signal
(b) removing interferences at a specific frequency, for example those caused
by power supplies
Bandwidth limiting
(a) anti-aliasing filters for sampling
(b) ensuring that a transmitted signal occupies only its allotted frequency
band

Special operations
(a) Differentiation
(b) Integration
(c) Hilbert transform

Simulation/Modelling
(a) simulating communication channels
(b) modelling human auditory system
Digital filters pros and cons
Early digital filters that they
1. Cost too much
2. Were too large
3. Used too much power

Digital filters have the following advantages


1. Programmable (filter characteristics easily changed)
2. Reliable and repeatable
3. Free from component drift
4. No tuning required
5. Superior performance in some cases
IIR Digital Filters
• IIR filter: A filter with an Infinite Impulse Response
• Infinite Impulse Response (IIR) filters use past outputs
together with past inputs
• The transfer function H(z) of a realizable IIR filter must be a
rational transfer function in z-1:

• IIR digital filters are implemented using ARMA (autoregressive


moving average) difference equation:
FIR Digital Filters
• FIR filter: A filter with a Finite Impulse Response.
• The transfer function H(z) of a causal FIR filter is a polynomial in
z-1
• Finite Impulse Response (FIR) filters use past input samples
only

• FIR digital filters are usually implemented using MA (moving


average) difference equation:
Digital Filter Design
• Design: approximation problem and realization problem.
– The approximation problem deals with the choice of parameters or
coefficients in the filter's transfer function
– The realization part of the design problem deals with choosing a
structure to implement the transfer function
• approximation stage can be divided into 4 steps
– A desired or ideal response is chosen (usually in the frequency domain)
– A class of filters is chosen (for example, FIR vs IIR)
– A design criteria is chosen (least square or minimax)
– An algorithm is selected to design the transfer function
• realization stage can also be divided into 4 steps
– A set of structures is chosen.
– A criteria for comparing different implementations is chosen
– The best structure is chosen, and its parameters are calculated
from the transfer function.
– The structure is implemented in hardware or software.
Digital IIR Filter Design
• The process of deriving the transfer function G(z) whose
frequency response G(ejω) approximates the given frequency
response specifications is called digital filter design
• After G(z) has been obtained, it is then realized in the form of a
suitable filter structure
• The filter specifications are usually specified in terms of its
magnitude response.
• For example, the magnitude |G(ejω)| of a lowpass filter G(z) is
usually specified as indicated in the above figure. In the
passband defined by 0 ≤ ω ≤ ωp, we require
1 − δp ≤ |G(ejω)| ≤ 1 + δp, for |ω| ≤ ωp
• In other words, the magnitude approximates unity within an
error of ±δp. In the stopband, defined by ωs ≤ |ω| ≤ π, we
require
|G(ejω)| ≤ δs, for ωs ≤ |ω| ≤ π,
• Implying that the magnitude approximate zero within an
error of δs. The frequencies ωp and ωs are, respectively, called
the passband edge frequency and the stopband edge
frequency.
• The maximum limits of the tolerances in the passband and
stopband, δp and δs, are called ripples
• In most applications, the digital filter specifications are given as
indicated in the above figure.
• Here, in the passband defined by 0 ≤ ω ≤ ωp, the maximum and the
minimum values of the magnitude are, respectively, unity and
𝟏/ 𝟏 + 𝝐𝟐 . The peak passband ripple in dB is
𝑅𝑝 = 20 log10 1 + 𝜖 2 dB.
• The maximum ripple in the stopband, defined by ωs ≤ ω ≤ π, is
denoted by 1/A and the minimum stopband attenuation in dB is
given by Rs = 20 log10 A dB
• If the passband edge frequency Fp and the stopband edge
frequency Fs are specified in Hz along with the sampling rate FT
of the digital filter, then the normalized angular edge frequencies
in radians are given by
𝜴𝒑 𝟐𝝅𝑭𝒑 𝜴𝒔 𝟐𝝅𝑭𝒔
𝝎𝒑 = = = 𝟐𝝅𝑭𝒑 𝑻 , 𝝎𝒔 = = = 𝟐𝝅𝑭𝒔 𝑻
𝑭𝑻 𝑭𝑻 𝑭𝑻 𝑭𝑻
• The first step in the filter design process is the estimation of
the order of the transfer function
• For the design of an IIR digital lowpass filter G(z) based on the
conversion of an analog lowpass filter Ha(s), an analytical
formula exists for the estimation of the filter order
• The most widely used approach to IIR filter design is based on
the bilinear transformation from s-plane to z-plane given by
𝟐 𝟏 − 𝒛−𝟏
𝒔=
𝑻 𝟏 + 𝒛−𝟏
• Using the above transformation an analog transfer function
Ha(s) is converted into a digital transfer function G(z) according
to
𝑮 𝒛 = 𝑯 𝒛 | 𝟐 𝟏−𝒛−𝟏
𝒔=
𝑻 𝟏+𝒛−𝟏

• For the bilinear transformation, the relation between the


imaginary axis (s = jΩ) in the s-plane and the unit circle (z = ejω)
in the z-plane is given by
Ω = tan(ω/2),
• which maps the entire imaginary axis in the s-plane to the unit
circle in the z-plane introducing a distortion in the frequency
axis called warping
• Analog prototype Ha(s) is then designed using the prewarped
critical frequencies, and Ha(s) is transformed using the bilinear
transformation to obtain the desired digital filter transfer
function G(z).
Design Flow
• The most common method of IIR filter design is based on the
bilinear transformation of a prototype analog transfer function.
• The analog transfer function is usually one of the following types:
• Butterworth, Type 1 Chebyshev, Type 2 Chebyshev, Elliptic
• The difference between these filter types can be explained by
considering the analog lowpass filter
– The Butterworth lowpass transfer function has a maximally-flat
magnitude response at dc, that is, Ω = 0, and a monotonically decreasing
magnitude response with increasing frequency.
– The Type 1 Chebyshev lowpass transfer function has an equiripple
magnitude response in the passband and a monotonically decreasing
magnitude response with increasing frequency outside the passband.
– The Type 2 Chebyshev lowpass transfer function has a monotonically
decreasing magnitude response in the passband with increasing frequency
and an equiripple magnitude response in the stopband.
– The elliptic lowpass transfer function has equiripple magnitude responses
both in the passband and in the stopband
Estimation of order of IIR Filter
• The first step in the filter design process is to choose the type of
filter approximation to be employed and then to estimate the order
of the transfer function from the filter specifications
• The MATLAB command for estimating the order of a Butterworth
filter is
[N, Wn] = buttord(Wp, Ws, Rp, Rs),
• Wp and Ws are two-element vectors specifying both edge
frequencies
• For estimating the order of a Type 1 Chebyshev filter, the MATLAB
command is
[N, Wn] = cheb1ord(Wp, Ws, Rp, Rs)
• and for designing a Type 2 Chebyshev filter, the MATLAB command
for estimating the order is
[N, Wn] = cheb2ord(Wp, Ws, Rp, Rs)
• Finally, in the case of an elliptic filter design, the command is
[N, Wn] = ellipord(Wp, Ws, Rp, Rs)
IIR Filter Design
• After the filter type has been selected and its order estimated, the next step is
to determine the transfer function of the filter. To this end MATLAB
provides functions for all four types of filters. For designing Butterworth
digital lowpass or bandpass filters, the command is
[num,den] = butter(N,Wn)
For designing a Butterworth digital highpass filter of order N, command is
[num,den] = butter(N,Wn,’high’)
whereas, the command
[num,den] = butter(N,Wn,’stop’)
returns the transfer function of a Butterworth bandstop filter of order 2N
provided Wn is a two-element vector.
For designing a Type 1 Chebyshev digital filter, the commands are
[num,den] = cheby1(N,Rp,Wn)
[num,den] = cheby1(N,Rp,Wn,’filtertype’)
For designing a Type 2 Chebyshev digital filter, the commands are
[num,den] = cheby2(N,Rs,Wn)
[num,den] = cheby2(N,Rs,Wn,’filtertype’)
Finally, for designing an elliptic digital filter, the commands are
[num,den] = ellip(N,Rp,Rs,Wn)
[num,den] = ellip(N,Rp,Rs,Wn,’filtertype’)

S-ar putea să vă placă și