# Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.

## Presentation on theme: "Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter."â€” Presentation transcript:

Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter passes certain frequency components without any distortion and blocks other frequency components

Filtering The range of frequencies that is allowed to pass through the filter is called the passband, and the range of frequencies that is blocked by the filter is called the stopband In most cases, the filtering operation for analog signals is linear

Filtering The filtering operation of a linear analog filter is described by the convolution integral where x(t) is the input signal, y(t) is the output of the filter, and h(t) is the impulse response of the filter

Filtering A lowpass filter passes all low-frequency components below a certain specified frequency , called the cutoff frequency, and blocks all high-frequency components above A highpass filter passes all high-frequency components a certain cutoff frequency and blocks all low-frequency components below

Filtering A bandpass filter passes all frequency components between 2 cutoff frequencies, and , where , and blocks all frequency components below the frequency and above the frequency A bandstop filter blocks all frequency components between 2 cutoff frequencies, and , where , and passes all frequency components below the frequency and above the frequency

Filtering Figures below illustrate the lowpass filtering of an input signal composed of 3 sinusoidal components of frequencies 50 Hz, 110 Hz, and 210 Hz

Filtering Figures below illustrate highpass and bandpass filtering of the same input signal

Filtering There are various other types of filters
A filter blocking a single frequency component is called a notch filter A multiband filter has more than one passband and more than one stopband A comb filter blocks frequencies that are integral multiples of a low frequency

Filtering In many applications the desired signal occupies a low-frequency band from dc to some frequency Hz, and gets corrupted by a high-frequency noise with frequency components above Hz with In such cases, the desired signal can be recovered from the noise-corrupted signal by passing the latter through a lowpass filter with a cutoff frequency where

Digital Filter Design Objective - Determination of a realizable transfer function G(z) approximating a given frequency response specification is an important step in the development of a digital filter If an IIR filter is desired, G(z) should be a stable real rational function Digital filter design is the process of deriving the transfer function G(z) 10

Digital Filter Specifications
Usually, either the magnitude and/or the phase (delay) response is specified for the design of digital filter for most applications In some situations, the unit sample response or the step response may be specified In most practical applications, the problem of interest is the development of a realizable approximation to a given magnitude response specification 11

Digital Filter Specifications
We discuss in this course only the magnitude approximation problem There are four basic types of ideal filters with magnitude responses as shown below 12

Impulse Responses of Ideal Filters
Ideal lowpass filter - Ideal highpass filter - 13 Copyright Â© 2005, S. K. Mitra

Impulse Responses of Ideal Filters

Impulse Responses of Ideal Filters

Impulse Responses of Ideal Filters

Impulse Responses of Ideal Filters
Ideal discrete-time Hilbert transformer - 17 Copyright Â© 2005, S. K. Mitra

Impulse Responses of Ideal Filters

Digital Filter Specifications
As the impulse response corresponding to each of these ideal filters is noncausal and of infinite length, these filters are not realizable In practice, the magnitude response specifications of a digital filter in the passband and in the stopband are given with some acceptable tolerances In addition, a transition band is specified between the passband and stopband 19

Digital Filter Specifications
For example, the magnitude response of a digital lowpass filter may be given as indicated below 20

Digital Filter Specifications
As indicated in the figure, in the passband, defined by , we require that with an error , i.e., In the stopband, defined by , we require that with an error , i.e., 21

Digital Filter Specifications
- passband edge frequency - stopband edge frequency - peak ripple value in the passband - peak ripple value in the stopband Since is a periodic function of w, and of a real-coefficient digital filter is an even function of w As a result, filter specifications are given only for the frequency range 22

Digital Filter Specifications
Specifications are often given in terms of loss function A in dB Peak passband ripple dB Minimum stopband attenuation 23

Digital Filter Specifications
Magnitude specifications may alternately be given in a normalized form as indicated below 24

Digital Filter Specifications
Here, the maximum value of the magnitude in the passband is assumed to be unity - Maximum passband deviation, given by the minimum value of the magnitude in the passband - Maximum stopband magnitude 25

Digital Filter Specifications
For the normalized specification, maximum value of the gain function or the minimum value of the loss function is 0 dB Maximum passband attenuation - dB For , it can be shown that 26

Digital Filter Specifications
In practice, passband edge frequency and stopband edge frequency are specified in Hz For digital filter design, normalized bandedge frequencies need to be computed from specifications in Hz using 27

Digital Filter Specifications
Example - Let kHz, kHz, and kHz Then 28

Selection of Filter Type
The transfer function H(z) meeting the frequency response specifications should be a causal transfer function For IIR digital filter design, the IIR transfer function is a real rational function of : H(z) must be a stable transfer function and must be of lowest order N for reduced computational complexity 29

Selection of Filter Type
For FIR digital filter design, the FIR transfer function is a polynomial in with real coefficients: For reduced computational complexity, degree N of H(z) must be as small as possible If a linear phase is desired, the filter coefficients must satisfy the constraint: 30

Selection of Filter Type
Advantages in using an FIR filter - (1) Can be designed with exact linear phase, (2) Filter structure always stable with quantized coefficients Disadvantages in using an FIR filter - Order of an FIR filter, in most cases, is considerably higher than the order of an equivalent IIR filter meeting the same specifications, and FIR filter has thus higher computational complexity 31

Digital Filter Design: Basic Approaches
Most common approach to IIR filter design - (1) Convert the digital filter specifications into an analog prototype lowpass filter specifications (2) Determine the analog lowpass filter transfer function (3) Transform into the desired digital transfer function 32

Digital Filter Design: Basic Approaches
This approach has been widely used for the following reasons: (1) Analog approximation techniques are highly advanced (2) They usually yield closed-form solutions (3) Extensive tables are available for analog filter design (4) Many applications require digital simulation of analog systems 33

Digital Filter Design: Basic Approaches
FIR filter design is based on a direct approximation of the specified magnitude response, with the often added requirement that the phase be linear The design of an FIR filter of order M may be accomplished by finding either the length-(N+1) impulse response samples or the (N+1) samples of its frequency response 34

Digital Filter Design: Basic Approaches
Three commonly used approaches to FIR filter design - (1) Windowed Fourier series approach (2) Frequency sampling approach (3) Computer-based optimization methods 35

Gibbs Phenomenon Gibbs phenomenon - Oscillatory behavior in the magnitude responses of causal FIR filters obtained by truncating the impulse response coefficients of ideal filters 36 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon As can be seen, as the length of the lowpass filter is increased, the number of ripples in both passband and stopband increases, with a corresponding decrease in the ripple widths Height of the largest ripples remain the same independent of length Similar oscillatory behavior observed in the magnitude responses of the truncated versions of other types of ideal filters 37 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon Gibbs phenomenon can be explained by treating the truncation operation as an windowing operation: In the frequency domain where and are the DTFTs of and , respectively 38 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon Thus is obtained by a periodic continuous convolution of with 39 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon If is a very narrow pulse centered at (ideally a delta function) compared to variations in , then will approximate very closely Length M+1 of w[n] should be very large On the other hand, length M+1 of should be as small as possible to reduce computational complexity 40 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon A rectangular window is used to achieve simple truncation: Presence of oscillatory behavior in is basically due to: 1) is infinitely long and not absolutely summable, and hence filter is unstable 2) Rectangular window has an abrupt transition to zero 41 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon Oscillatory behavior can be explained by examining the DTFT of : has a main lobe centered at Other ripples are called sidelobes main lobe side lobe 42 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon Main lobe of characterized by its width defined by first zero crossings on both sides of As M increases, width of main lobe decreases as desired Area under each lobe remains constant while width of each lobe decreases with an increase in M Ripples in around the point of discontinuity occur more closely but with no decrease in amplitude as M increases 43 Copyright Â© 2005, S. K. Mitra

Gibbs Phenomenon Rectangular window has an abrupt transition to zero outside the range , which results in Gibbs phenomenon in Gibbs phenomenon can be reduced either: (1) Using a window that tapers smoothly to zero at each end, or (2) Providing a smooth transition from passband to stopband in the magnitude specifications 44 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Using a tapered window causes the height of the sidelobes to diminish, with a corresponding increase in the main lobe width resulting in a wider transition at the discontinuity Hann: Hamming: Blackman: 45 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Plots of magnitudes of the DTFTs of these windows for M = 50 are shown below: Rectangular window Hann window Gain, dB Gain, dB Hamming window Blackman window Gain, dB Gain, dB 46 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Magnitude spectrum of each window characterized by a main lobe centered at w = 0 followed by a series of sidelobes with decreasing amplitudes Parameters predicting the performance of a window in filter design are: Main lobe width Relative sidelobe level 47 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Main lobe width given by the distance between zero crossings on both sides of main lobe Relative sidelobe level given by the difference in dB between amplitudes of largest sidelobe and main lobe 48 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Observe Thus, Passband and stopband ripples are the same 49 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Distance between the locations of the maximum passband deviation and minimum stopband value Width of transition band 50 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
To ensure a fast transition from passband to stopband, window should have a very small main lobe width To reduce the passband and stopband ripple d, the area under the sidelobes should be very small Unfortunately, these two requirements are contradictory 51 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
In the case of rectangular, Hann, Hamming, and Blackman windows, the value of ripple does not depend on filter length or cutoff frequency , and is essentially constant In addition, where c is a constant for most practical purposes 52 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Rectangular window - dB, dB, Hann window - Hamming window - Blackman window - 53 Copyright Â© 2005, S. K. Mitra

Fixed Window Functions
Filter Design Steps - (1) Set (2) Choose window based on specified (3) Estimate M using (4) Find coefficients by multiplying ideal impulse response with the window function (5) Shift by M/2 samples to make the filter causal 54 Copyright Â© 2005, S. K. Mitra

FIR Filter Design Example
Lowpass filter of length 51 and 55 Copyright Â© 2005, S. K. Mitra

Kaiser Window - where is an adjustable parameter and is the modified zeroth-order Bessel function of the first kind: Note for u > 0 In practice 56 Copyright Â© 2005, S. K. Mitra