This action might not be possible to undo. Are you sure you want to continue?

# 9/22/13

Products

**Chapter 2: FIR filters - Digital Filter Design - mikroElektronika
**

Solutions Store Distributors Libstock C ontact Us

se arch he re

Login | C art (0)

**Digital Filter Design
**

TOC Chapter 1 Chapter 2 Chapter 3

**Featured Development Tools dsPICPRO4 Development System
**

The dsPICPRO4 supports the latest 64and 80-pin dsPIC30F microcontrollers from Microchip. It comes w ith a dsPIC30F6014A. The system includes an USB 2.0 programmer, mikroICD (In-Circuit Debugger), touch panel controller, CAN, RS485, DAC and RTC. [more info]

**Chapter 2: Finite Impulse Response (FIR) Filter
**

2.1. Introduction 2.2. FIR filter design methods 2.3. Window functions 2.4. Examples 2.5. Finite word-length effects

2.1 Introduction

FIR filters are digital filters with finite impulse response. They are also known as non-recursive digital filters as they do not have the feedback (a recursive part of a filter), even though recursive algorithms can be used for FIR filter realization.

**EasydsPIC4A Development System
**

EasydsPIC4A is a full-featured development system that supports the latest 18-, 28- and 40-pin dsPIC30F MCUs. It comes w ith the dsPIC30F4013 microcontroller. The board features a USB 2.0 programmer, mikroICD (In-Circuit Debugger), touch panel controller etc. [more info]

Figure 2-1-1. Block diagram s of FIR and IIR filters

FIR filters can be designed using different methods, but most of them are based on ideal filter approximation. The objective is not to achieve ideal characteristics, as it is impossible anyway, but to achieve sufficiently good characteristics of a filter. The transfer function of FIR filter approaches the ideal as the filter order increases, thus increasing the complexity and amount of time needed for processing input samples of a signal being filtered.

www.mikroe.com/chapters/view/72/#id24

1/100

9/22/13

**Chapter 2: FIR filters - Digital Filter Design - mikroElektronika
**

Figure 2-1-2. Ideal low -pass filter approxim ation

The resulting frequency response can be a monotone function or an oscillatory function within a certain frequency range. The waveform of frequency response depends on the method used in design process as well as on its parameters. This book describes the most popular method for FIR filter design that uses window functions. The characteristics of the transfer function as well as its deviation from the ideal frequency response depend on the filter order and window function in use. Each filter category has both advantages and disadvantages. This is the reason why it is so important to carefully choose category and type of a filter during design process. FIR filters can have linear phase characteristic, which is not like IIR filters that will be discussed in Chapter 3. Obviously, in such cases when it is necessary to have a linear phase characteristic, FIR filters are the only option available. If the linear phase characteristic is not necessary, as is the case with processing speech signals, FIR filters are not good solution at all. Figure 2-1-3 illustrates input and output signals of non-linear phase systems.

Figure 2-1-3. The effect of non-linear phase characteristic

The system introduces a phase shift of 0 radians at the frequency of ω, and π radians at three times that frequency. Input signal consists of natural frequency ω and one harmonic with the same amplitude at three times that frequency. Figure 2-1-3. shows the block diagram of input signal (left) and output signal (right). It is obvious that these two signals have different waveforms. The power of signals is not changed, nor the amplitudes of harmonics, only the phase of the second harmonic is changed. If we assume that the input is a speech signal whose phase characteristic is not of the essence, such distortion in the phase of the signal would be unimportant. In this case, the system satisfies all necessary requirements. However, if the phase characteristic is of importance, such a great distortion mustn’t be allowed. In order that the phase characteristic of a FIR filter is linear, the impulse response must be symmetric or anti-symmetric, which is expressed in the following way: h[n] = h[N-n-1] ; symmetric impulse response (about its middle element) h[n] = -h[N-n-1] ; anti-symmetric impulse response (about its middle element) One of the drawbacks of FIR filters is a high order of designed filter. The order of FIR filter is remarkably higher compared to an IIR filter with the same frequency response. This is the reason why it is so important to use FIR filters only when the linear phase characteristic is very important. A number of delay lines contained in a filter, i.e. a number of input samples that should be saved for the purpose of computing the output sample, determines the order of a filter. For example, if the filter is assumed to be of order 10, it means that it is necessary to save 10 input samples preceeding the current sample. All eleven samples will affect the output sample of FIR filter. The transform function of a typical FIR filter can be expressed as a polynomial of a complex variable z-¹. All the poles of the transfer function are located at the origin. For this reason, FIR filters are guaranteed to be stable, whereas IIR filters have potential to become unstable.

**2.2 Finite impulse response (FIR) filter design methods
**

Most FIR filter design methods are based on ideal filter approximation. The resulting filter approximates the ideal characteristic as the filter order increases, thus making the filter and its implementation more complex. The filter design process starts with specifications and requirements of the desirable FIR filter. Which method is to be used in the filter design process depends on the filter specifications and implementation. This chapter discusses the FIR filter design method using window functions.

www.mikroe.com/chapters/view/72/#id24

2/100

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Each of the given methods has its advantages and disadvantages. Thus, it is very important to carefully choose the right method for FIR filter design. Due to its simplicity and efficiency, the window method is most commonly used method for designing filters. The sampling frequency method is easy to use, but filters designed this way have small attenuation in the stopband. As we have mentioned above, the design process starts with the specification of desirable FIR filter.

**2.2.1 Basic concepts and FIR filter specification
**

First of all, it is necessay to learn the basic concepts that will be used further in this book. You should be aware that without being familiar with these concepts, it is not possible to understand analyses and synthesis of digital filters. Figure 2-2-1 illustrates a low-pass digital filter specification. The word specification actually refers to the frequency response specification.

Figure 2-2-1a. Low -pass digital filter specification

Figure2-2-1b. Low -pass digital filter specification

ωp – normalized cut-off frequency in the passband; ωs – normalized cut-off frequency in the stopband; δ1 – maximum ripples in the passband; δ2 – minimum attenuation in the stopband [dB]; ap – maximum ripples in the passband; and as – minimum attenuation in the stopband [dB].

www.mikroe.com/chapters/view/72/#id24

3/100

Digital Filter Design .com/chapters/view/72/#id24 4/100 .mikroe.9/22/13 Chapter 2: FIR filters . and ω is normalized frequency. High-pass digital filter specification www. Specifications for high-pass. Figure 2-2-2 illustrates a high-pass filter specification.mikroElektronika Frequency normalization can be expressed as follows: where: fs is a sampling frequency. Figure 2-2-2a. band-pass and band-stop filters are defined almost the same way as those for low-pass filters. f is a frequency to normalize.

com/chapters/view/72/#id24 5/100 . The same values are defined in both cases with the difference that in the later case the passband is substituded by the stopband and vice versa. Band-pass digital filter specification www.Digital Filter Design . Figure 2-2-3 illustrates a band-pass filter specification.9/22/13 Chapter 2: FIR filters . it is obvious that low-pass and high-pass filters have similar specifications.mikroe.mikroElektronika Figure 2-2-2b. Figure 2-2-3a. High-pass digital filter specification Comparing these two figures 2-2-1 and 2-2-2.

mikroe.mikroElektronika Figure 2-2-3b. Band-stop digital filter specification www. Figure 2-2-4a. Band-pass digital filter specification Figure 2-2-4 illustrates a band-stop digital filter specification.com/chapters/view/72/#id24 6/100 .9/22/13 Chapter 2: FIR filters .Digital Filter Design .

com/chapters/view/72/#id24 7/100 . It is very suitable for analysing discrete time-domain signals and systems.mikroe. x(n)={1. The Z-transform is defined as: where z is the complex number.4.mikroElektronika Figure 2-2-4b.1} . 0 ≤ n ≤ 8 z-transform is defined as follows: It becomes: The last expression represents the z-transform of the given signal. It is necessary to transform this signal through the ztransform and Fourier fransform. The Fourier transform can be found by rewriting the previous expression in terms of z as z=ejω.2.9/22/13 Chapter 2: FIR filters . It further becomes: Figure 2-2-5 illustrates the frequency spectrum of the given signal.3.Digital Filter Design .4.5.3. Band-stop digital filter specification 2. The z-transform is derived from the Fourier discrete time-domain transformation and is considered the basic operation in digital filter design process.2. www. Example: Assume that samples of a discrete-time signal x(n) are known.2. It converts a discrete time-domain signal into a complex frequency-domain representation.2 Z-transform The Z-transform is performed upon discrete-time signals.

Frequency spectrum of the given signal Comparing Z and Fourier transforms. When the transfer function is found.mikroe.2. it is easy to notice some similarities between them: In polar coordinate system.Digital Filter Design .mikroElektronika Figure 2-2-5.9/22/13 Chapter 2: FIR filters .1 Transform function of discrete-time systems The Z-transform is primarily used for finding the transfer function of linear discrete-time systems. Fourier transform in the z plane 2.com/chapters/view/72/#id24 8/100 . the Fourier transform is represented as a unit circle. In the z plane. it is www. which can be seen in Figure 2-2-6 below. the complex number z may be expressed as: The two last expressions lead us to the conclusion that the Fourier transform is just a special form of the z-transform for r=1. Figure 2-2-6.2.

The transfer function of discrete-time systems is defined as: where: bi are the feedforward filter coefficients (non-recursive part). can also be expressed as the convolution of the input signal x(n) and the impulse response h(n) of the system: In the frequency domain. so the expression above can be simplified in the following way: The impulse response of discrete-time system is obtained from inverse z-transform of the transfer function i.9/22/13 Chapter 2: FIR filters . qi are the zeros of the transfer function. shown in Figure 2-2-7. hardware implementation (described later) and synthesis.mikroElektronika necessary to consider its zeros and poles in the z plane. H0 is a constant. the discrete-time system.Digital Filter Design . i. and pj are the poles of the transfer function. shown in Figure 2-2-7. FIR filters do not have this recursive part of the transfer function. Example : The impulse response of a 10-th order FIR filter designed using the Hamming window (discussed in the next chapter) is: www. can be expressed as the multiplication of the Z-transform input signal X(z) and the transfer function H(z) of the system: which further gives: The first way of representing discrete-time systems is more suitable for software implementation itself.e.e. the transfer function of discrete-time system is actually the Z-transform of impulse response: where h(n) is the impulse response of discrete-time system.com/chapters/view/72/#id24 9/100 .mikroe. discrete-time system design. the discrete-time system. Figure 2-2-7. aj are the feedback filter coefficients (recursive part). The recursive part of the transfer function is actually a feedback of discrete-time system. whereas the later is more suitable for analyse. As we previously mentioned. Block diagram of a linear discrete-tim e system In the time domain.

0} The transfer function of this filter is found via the ztransform of impulse response: Using the following expression: it is possible to yield the transfer function of the fixed normalized frequency. .0127.2761. .4. .0248.0.com/chapters/view/72/#id24 10/100 . If for example ω = 0. 0.0.mikroe.0. 0. 0.2π then: One example of hardware realization of this filter is illustrated in Figure 2-2-8.0248.9/22/13 Chapter 2: FIR filters . 0.0638.mikroElektronika h(n) = {0. 0.Digital Filter Design .2761.0127.0638. .0. www.

9/22/13 Chapter 2: FIR filters . The location of zeros doesn’t affect the stabilty of discrete-time systems. only the zeros of the transfer function will be discussed in this chapter.2. In software implementation. which in this case means that the circular buffer is of length 16=2^4. According to their position it is possible to test stability of a discrete-time system. all poles of the discrete-time system transfer function must be located inside the unit circle.mikroe.com/chapters/view/72/#id24 11/100 . Filter stability will be discussed in more details along with IIR filters which have potential to become unstable because of the feedback they have. Frequency deviation depends on the spacing between the zeros of the FIR filter transfer function. detect round-off errors made due to software implementation of a filter as well as errors in the coefficients encountered during hardware implementation of a filter. An error in coefficient representation is always produced due to software and hardware implementation.2 Effect of the poles and zeros of the transfer function The location of zeros and poles of the transfer function is very important for discretetime system analyses and synthesis. This property is particularly typical of highorder filters because their zeros are very close each other. as shown in Figure 2-2-6. The finite word-length effect on the transform function of a FIR filter is clearly marked. 2. This property of FIR filters actually represents their essential adventage.25 Hz is designed using the Hann window. it ocurrs due to impossibility of representing the coefficients with absolute accuracy. From now on. which is very dangerous. Recalling that FIR flters do not have a feedback.mikroElektronika Figure 2-2-8. Such errors cause frequency deviation of discrete-time system designed. slight errors in coefficient representation may cause large frequency deviations. The result in both cases is that the value of coefficients differs from their value obtained in design process. Assume that a 50-th order low-pass FIR filter with normalized cut-off frequency of 0. FIR filter coefficient error affects more the frequency characteristic as the spacing between the zeros of the transfer function narrows. If this requirement is not satisfied. the system becomes unstable. However. Buffers are usually circular and their length can be expressed as 2^n.Digital Filter Design . www. Figure 2-2-9 illustrates the required and obtained frequency characteristic of a FIR filter.2. This causes a FIR filter to be always stable. FIR filter realization Software realization requires a buffer of minimum length 9. an error is triggered by the finite word-length effect. whereas in hardware implementation. which further means that the transfer function has no poles. In order that a discrete-time system is stable.

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Figure 2-2-9. Deviation from required frequency characteristic

The frequency deviation shown in Figure 2-2-9 is basically slight deviation, even though it is very large at certain points. The minimum attenuation and the width of transition region of the resulting IIR filter remain unchanged, so that such deviation is acceptable. However, as this is not a common case, it is necessary to be very careful when designing high order filters because the transfer function zeros get closer, while more affecting the resulting frequency characteristic.

**2.2.3 Ideal filter approximation
**

The ideal filter frequency response is used when designing FIR filters using window functions. The objective is to compute the ideal filter samples. FIR filters have finite impulse response, which means the ideal filter frequency sampling must be performed in a finite number of points. As the ideal filter frequency response is infinite, it is easy to produce sampling errors. The error is less as the filter order increases. Figure 2-2-10 illustrates the transfer functions of four standard ideal filters.

Figure 2-2-10. Transfer functions of four standard ideal filters

The ideal filter frequency response can be computed via inverse Fourier transform. The four standard ideal filters frequency responses are contained in the table 2-2-1 below.

www.mikroe.com/chapters/view/72/#id24

12/100

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Table 2-2-1. The frequency responses of four standard ideal filters

The value of variable n ranges between 0 and N, where N is the filter order. A constant M can be expressed as M = N / 2. Equivalently, N can be expressed as N = 2M. The constant M is an integer if the filter order N is even, which is not the case with odd order filters. If M is an integer (even filter order), the ideal filter frequency response is symmetric about its Mth sample which is found via expression shown in the table 2-2-1 above. If M is not an integer, the ideal filter frequency response is still symmetric, but not about some frequency response sample. Since the variable n ranges between 0 and N, the ideal filter frequency response has N+1 sample. If it is needed to find frequency response of a non-standard ideal filter, the expression for inverse Fourier transform must be used:

Non-standard filters are rarely used. However, if there is a need to use some of them, the integral above must be computed via various numerical methodes.

**2.2.4 FIR filter design using window functions
**

The FIR filter design process via window functions can be split into several steps:

1. Defining filter specifications; 2. Specifying a window function according to the filter specifications; 3. Computing the filter order required for a given set of specifications; 4. Computing the window function coefficients; 5. Computing the ideal filter coefficients according to the filter order; 6. Computing FIR filter coefficients according to the obtained window function and ideal filter coefficients; 7. If the resulting filter has too wide or too narrow transition region, it is necessary to change the filter order by increasing or decreasing it according to needs, and after that steps 4, 5 and 6 are iterated as many times as needed.

The final objective of defining filter specifications is to find the desired normalized frequencies (ωc, ωc1, ωc2), transition width and stopband attenuation. The window function and filter order are both specified according to these parameters. Accordingly, the selected window function must satisfy the given specifications. This point will be discussed im more detail in the next chapter (2.3). After this step, that is, when the window function is known, we can compute the filter order required for a given set of specifications. One of the techniques for computing is provided in chapter 2.3. When both the window function and filter order are known, it is possible to calculate the window function coefficients w[n] using the formula for the specified window function. This issue is also covered in the next chapter. After estimating the window function coefficients, it is necessary to find the ideal filter frequency samples. The expressions used for computing these samples are discussed in section 2.2.3 under Ideal filter approximation. The final objective of this step is to obtain the

www.mikroe.com/chapters/view/72/#id24

13/100

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

coefficients hd[n]. Two sequencies w[n] and hd[n] have the same number of elements. The next step is to compute the frequency response of designed filter h[n] using the following expression:

Lastly, the transfer function of designed filter will be found by transforming impulse response via Fourier transform:

or via Z-transform:

If the transition region of designed filter is wider than needed, it is necessary to increase the filter order, reestimate the window function coefficients and ideal filter frequency samples, multiply them in order to obtain the frequency response of designed filter and reestimate the transfer function as well. If the transition region is narrower than needed, the filter order can be decreased for the purpose of optimizing hardware and/or software resources. It is also necessary to reestimate the filter frequency coefficients after that. For the sake of precise estimates, the filter order should be decreased or increased by 1.

**2.2.5 FIR filter realization
**

FIR filter transfer function can be expressed as:

The frequency response realized in the time domain is of more interest for FIR filter realization (both hardware and software). The transfer function can be found via the z-transform of a FIR filter frequency response. FIR filter output samples can be computed using the following expression:

where:

x[k] are FIR filter input samples; h[k] are the coefficients of FIR filter frequency response; and y[n] are FIR filter output samples.

A good property of FIR filters is that they are less sensitive to the accuracy of constants than IIR filters of the same order. There are several types of FIR filter realization. This chapter covers direct, direct transpose and cascade realizations which are very convenient for the hardware implementation of a filter. As for the software implementation, direct and optimized realizations will be discussed in this book.

2.2.5.1 Direct realization

Direct realization of FIR filter is based on the direct implementation of this expression:

Direct realization is also known as a transversal filter. Figure 2-2-11 illustrates the block diagram describing the hardware direct realization of a FIR filter.

www.mikroe.com/chapters/view/72/#id24

14/100

mikroElektronika Figure 2-2-11. The value of the constant k is a minimum value for which the expression N ≤ 2^k is valid. most commonly used buffer is so called circular buffer the length of which can be expressed as 2^k. Accordingly: where the operator represents rounding down to a less value. the multiplication constants are the same as the transfer function coefficients. resulting in a FIR filter output sample. Performing a convolution operation upon filter coefficients (frequency response coefficients). As for software direct realization of the FIR filter. Figure 2-2-12.mikroe. circular buffer addressing is performed using addressing mode 16: www. Storing a new sample on the first available location. i. and 3. where N is the number of FIR filter coefficients. Since the buffer is 16 bits wide. Circular buffer of length 16 = 2^4 The algorithm used for software direct realization of FIR filter consists of: 1. Reading the samples of a signal being filtered. FIR filter direct realization For direct realization structure.e. 2. it is necessary to provide a buffer for minimum N samples. the FIR filter frequency response coefficients.9/22/13 Chapter 2: FIR filters . For its simplicity and speed.Digital Filter Design .com/chapters/view/72/#id24 15/100 .

A DDR.mikroElektronika Example: Assuming that a filter used in this example is a 5th order FIR filter. Design this filter using direct realization with circular buffer. filtering of input samples is performed as per formula below: 2. The buffer length needs to be 2^k.9/22/13 Chapter 2: FIR filters . 2 A DDR.com/chapters/view/72/#id24 16/100 . Figure 2-2-13 illustrates the block diagram describing hardware direct transpose realization of a FIR filter. 4 A DDR. 0 S T EP 0 1 2 3 4 5 6 7 8 9 10 x[0] x[1] x[2] x[3] x[4] x[5] x[6] x[7] x[7] x[7] x[6] x[6] x[6] x[5] x[5] x[5] x[5] x[4] x[4] x[4] x[4] x[4] x[3] x[3] x[3] x[3] x[3] x[3] x[2] x[2] x[2] x[2] x[2] x[2] x[2] x[1] x[1] x[1] x[1] x[1] x[1] x[1] x[9] x[0] x[0] x[0] x[0] x[0] x[0] x[0] x[8] x[8] Table 2-2-2. 3 A DDR. The buffer length is obtained in the following way: This means that the minimum length of circular buffer is 2^3 = 8.mikroe. 1 A DDR.5. Speaking about software implementation. whereas the shaded cells denote buffer locations that have been changed. the direct transpose realization must also have a buffer of minimum length N. The contents of the buffer after receiving the first 10 samples is shown in the table 2-2-2. 6 A DDR. 5 A DDR. 7 A DDR.2 Direct transpose realization Direct transpose realization is similar to direct realization in many ways.2. Input circular buffer after receiving 10 sam ples For software realization. www. Input samples are denoted by x[n]. where N is the number of FIR filter coefficients.Digital Filter Design .

www.mikroElektronika Figure 2-2-13. the same number of multipliers and the same coefficients to perform multiplication upon. ak2 are the multiplication coefficients of section k. although they can also be in direct transpose form realization. is commonly used for FIR filter hardware realization. Individual sections are mostly in direct form realization.Digital Filter Design .5. 2. The cascade realization is normally used for higher order filter realization. When using this realization.2. very convenient for its modular structure. Both structures have the same number of delay elements.9/22/13 Chapter 2: FIR filters . and ak1.com/chapters/view/72/#id24 17/100 . a filter is divided into several low-order sections. Figure 2-2-14 illustrates the block diagram describing the hardware cascade realization of a FIR filter. The second-order sections are most commonly used. The transfer function of the cascade realization looks as follows: where: M is the number of sections.3 Cascade realization Cascade realization. Direct transpose realization of a FIR filter There are no significant differences between direct and direct transpose realizations.mikroe.

but more demanding multipliers for realization. whereas Figure 2-2-16 illustrates that for odd N. because a reduction in the number of multipliers enhances the process of convolution (samples filtering process).4 Optimized realization Optimized realization has less. Optimized realization utilizes the symmetry of frequency response coefficients. Figure 2-2-15.9/22/13 Chapter 2: FIR filters . The cascade of second order sections is important for the realization of the filters of arbitrary order. the optimized realization may be used for these filters as well. Anyway. The main advantage of the cascade realization is its modularity. adders and delays is the same as for direct realization.mikroElektronika Figure 2-2-14. There are also anti-symmetric FIR filters that are beyond the scope of this book. otherwise very convenient for hardware implementation.2. This realization is most commonly used for software implementation of FIR filters. The symmetry of the coefficients of FIR filter frequency response can be expressed by equation below: This symmetry makes it possible for the transfer function to be expressed as follows: Figure 2-2-15 illustrates the block diagram of optimized realization for even N. FIR filter cascade realization The number of multipliers. Optim ized realization for odd frequency response www.mikroe. 2.Digital Filter Design .com/chapters/view/72/#id24 18/100 .5.

The point is to find these coefficients denoted by w[n]. side lobes.9/22/13 Chapter 2: FIR filters . This affects the stopband attenuation to become additionally higher. NO RM A L I Z ED L ENG T H O F T HE M A I N L O BE F O R N= 2 0 0. The simplicity of design process makes this method very popular.43π T RA NS I T I O N REG I O N F O R N= 2 0 0. transition region.Digital Filter Design .21π 0.mikroe.11π 0. However. This chapter provides a few methods for estimating coefficients and basic characteristics of the window itself as well as the result filters designed using these coefficients. i. Optim ized realization for even frequency response 2. minimum stopband attenuation of window function and minimum stopband attenuation of designed filter are described in more detail in Figure 2-3-1.31π 0. and The filter order according to the required specifications (selectivity and stopband attenuation). i.041π 0.e. Each function is a kind of compromise between the two following requirements: The higher the selectivity.12π 0.1π 0. The difference. When designing digital FIR filters using window functions it is necessary to specify: A window function to be used. i.e.23π 0. the narrower the transition region. www. A window is a finite array consisting of coefficients selected to satisfy the desirable requirements. a drawback of this method is that the minimum stopband attenuation is fixed for each function.13π 0. additional attenuation occurs under the process of designing a filter using window functions.32π M I NI M UM S T O P BA ND A T T ENUA T I O N O F W I NDO W F UNC T I O N 13 dB 26 dB 31 dB 36 dB 41 dB 46 dB 58 dB 91 dB M I NI M UM S T O P BA ND A T T ENUA T I O N O F DES I G NED F I L T ER 21 dB 26 dB 44 dB 39 dB 53 dB 51 dB 75 dB 109 dB W I NDO W F UNC T I O N Rectangular Triangular (Bartlett) Hann BartlettHanning Hamming Bohman Blackman BlackmanHarris Table 2-3-1.com/chapters/view/72/#id24 19/100 . and The higher suppression of undesirable spectrum.2π 0.e.21π 0. The exception is the Kaiser window described later in this chapter. the higher the stopband attenuation.mikroElektronika Figure 2-2-16. main lobe width. Table 2-3-1 below contains all window functions mentioned in this chapter and briefly compares their selectivity and stopband attenuation. These two requirements are interrelated.2π 0. which is very desirable.2π 0.14π 0. The following concepts such as the main lobe.3 Window functions The window method is most commonly used method for designing FIR filters.32π 0. Com parison of w indow functions Special attention should be paid to the fact that minimum attenuation of window function and that of the filter designed using that function are different in most cases.

NUM BER O F I T ERA T I O N 1 2 3 4 Table 2-3-2.com/chapters/view/72/#id24 20/100 . this would further result in increasing the filter order and its complexity as well. the stopband attenuation of these windows is not adjustable. The resulting filter order is 16. the required transition region is expressed as: fn2 .9/22/13 Chapter 2: FIR filters . Normalized frequencies are obtained in the following way: Transition region of the Hann window is 0.fn1 = 0. The cut-off frequencies of transition regions are normalized first. Example : Design a filter with the following characteristics: 1. It is found via iteration. This enables the designed filter to have the narrowest transition region. It is only possible to affect the transition region by increasing the filter order. it is necessary to compute window coefficients w[n] using expressions for the specified window.1 Rectangular Window www. Minimum stopband attenuation is 40dB.mikroElektronika Figure 2-3-1. m ain lobe w idth. The lower cut-off frequency of transition region is f1=2KHz. The table 2-3-2 provides performed iterations and other important information.mikroe. To satisfy the given specifications.Digital Filter Design . Looking at the table 2-3-1 above (last column). Besides.3. It is most preferable to specify a window with the least stopband attenuation that satisfies the given requirements. it is obvious that required attenuation can be reached using the Hann window. it is necessary to compute the filter order. Roughly estimated. The required order is somewhat higher and is found after performing several iterations. and 3.2π Since the required transition region is wider than that of a 20th order filter. side lobes. Filter Designer Tool is used for obtaining a first-order filter. After specifying the suitable window function. 2. and The upper cut-off frequency of transition region is f2=3KHz. Calculating filter order F I L T ER O RDER 12 14 16 15 F I L T ER A T T ENUA T I O N A T 3 KHZ 25 dB 33 dB 49 dB 38 dB After specifying the window function and filter order. the initial solution in this case can be a 12th order filter. 2. the filter order needs to be less than 20. such attenuation can be obtained using any other window following the Hann window (all the functions are sorted according to their stopband attenuation). For this reason it is preferable to start design process by specifying the appropriate window function on the basis of the stopband attenuation. Transition region between 2KHz and 3KHz. thus the higher stopband attenuation would be at a cost of the wider transition region for the same filter order. Since the filter specification also includes transition region. Main lobe.12π for a 20th order filter. Sampling frequency 10KHz. transition region As can be seen in the table 2-3-1 above. The sampling frequency is fs=10KHz.

The first lobe (refer to Figure 2-3-2) has attenuation of 13dB and the narrowest transition region. the minimum transition region is achieved. this window is characterized by extreme values. which can be expressed in the following way: w[n] = 1. but at a cost of stopband attenuation. Rectangular w indow in the tim e dom ain Figure 2-3-3 illustrates the frequency domain of rectangular window www.com/chapters/view/72/#id24 21/100 . therefore.mikroe. Namely. It is easy to find rectangular window coefficients as all coefficients between 0 and N-1 (N-filter order) are equal to 1.Digital Filter Design . 0 ≤ n ≤ N−1 Note that the rectangular window performs selection of N samples from a sequence of input samples. Unlike other window functions being a kind of compromise between requirements for as narrow transition region as possible and as high stopband attenuation as possible.mikroElektronika The rectangular window is rarely used for its low stopband attenuation. A filter designed using this window has minimum stopband attenuation of 21 dB.9/22/13 Chapter 2: FIR filters . but it does not perform sample scaling. Figure 2-3-2 illustrates coefficients in the time-domain. Figure 2-3-2.

Such a less attenuation is a result of cutoff samples within a window (a sequence of sampled frequencies). This function also represents a kind of compromise between requirements for as narrow transition region as possible and as higher stopband attenuation as possible.com/chapters/view/72/#id24 22/100 . The triangular window coefficients can be expressed as: Figure 2-3-4 illustrates coefficients in the time-domain. where the transition region is considered more important characteristic. Namely.mikroe. The first sample represents a sudden jump to some value (non-zero sample).e. the rectangular window is not preferable for digital filter design. whereas the selectivity is less. 2. wider transition region. Since initial requirements of a digital filter are predefined and due to less selectivity. www. As a result. This is why it is very important to be careful when specifying the window function and filter order as well. One of the advantages of designing filter using the triangular window is the simplicity of computing coefficients.mikroElektronika Figure 2-3-3. filters designed using this window have wider transition region than those designed using the rectangular window. Exactly these sudden jumps result in producing relatively sharp high-frequency components which lessen the stopband attenuation. The transition region narrows as the filter order increases.3. it is necessary to increase the filter order to narrow the transition region.Digital Filter Design . i. the stopband attenuation of this window is higher than that of the rectangular window. Increase in filter order affects the filter to become more complex and need more time for sample processing. Rectangular w indow in the frequency dom ain (spectrum ) For its less stopband attenuation. all sampled frequencies are equal to zero. Note the fact that the transition region is inversely proportional to the filter order N.9/22/13 Chapter 2: FIR filters . Due to it. This is the price to pay for producing the higher attenuation. The attenuation gets higher by making cut-off samples less sharp. it is necessary to have a higher order filter in order to keep the same tansition region as that of the filters designed with the rectangular window. Up to a zero sample (from which sampling starts).2 Triangular (Bartlett) window The triangular (Bartlett) window is one among many functions that lessens the effects of final samples. which results in reducing filter selectivity.

whereas it amounts to 44dB in the designed filter. Digital filters designed with this window have higher stopband attenuation than those designed with triangle function. The transition region is the same as for triangular window. In some cases. www. Figure 2-3-5. but it is considerably higher than that for rectangular window. which makes this function one of the most desirable for designing.3 Hann Window The Hann window is used to lessen bad effects on frequency characteristic produced by the final samples of a signal being filtered.9/22/13 Chapter 2: FIR filters . when high attenuations are not needed. Triangular w indow coefficients in the tim e-dom ain Figure 2-3-5.mikroe. 2.com/chapters/view/72/#id24 23/100 .3.Digital Filter Design . The first side lobe in the frequency domain of this filter has 31dB attenuation.mikroElektronika Figure 2-3-4. Triangular (Bartlett) w indow in the frequency dom ain (spectrum ) The attenuation of triangular window is low for most digital filter applications. this filter can be used because it provides an easy way of computing coefficients. illustrates the coefficients spectrum of the triangular window shown in Figure 2-3-4.

Refer to Figure 2-3-7 illustrating the coefficients of the Hann window. The Hann w indow coefficients in the tim e dom ain Figure 2-3-7. The Hann window coefficients can be expressed as: Figure 2-3-6.9/22/13 Chapter 2: FIR filters . The Hann window belongs to a class of generalized cosine windows which will be discussed in more details at the end of this chapter. Figure 2-3-6. The Hann w indow coefficients in the frequency dom ain www. illustrates the Hann window coefficients in the time domain. Already the second lobe has 41dB attenuation. whereas it amounts to 54dB for the designed filter.com/chapters/view/72/#id24 24/100 .mikroElektronika Another advantage of this window is the ability to realtively fast increase the stopband attenuation of the following lobes.mikroe.Digital Filter Design .

mikroElektronika As seen from the table 2-3-1. which is considered as its advantage. The difference is that the transition region of triangular window is computed in terms of -26dB attenuation. this function is one of most commonly used windows. Figure 2-3-8. The stopband attenuation of a filter designed with this window amounts to 39dB which is not at all a large value. the transition region of Hann window is wider than that of triangular window. For the same requirements for minimum attenuation. The Bartlett-Hanning w indow coefficients in the tim e dom ain www.Digital Filter Design .3. the conclusion is that Hann window has sharper fall than triangular one.9/22/13 Chapter 2: FIR filters . Figure 2-3-8. Considering that the transition region is almost the same as for triangular and Hann window. The Bartlett-Hanning window coefficients are expressed as: This window is in fact a combination of triangular (Bartlett) and Hann window and has higher minimum stopband attenuation than both of them. and in terms of -31dB attenuation for Hann window Accordingly. illustrates the Bartlett-Hanning window coefficients in the time domain.4 Bartlett-Hanning Window The Bartlett-Hannign window is another compromise between requirements for as narrow transition region as possible and as higher stopband attenuation as possible.com/chapters/view/72/#id24 25/100 .mikroe. 2. the Hann window will have a narrower transition region.

As seen in Figure 2-3-9. Figure 2-3-10 illustrates the Hamming window coefficients in the time domain.9/22/13 Chapter 2: FIR filters . the Bartlett-Hanning window is one of the best solutions to use. whereas the minimum stopband attenuation remains unchanged as the filter order increases.mikroe.mikroElektronika Figure 2-3-9.5 Hamming Window The Hamming window is one of the most popular and most commonly used windows.3. The transition region narrows. The transition region is somewhat wider than that of the Hann and Bartlett-Hanning windows. which is sufficient for most implementations of digital filters. Figure 2-3-10. Unlike minimum stopband attenuation. The Ham m ing w indow coefficients in the tim e dom ain www. 2. whereas the stopband attenuation is considerably higher. The Hamming window coefficients are expressed as: The Hamming window belongs to a class of generalized cosine functions which are described in more details at the end of this chapter. the transition region can be changed by changing the filter order. which is one of very desirable characteristics of digital filters.Digital Filter Design . the side lobes increase attenuation. A filter designed with the Hamming window has minimum stopband attenuation of 53dB. The Bartlett-Hanning w indow coefficients in the frequency dom ain When the stopband attenuation doesn’t need to be higher than 39dB.com/chapters/view/72/#id24 26/100 .

mikroe.Digital Filter Design .6 Bohman Window The Bohman window is a convolution of two semi-periods of a cosine function. The Ham m ing w indow coefficients in the frequency dom ain Figure 2-3-11 illustrates the Hamming window in the frequency domain. whereas Figure 2-3-13 illustrates its coefficients in the frequency domain.com/chapters/view/72/#id24 27/100 .3. The transition region and the main lobe are wider than those for Hamming window. whereas the filters designed with Bohman window have the stopband attenuation of 51dB. so that the minimum stopband attenuation is defined in terms of the second side lobe and amounts to 41dB. the first side lobe is attenuated. therefore.mikroElektronika Figure 2-3-11. As seen. The Bohman window coefficients are expressed as: Figure 2-3-12 illustrates the Bohman window coefficients in the time domain. but the stopband attenuation is higher. 2. All side lobes have almost the same maximum values (about -45dB).9/22/13 Chapter 2: FIR filters . The attenuation of the first side lobe for Bohman window is 46dB. www.

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Figure 2-3-12. The Bohm an w indow coefficients in the tim e dom ain

Figure 2-3-13. The Bohm an w indow coefficients in the frequency dom ain

Figure 2-3-13 illustrates the Bohman window coefficients in the frequency domain. As seen, the first side lobe has minimum attenuation of 46dB, whereas for designed filter it amounts to 51dB. The attenuation increases relatively fast. The second side lobe in the Bohman window frequency domain has the attenuation of 61dB, whereas for the filters designed with this window it amounts to 65dB. It should be noted that side lobes of such filters are different than shown in Figure 2-3-13. With regard to minimum attenuation as well as to mid-wide transition region, it can be concluded that Bohman window is suitable for most applications.

2.3.7 Blackman Window

The Blackman window is, along with Kaiser, Hamming and Blackman-Harris windows, considered most commonly used and the most popular windows. Relatively high attenuation makes this window very convenient for almost all applications. The minimum stopband attenuation of a filter designed with this window amounts to 75dB. The Blackman window coefficients are expressed as:

www.mikroe.com/chapters/view/72/#id24

28/100

9/22/13

frequency domain.

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Figure 2-3-14 illustrates the Blackman window coefficients in the time domain, whereas Figure 2-3-15. illustrates its coefficients in the

Figure 2-3-14. The Blackm an w indow coefficients in the tim e dom ain

Figure 2-3-15. The Blackm an w indow coefficients in the frequency dom ain

As seen from Figure 2-3-15, the Blackman window frequency domain reminds of the Hann window frequency domain. The difference is in attenuation of the first side lobe which amounts to 51dB, as well as in the main lobe which is somewhat wider. The side lobes, following the first one, cause additional stopband attenuation.

**2.3.8 Blackman-Harris Window
**

The Blackman-Harris window is definately one of the most well-known and most commonly used windows. It is characterized by high stopband attenuation and the widest transition region comparing to all windows mentioned in this chapter. However, increase in filter order (more complex filter) cannot affect the minimum stopband attenuation, but affects the transition region. The Blackman-Harris window has almost twice as wide transition region than, say, the Hamming window. Such a drawback (wide transition region) can be overcome by increasing the filter order. The result is a higher order filter (comparing to one designed with

www.mikroe.com/chapters/view/72/#id24

29/100

9/22/13

Chapter 2: FIR filters - Digital Filter Design - mikroElektronika

Hamming window) with twice as high stopband attenuation. It should be noted that the transition region of the Hamming window ranges between − 3dB and − 41dB (decrease of 38dB), whereas for Blackman-Harris window it is decreased by 88dB (from − 3dB to − 91dB ). The Blackman-Harris window has minimum stopband attenuation of 91dB, whereas for the filters designed with this window it amounts to 109dB. Such an attenuation is sufficient for any digital filter application. If it is possible to support a filter order that will be required by this window, then the Blackman-Harris window is probably the best soultion. The Blackman-Harris window coefficients are expressed as:

Figure 2-3-16. illustrates the Blackman-Harris window coefficients in the time domain, whereas Figure 2-3-16. illustrates its coefficients in the frequency domain.

Figure 2-3-16. The Blackm an-Harris w indow coefficients in the tim e dom ain

Figure 2-3-17. The Blackm an-Harris w indow coefficients in the frequency dom ain

www.mikroe.com/chapters/view/72/#id24

30/100

Values of param eter β Β 0 0.10 Kaiser Window As you know. but the BartlettHanning window has higher attenuation.mikroElektronika Figure 2-3-17. and Blackman window. The order of band-pass and bandstop filters.5 0. Their coefficients a. illustrates the main characteristics of the Blackman-Harris window in the frequency domain.1102(aa . Comparing Hann and Bartlett-Hanning windows. It can be approximated via expression: www.46 0.5 0. Minimum stopband attenuation is determined by the second side lobe having the minimum attenuation of 91dB. whereas an increase in filter order affects the transition region.42 B 0 0. Hann window.21) 0.4 + 0.5842(aa .com/chapters/view/72/#id24 31/100 .54 0. AA less than 21 between 21 and 50 more than 50 Table 2-3-4.21)^0.07886(aa . These are: Rectangular window. obtained from the expression above. The attenuation of other side lobes gradually increases. the main lobe is wide and the first side lobe is suppressed. and Δ ω is the width of (normalized) transition region. As seen. Hamming window.9/22/13 Chapter 2: FIR filters . An optimal window is a function that has maximum attenuation according to the given width of the main lobe. Each of these window functions is only a variation of the expression above.3.7) I0(*) is a modified zero order Bessel function of the first kind.Digital Filter Design . The coefficients of generalized cosine w indow functions 2. 2.9 Blackman-Harris Window The generalized cosine functions are a type of window functions whose coefficients can be obtained via expression: There are some window functions that also belong to this class.3. b and c are given in the table 2-3-3 below. Its coefficients are expressed as: where aa is the minimum stopband attenuation. W I NDO W F UNC T I O N Rectangular Hann Hamming Blackman A 1 0.8. The optimal window is also known as Kaiser window. should be multiplied by 2. There is one more thing of concern which says that the minimum stopband attenuation depends on the specified window.mikroe. it is obvious that both of them have the same transition region.08 Table 2-3-3. All this leads us to the conclusion that the windows described here are not optimal. The value of parameter β can be obtained from the table 2-3-4. each of the windows described above is a kind of compromise between requirements for as narrow transition region as possible (greater selectivity) and as higher stopband attenuation as possible.5 C 0 0 0 0.

It also provides examples of all types of filters as well as of all methodes described in the previous chapters. It means that the needed filter order is less by 4 than that obtained with the Hann window.mikroElektronika In most practical cases it is sufficient to consider the first 20 elements of this order. Assuming that it is required to design a filter with the following characteristics: 1. band-pass filter.mikroe.2. Fortunately. Transition region: The specified filter order is N=12. and band-stop filter.com/chapters/view/72/#id24 32/100 . Defining filter specifications. 2. 2.9/22/13 Chapter 2: FIR filters . Specifying a window function according to the filter specifications. 5. The design method used here is known as the window method. Computing the ideal filter coefficients according to the filter order. Example: What would a filter design with Kaiser window look like if we take into consideration the requirements given at the beginning of this chapter? The result of a filter designed with the Hann window is a 16th order filter.Digital Filter Design . the resulting filter order should be changed. Sampling frequency is 10KHz (fs). the changes to be made are slight. www. Computing the filter order according to the filter specifications and specified window function. Computing the coefficients of the window. f2). high-pass filter.4 Examples This chapter discusses various FIR filter design methods. and the filter order is increased or decreased by 2 at most. These are: 1. which means that there will be some exceptions and variations in practice. The FIR filter design process can be split into several steps as described in Chapter 2. the expression used to compute the filter order gives accurate results in approximately 98% cases. Transition region is between 2KHz and 3KHz (f1. It is important to say that all the expressions above are obtained in an empirical way.4 entitled Designing FIR filters using window functions. in order to design an optimal Kaiser filter it is necessary to know normalized width of transition region as well as minimum desirable stopband attenuation. As can be seen from all mentioned above. The four standard types of filters are used here: low-pass filter. Minimum stopband attenuation is 40dB (aa). For example. 3. 2. 4. and 3. Otherwise.

Computing the FIR filter coefficients according to the obtained window function and ideal filter coefficients.1 Filter design using Rectangular window 2.e.mikroe. some steps will be skipped. N+1=11. 5 and 6 are repeated after that as many times as needed. and 7. If the resulting filter has too wide or too narrow transition region. Normalized cut-off frequency ωc can be calculated using the following expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: www. Step 4: All coefficients of the rectangular window have the same value equal to 1. and Coefficients have indices between 0 and 10. 2. N=10. and steps 4.mikroElektronika 6.1. In every given example.9/22/13 Chapter 2: FIR filters . 0 ≤ n ≤10 Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. it is necessary to change the filter order. A total number of filter coefficients is larger by one. the FIR filter design process will be described through these steps in order to make it easier for you to note similarities and differencies between various design methodes.1 Example 1 Step 1: Type of filter – low-pass filter Filter specifications: Filter order – N=10 Sampling frequency – fs=20KHz Passband cut-off frequency – fc=2.5KHz Step 2: Method – filter design using rectangular window Step 3: Filter order is predetermined.Digital Filter Design . step 2 is skipped. window functions and design of various types of filters as well. The specified filter order is increased or decreased according to needs. If the filter order is known. i. step 3 is skipped. w[n] = 1 . Depending on the window function in use.4. If the window function to use is predetermined.com/chapters/view/72/#id24 33/100 .4.

There is no need to additionally change it. Figure 2-4-1.mikroElektronika The middle element is found via the following expression Step 6: The designed FIR filter coefficients are obtained via the following expression: The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.Digital Filter Design .com/chapters/view/72/#id24 34/100 . Filter realization: Figure 2-4-1 illustrates the direct realization of designed FIR filter. for the sake of linear phase characteristic. FIR filter direct realization www.9/22/13 Chapter 2: FIR filters . which is based on the fact that all FIR filter coefficients are. symmetric about their middle element. whereas Figure 2-4-2 illustrates the optimized realization of designed FIR filter.mikroe.

9/22/13 Chapter 2: FIR filters . N=8. Optim ized realization structure of FIR filter 2.4. Normalized cut-off frequency ωc can be calculated using the following expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: www. Coefficients have indices between 0 and 8. N+1=9.2 Example 2 Step 1: Type of filter – high-pass filter Filter specifications: Filter order – N=8 Sampling frequency– fs=20KHz Passband cut-off frequency – fc=5KHz Step 2: Method – filter design using rectangular window Step 3: Filter order is predetermined. w[n] = 1 .e.com/chapters/view/72/#id24 35/100 .Digital Filter Design .mikroElektronika Figure 2-4-2.1. 0 ≤ n ≤ 8 Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. i.mikroe. Step 4: All coefficients of the rectangular window have the same value equal to 1. A total number of filter coefficients is larger by 1.

whereas figure 2-4-4 illustrates the optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are.com/chapters/view/72/#id24 36/100 . There is no need to additionally change it. Filter realization: Figure 2-4-3 illustrates the direct realization of designed FIR filter.mikroe. FIR filter direct realization www.Digital Filter Design .9/22/13 Chapter 2: FIR filters . symmetric about their middle element. for the sake of linear phase characteristic.mikroElektronika The designed FIR filter coefficients are found via expression: The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Figure 2-4-3.

Digital Filter Design .com/chapters/view/72/#id24 37/100 . 0 ≤ n ≤14 Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.e.4. w[n] = 1 . N+1=15. Coefficients have indices between 0 and 14.1. i.mikroElektronika Figure 2-4-4.9/22/13 Chapter 2: FIR filters . N=14 A total number of filter coefficients is larger by 1.mikroe.5KHz Step 2: Method – filter design using rectangular window Step 3: Filter order is predetermined. Step 4: All coefficients of the rectangular window have the same value equal to 1. fc2=5. Normalized cut-off frequencies ωc1 and ωc2 can be found using the following expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the www.3 Example 3 Step 1: Type of filter – band-pass filter Filter specifications: Filter order – N=14 Sampling frequency – fs=20KHz Passband cut-off frequency – fc1=3KHz. FIR filter optim ized realization structure 2.

whereas figure 2-4-6 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are.mikroe.Digital Filter Design .1. for the sake of linear phase characteristic. FIR filter optim ized realization structure 2. There is no need to additionally change it. FIR filter direct realization Figure 2-4-6.9/22/13 impulse response coefficients of the ideal band-pass filter: Chapter 2: FIR filters . Filter realization: Figure 2-4-5 illustrates the direct realization of designed FIR filter. symmetric about their middle element.com/chapters/view/72/#id24 38/100 .4 Example 4 Step 1: Type of filter – band-stop filter Filter specifications: Filter order – N=14 Sampling frequency – fs=20KHz www. Figure 2-4-5.4.mikroElektronika Step 7: Filter order is predetermined.

5KHz A total number of filter coefficients is larger by 1.Digital Filter Design . w[n] = 1 . are: Step 7: Filter order is predetermined. and Coefficients have indices between 0 and 14. There is no need to additionally change it. N=14.com/chapters/view/72/#id24 39/100 .mikroe. N+1=15.mikroElektronika Stopband cut-off frequency .e. i.fc1=3KHz. Step 4: All coefficients of the rectangular window have the same value equal to 1. rounded to 6 digits.9/22/13 Step 2: Method – filter design using rectangular window Step 3: Filter order is predetermined. all coefficients are the same as in the previous example (band-pass filter with the same cut-off frequencies). Step 6: The designed FIR filter coefficients are found via expression: The FIR filter coefficients h[n]. fc2=5. 0 ≤ n ≤ 14 Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Filter realization: www. Chapter 2: FIR filters . Normalized cut-off frequencies ωc1 and ωc2 can be found using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Note that. but have the opposite sign. excepting the middle element.

4. FIR filter optim ized realization structure 2. for the sake of linear phase characteristic.mikroe.2.1 Example 1 Step 1: Type of filter – low-pass filter Filter specifications: Filter order– Nf=9 Sampling frequency – fs=20KHz Passband cut-off frequency – fc=2.com/chapters/view/72/#id24 40/100 .4.mikroElektronika Figure 2-4-7 illustrates the direct realization of designed FIR filter. Figure 2-4-7.2 Filter design using Bartlett window 2.9/22/13 Chapter 2: FIR filters . whereas figure 2-4-8 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are.Digital Filter Design . FIR filter direct realization Figure 2-4-8.5KHz Step 2: Method – filter design using Barlett window www. symmetric about their middle element.

Since the value of M is not an integer. Chapter 2: FIR filters . i. There is no need to additionally change it. whereas figure 2-4-10 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are. and Coefficients have indices between 0 and 8. N=Nf+1=10. the middle element representing a center of coefficients symmetry doesn’t exist.mikroElektronika A total number of filter coefficients is larger by 1.Digital Filter Design .mikroe.e. Nf=9. symmetric about their middle www.com/chapters/view/72/#id24 41/100 . Step 4: The coefficients of Bartlett window are expressed as: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are given in the expression below: where M is the index of middle coefficient. Normalized cut-off frequency ωc can be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .9/22/13 Step 3: Filter order is predetermined. 0 ≤ n ≤9 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Filter realization: Figure 2-4-9 illustrates the direct realization of designed FIR filter. for the sake of linear phase characteristic.

2 Example 2 Step 1: Type of filter – high-pass filter Filter specifications: Filter order – Nf=8 Sampling frequency – fs=20KHz Passband cut-off frequency – fc=5KHz Step 2: Method –filter design using Bartlett window Step 3: Filter order is predetermined.mikroElektronika Figure 2-4-9.mikroe.Digital Filter Design .e.9/22/13 element. A total number of filter coefficients is larger by 1. FIR filter direct realization Figure 2-4-10.2.4. Chapter 2: FIR filters .com/chapters/view/72/#id24 42/100 . Step 4: www. Nf=8. i. Coefficients have indices between 0 and 8. FIR filter optim ized realization structure 2. N=Nf+1=9.

www.com/chapters/view/72/#id24 43/100 . for the sake of linear phase characteristic.mikroElektronika The Bartlett window function coefficients are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. whereas figure 2-4-12 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are.mikroe. Normalized cut-off frequency ωc may be calculated via the following expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .9/22/13 Chapter 2: FIR filters . There is no need to additionally change it.Digital Filter Design . 0 ≤ n ≤ 8 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: Filter order is predetermined. Filter realization: Figure 2-4-11 illustrates the direct realization of designed FIR filter. symmetric about their middle element.

FIR filter direct realization Figure 2-4-12. FIR filter optim ized realization structure 2.com/chapters/view/72/#id24 44/100 . fc2=5.mikroElektronika Figure 2-4-11. www.e. N=Nf+1=15. and Coefficients have indices between 0 and 14. Nf=14.5KHz. Step 2: Method – filter design using Bartlett window Step 3: Filter order is predetermined.mikroe.9/22/13 Chapter 2: FIR filters . i.Digital Filter Design . A total number of filter coefficients is larger by 1.3 Example 3 Step 1: Type of filter – band-pass filter Filter specifications: Filter order– Nf=14. Sampling frequency – fs=20KHz.2. and Passband cut-off frequencies – fc1=3KHz.4.

mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .9/22/13 Step 4: The Balett window coefficients are found via expression: Chapter 2: FIR filters . whereas figure 2-4-14 illustrates optimized realization structure of www.Digital Filter Design .mikroe. There is no need to additionally change it. Filter realization: Figure 2-4-13 illustrates the direct realization of designed FIR filter.com/chapters/view/72/#id24 45/100 . 0 ≤ n ≤ 14 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.

and Stopband cut-off frequencies – fc1=3KHz.5KHz.Digital Filter Design .com/chapters/view/72/#id24 46/100 . FIR filter optim ized realization structure 2.2. Step 2: Method – filter design using Bartlett window Step 3: Filter order is predetermined. A total number of filter coefficients is larger by 1. Chapter 2: FIR filters . for the sake of linear phase characteristic. symmetric about Figure 2-4-13. www. Nf=14. N=Nf+1=15. Sampling frequency – fs=20KHz.e.mikroElektronika designed FIR filter which is based on the fact that all FIR filter coefficients are. i.4. and Coefficients have indices between 0 and 14.9/22/13 their middle element. FIR filter direct realization Figure 2-4-14.4 Example 4 Step 1: Type of filter – band-stop filter Filter specifications: Filter order – Nf=14.mikroe. fc2=5.

There is no need to additionally change it.Digital Filter Design . Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. but have the opposite sign.mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.9/22/13 Step 4: The coefficients of Bartlett window are found via expression: Chapter 2: FIR filters . 0 ≤ n ≤ 14 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.mikroe.com/chapters/view/72/#id24 47/100 . ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Note that. Ste p 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . excepting the middle element. all the coefficients are the same as in the previous example (band-pass filter with the same cut-off frequencies). Filter realization: www.

The similarity between the coefficients of band-pass and band-stop FIR filters is obvious. Figure 2-4-15.mikroElektronika Figure 2-4-15 illustrates the direct realization of designed FIR filter. explained in examples 3 and 4. have the same order.3.4.mikroe. for the sake of linear phase characteristic. 2. and bbp is the middle coefficient of the band-pass filter. it is easy to convert a band-pass FIR filter into a band-stop FIR filter having the same cut-off frequencies. low-pass and high-pass FIR filters are interrelated in the same way.3 Filter design using Hann window 2.bbp where: bbs is the middle coefficient of the band-stop filter.1 Example 1 www. Because of such similarity. Besides.9/22/13 Chapter 2: FIR filters . sampling frequency and filter order. whereas figure 2-4-16 illustrates optimized realization of designed FIR filter which is based on the fact that all FIR filter coefficients are. The only difference is that they are of the opposite sign. All coefficients of the band-stop FIR filter have the same absolute values as the corresponding coefficients of the band-pass FIR filter. symmetric about their middle element. FIR filter direct realization Figure 2-4-16.com/chapters/view/72/#id24 48/100 . which can be seen in examples describing Hann window.Digital Filter Design . FIR filter optim ized realization structure It is determined on purpose that FIR filters.4. The middle element of the band-stop filter is defined as: bbs = 1 .

Normalized cut-off frequency ωc can be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse reaponse coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .mikroElektronika Filter order – Nf=10. A total number of filter coefficients is larger by 1.Digital Filter Design . N=Nf+1=11. Step 4: The Hann window function coefficients are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Step 2: Method – filter design using Hann window Step 3: Filter order is predetermined. i. 0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: www. and Passband cut-off frequency – fc=2.9/22/13 Step 1: Type of filter – low-pass filter Filter specifications: Chapter 2: FIR filters . Nf=10.com/chapters/view/72/#id24 49/100 . Sampling frequency – fs=20KHz. and Coefficients have indices between 0 and 10.e.5KHz.mikroe.

Digital Filter Design . whereas figure 2-4-18 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Filter realization: Figure 2-4-17 illustrates the direct realization of designed FIR filter.9/22/13 Chapter 2: FIR filters .3. for the sake of linear phase characteristic. symmetric about their middle element. FIR filter optim ized realization structure 2. Figure 2-4-17.mikroElektronika Step 7: The filter order is predetermined. There is no need to additionally change it.mikroe. www.4.com/chapters/view/72/#id24 50/100 .2 Example 2 Step 1: Filter type – high-pass filter Filter specifications: Filter order – Nf=10. FIR filter direct realization Figure 2-4-18.

9/22/13 Sampling frequency – fs=20KHz. Normalized cut-off frequency ωc can be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . N=Nf+1=11.mikroElektronika A total number of filter coefficients is larger by 1. Chapter 2: FIR filters . Nf=10. Step 4: The Hann window function coefficients are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.Digital Filter Design .5KHz. There is no need to additionally change it. Step 2: Method –filter design using Hann window Step 3: Filter order is predetermined. and Coefficients have indices between 0 and 10. 0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.mikroe. and Passband cut-off frequency – fc=2. www.com/chapters/view/72/#id24 51/100 .e. i.

whereas figure 2-4-20 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. FIR filter direct realization Figure 2-4-20.5KHz. for the sake of linear phase characteristic.mikroElektronika Figure 2-4-19 illustrates the direct realization of designed FIR filter. and Passband cut-off frequency – fc1=3KHz. www. symmetric about their middle element.mikroe. Nf=14.3.3 Example 3 Step 1: Type of filter – band-pass filter Filter specifications: Filter order – Nf=14. fc2=5. Sampling frequency – fs=20KHz. Figure 2-4-19.9/22/13 Filter realization: Chapter 2: FIR filters . FIR filter optim ized realization structure 2.com/chapters/view/72/#id24 52/100 .4.Digital Filter Design . Step 2: Method – filter design using Hann window Step 3: Filter order is predtermined.

There is no need to additionally change it.com/chapters/view/72/#id24 53/100 .9/22/13 Coefficients have indices between 0 and 14. whereas figure 2-4-22 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Step 4: Chapter 2: FIR filters .mikroe. i.Digital Filter Design . 0 ≤ n ≤ 14 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Filter realization: Figure 2-4-21 illustrates the direct realization of designed FIR filter.mikroElektronika A total number of filter coefficients is larger by 1. N=Nf+1=15. www. for the sake of linear phase characteristic. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . and The Hann window function coefficients are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.e. symmetric about their middle element.

Step 2: Method – filter design using Hann window Step 3: Filter order is predetermined. Step 4: The Hann window function coefficients are found via expression: www. FIR filter optim ized realization structure 2. N=Nf+1=15. Nf=14. Sampling frequency – fs=20KHz.4. Coefficients have indices between 0 and 14.5KHz.com/chapters/view/72/#id24 54/100 . A total number of filter coefficients is larger by 1.3 Example 3 Step 1: Type of filter – band-stop filter Filter specifications: Filter order – Nf=14.mikroe. fc2=5.3.mikroElektronika Figure 2-4-21. and Passband cut-off frequency – fc1=3KHz. FIR filter direct realization Figure 2-4-22. i.9/22/13 Chapter 2: FIR filters .e.Digital Filter Design .

for the sake of linear phase characteristic. Step 6: The designed FIR filter coefficients are found via expression: h[n]=w[n] * hd[n] .9/22/13 Chapter 2: FIR filters . excepting the middle element.Digital Filter Design . Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.com/chapters/view/72/#id24 55/100 . Filter realization: Figure 2-4-23 illustrates the direct realization of designed FIR filter. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Note that. 0 ≤ n ≤ 14 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.mikroe. but have the opposite sign. There is no need to additionally change it. whereas figure 2-4-24 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. symmetric about their middle element. www. all coefficients are the same as in the previous example (band-pass filter with the same cut-off frequencies).

The similarity between low-pass and highpass FIR filter coefficients is obvious.com/chapters/view/72/#id24 56/100 . The middle element is defined as: blp = 1 . FIR filter optim ized realization structure It is specified on purpose that FIR filters.mikroe.4.bhp where: blp is the middle coefficient of a low-pass filter. All coefficients of the low-pass FIR filter have the same absolute values as the corresponding coefficients of the high-pass FIR filter. explained in examples 1 and 2. it is easy to convert a low-pass FIR filter into a high-pass FIR filter having the same cut-off frequencies.9/22/13 Chapter 2: FIR filters . have the same order. and bhp is the middle coefficient of a high-pass filter. 2.4 Filter design using Bartlett-Hanning window 2.4.mikroElektronika Figure 2-4-23.4.Digital Filter Design . The only difference is that they are of the opposite sign.1 Example 1 Step 1: Type of filter – low-pass filter Filter specifications: Filter order – Nf=9. Because of such similarity. www. sampiling frequency and filter order. FIR filter direct realization Figure 2-4-24.

whereas figure 2-4-26 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Normalized cut-off frequency ωc can be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . Chapter 2: FIR filters . and Passband cut-off frequency – fc=4KHz. and Coefficients have indices between 0 and 9. Nf=9.Digital Filter Design . i. Step 2: Method – filter design using Bartlett-Hanning window Step 3: Filter order is predetermined. N=Nf+1=10.mikroElektronika A total number of filter coefficients is larger by 1. for the sake of linear phase characteristic.9/22/13 Sampling frequency – fs=22050Hz.e.mikroe. symmetric about www. Filter realization: Figure 2-4-25 illustrates the direct realization of designed FIR filter. 0 ≤ n ≤ 9 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Step 4: The Bartlett-Hanning window function coefficients are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. There is no need to additionally change it.com/chapters/view/72/#id24 57/100 .

4.mikroElektronika Figure 2-4-25. Step 2: Method – filter design using Bartlett-Hanning window Step 3: Filter order is predetermined. FIR filter optim ized realization structure 2. Chapter 2: FIR filters .Digital Filter Design .e. A total number of filter coefficients is larger by 1.4. Step 4: www. N=Nf+1=11. and Passband cut-off frequency – fc=4KHz.2 Example 2 Step 1: Type of filter – high-pass filter Filter specifications: Filter order – Nf=10.mikroe. i. and Coefficients have indices between 0 and 10. FIR filter direct realization Figure 2-4-26. Nf=10. Sampling frequency – fs=22050Hz.com/chapters/view/72/#id24 58/100 .9/22/13 their middle element.

mikroElektronika The Bartlett-Hanning window function coefficients are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. There is no need to additionally change it. whereas figure 2-4-28 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. for the sake of linear phase characteristic.mikroe. Normalized cut-off frequency ωc may be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . symmetric about their middle element.Digital Filter Design .com/chapters/view/72/#id24 59/100 . www.9/22/13 Chapter 2: FIR filters . 0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Filter realization: Figure 2-4-27 illustrates the direct realization of designed FIR filter.

Digital Filter Design .3 Example 3 Step 1: Type of filter – band-pass filter Filter specifications: Filter order – Nf=12.e. and Passband cut-off frequency – fc1=2KHz.9/22/13 Chapter 2: FIR filters . and Coefficients have indices between 0 and 12.mikroe. A total number of filter coefficients is larger by 1.4.4. Sampling frequency – fs=22050Hz. Step 2: Method – filter design using Bartlett-Hanning window Step 3: Filter order is predetermined. i.com/chapters/view/72/#id24 60/100 . N=Nf+1=13. FIR filter optim ized realization structure 2. fc2=5KHz. FIR filter direct realization Figure 2-4-28. Step 4: The Bartlett-Hanning window function coefficients are found via expression: www. Nf=12.mikroElektronika Figure 2-4-27.

Filter realization: Figure 2-4-29 illustrates the direct realization of designed FIR filter.9/22/13 Chapter 2: FIR filters . for the sake of linear phase characteristic. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .mikroe.com/chapters/view/72/#id24 61/100 . www. symmetric about their middle element. whereas figure 2-4-30 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.Digital Filter Design .mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. There is no need to additionally change it. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.

i.9/22/13 Chapter 2: FIR filters .mikroElektronika Figure 2-4-29. and Coefficients have indices between 0 and 12. Nf=12.Digital Filter Design .com/chapters/view/72/#id24 62/100 . Sampling frequency – fs=22050Hz.e. Step 2: Method – filter design using Bartlett-Hanning window Step 3: Filter order is predetermined.mikroe. A total number of filter coefficients is larger by 1.4 Example 4 Step 1: Type of filter – band-stop filter Filter specifications: Filter order – Nf=12. Step 4: www. fc2=6KHz.4. FIR filter optim ized realization structure 2.4. and Passband cut-off frequencies – fc1=2KHz. FIR filter direct realization Figure 2-4-30. N=Nf+1=13.

com/chapters/view/72/#id24 63/100 . symmetric about their middle element.mikroElektronika The Bartlett-Hanning window function coefficients are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. ωc1 and ωc2 with expression for the impulse reaponse coefficients of the ideal band-stop filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .mikroe. www. whereas figure 2-4-32 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. There is no need to additionally change it. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Filter realization: Figure 2-4-31 illustrates the direct realization of designed FIR filter. for the sake of linear phase characteristic. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.9/22/13 Chapter 2: FIR filters .Digital Filter Design .

and Minimum stopband attenuation – 40dB.mikroe.4. Passband cut-off frequency – fc1=3KHz. Step 2: Method – filter design using Hamming window Step 3: For the first iteration. www.Digital Filter Design .1 Example 1 Step 1: Type of filter – low-pass filter Filte specifications: Sampling frequency – fs=22050Hz. the filter order can be determined from the table 2-4-1 below.5 Filter design using Hamming window 2. Stopband cut-off frequency – fc2=6KHz. FIR filter direct realization Figure 2-4-32.4.com/chapters/view/72/#id24 64/100 .mikroElektronika Figure 2-4-31.9/22/13 Chapter 2: FIR filters . FIR filter optim ized realization structure 2.5.

9/22/13 W I NDO W F UNC T I O N Rectangular Triangular (Bartlett) Hann BartlettHanning Hamming Bohman Blackman BlackmanHarris NO RM A L I Z ED L ENG T H O F T HE M A I N L O BE F O R N= 2 0 0.com/chapters/view/72/#id24 65/100 . N=Nf+1=11.2π 0. Normalized cut-off frequency ωc can be calculated using expression: www.32π M I NI M UM S T O P BA ND A T T ENUA T I O N O F W I NDO W F UNC T I O N 13 dB 26 dB 31 dB 36 dB 41 dB 46 dB 58 dB 91 dB M I NI M UM S T O P BA ND A T T ENUA T I O N O F DES I G NED F I L T ER 21 dB 26 dB 44 dB 39 dB 53 dB 51 dB 75 dB 109 dB Table 2-4-1.2π 0. A total number of filter coefficients is larger by 1. i. Com parison of w indow functions Using the specifications for the transition region of the required filter.13π 0.1π 0.mikroElektronika T RA NS I T I O N REG I O N F O R N= 2 0 0.21π 0. the filter order can be half of that.32π 0.31π 0.2π 0. For the first iteration.43π Chapter 2: FIR filters .14π 0.12π 0. and Coefficients have indices between 0 and 10.041π 0.mikroe. Filter order is Nf=10.23π 0. it is possible to compute cut-off frequencies: The required transition region of the filter is: The transition region of the filter to be designed is approximately twice that of the filter given in the table above. Step 4: The Hamming window function coefficients are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.e.11π 0.Digital Filter Design .21π 0.

It is explained. along with Fourier transformation. Starting from the impulse response. Figure 2-4-33. The attenuation at the frequency of 6KHz amounts to 32. the first thing that should be done is the Z-transform. Another way is to compute the attenuation at the frequency of 6KHz.mikroe. It is obtained in the Filter Designer Tool program. It is necessary to increase the filter order.9/22/13 Chapter 2: FIR filters .96dB only.com/chapters/view/72/#id24 66/100 . Frequency characteristic of the resulting filter Figure 2-4-33 illustrates the frequency characteristic of the resulting filter.Digital Filter Design . the resulting filter doesn’t satisfy the required specifications. in chapter 2-2-2. 0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: Analyse in the frequency domain is performed using the Filter Designer Tool program.mikroElektronika The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . It is easy to obtain the Fourier transformation via the Z-transform: www. As seen. which is not sufficient.

9/22/13 Chapter 2: FIR filters . The filter order is incremented by two. Step 3: Filter order is Nf=12.mikroe.mikroElektronika According to the analyse performed using Filter Designer Tool. The whole process of designing filter is repeated from the step 3. Step 4: The Hamming window function coefficients are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. A total number of filter coefficients is larger by 1.com/chapters/view/72/#id24 67/100 .e. N=Nf+1=13. i. it is confirmed that the filter order has to be incremented. Normalized cut-off frequency ωc can be calculated using expression: www. and Coefficients have indices between 0 and 12.Digital Filter Design .

Frequency characteristic of the resulting filter Figure 2-4-34 illustrates the frequency characteristic of the resulting filter. As seen. symmetric about their middle element.Digital Filter Design . the resulting filter doesn’t satisfy the given specifications. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: Analyse in the frequency domain is performed using the Filter Designer Tool program. Filter realization: Figure 2-4-35 illustrates the direct realization of designed FIR filter. The attenuation at the frequency of 6KHz amounts to 45.com/chapters/view/72/#id24 68/100 . www. which is not sufficient. for the sake of linear phase characteristic.9/22/13 response coefficients of the ideal low-pass filter: Chapter 2: FIR filters .mikroElektronika The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . Figure 2-4-34. It is necessary to change the filter order.mikroe. whereas figure 2-4-36 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.26dB only.

2 Example 2 Step 1: Type of filter – high-pass filter Filte specifications: Filter order – Nf=10.mikroElektronika Figure 2-4-35.4. A total number of filter coefficients is larger by 1.9/22/13 Chapter 2: FIR filters . Step 2: Method – filter design using Hamming window Step 3: Filter order is predetermined. and Passband cut-off frequency – fc=4KHz. FIR filter direct realization Figure 2-4-36. and Coefficients have indices between 0 and 10. Nf=10.Digital Filter Design . Step 4: The Hamming window function coefficients are found via expression: www.mikroe. N=Nf+1=11. Sampling frequency – fs=22050Hz.5.e.com/chapters/view/72/#id24 69/100 . FIR filter optim ized realization structure 2. i.

com/chapters/view/72/#id24 70/100 . 0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. Filter realization: Figure 2-4-37 illustrates the direct realization of designed FIR filter. Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.Digital Filter Design .mikroe. for the sake of linear phase characteristic.9/22/13 Chapter 2: FIR filters . symmetric about their middle element. There is no need to additionally change it. whereas figure 2-4-38 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Normalized cut-off frequency ωc can be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .mikroElektronika The Hamming window function is one of rare standard windows where w[0] > 0 is in effect. www.

Step 2: Method – filter design using Hamming window Step 3: Filter order is predetermined. N=Nf+1=13.com/chapters/view/72/#id24 71/100 . FIR filter direct realization Figure 2-4-38. A total number of filter coefficients is larger by 1.Digital Filter Design .3 Example 3 Step 1: Type of filter – band-pass filter Filte specifications: Filter order – Nf=12. Passband cut-off frequency – fc1=2KHz.mikroElektronika Figure 2-4-37. and Coefficients have indices between 0 and 12. Step 4: The Hamming window function coefficients are found via expression: www. Nf=12. fc2=5KHz. i.4. FIR filter optim ized realization structure 2.e.mikroe. Sampling frequency – fs=16KHz.5.9/22/13 Chapter 2: FIR filters .

com/chapters/view/72/#id24 72/100 . There is no need to additionally change it.mikroe.Digital Filter Design . symmetric about their middle elements.mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.9/22/13 Chapter 2: FIR filters . ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. www. whereas figure 2-4-40 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. for the sake of linear phase characteristic. Filter realization: Figure 2-4-39 illustrates the direct realization of designed FIR filter.

A total number of filter coefficients is larger by 1.Digital Filter Design . Sampling frequency – fs=16000Hz.4 Example 4 Step 1: Type of filter – band-stop filter Filte specifications: Filter order – Nf=12. Step 2: Method – filter design using Hamming window Step 3: Filter order is predetermined.mikroElektronika Figure 2-4-39. Step 4: The Bartlett-Hanning window function coefficients are found via expression: www. and Passband cut-off frequency – fc1=2KHz. FIR filter optim ized realization structure 2.5. FIR filter direct realization Figure 2-4-40.9/22/13 Chapter 2: FIR filters .e. and Coefficients have indices between 0 and 12. fc2=6KHz. i.mikroe.4. N=Nf+1=13. Nf=12.com/chapters/view/72/#id24 73/100 .

Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.com/chapters/view/72/#id24 74/100 . There is no need to additionally change it. for the sake of linear phase characteristic.mikroe. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. www.Digital Filter Design . ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . Filter realization: Figure 2-4-41 illustrates the direct realization of designed FIR filter. symmetric about their middle element.9/22/13 Chapter 2: FIR filters . whereas figure 2-4-42 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.

4. 3 multiplication operations in optimized realization structure. i. the impulse response of the resulting filter contains large number of zero values. you should tend to specify the value representing a multiple of the passband width.6. after which the number of iterations.Digital Filter Design .e. is less.com/chapters/view/72/#id24 75/100 . The forth example explains the way of designing a band-stop filter.mikroe.1 Example 1 Step 1: Type of filter – low-pass filter Filte specifications: www. correction steps is reduced.9/22/13 Chapter 2: FIR filters . FIR filter direct realization Figure 2-4-42. i. only 5 multiplication operations are performed in direct realization of a twelfth-order FIR filter. If it is possible to specify the sampling frequency from a certain frequency range.5π = π/2.mikroElektronika Figure 2-4-41.e.6 Filter design using Bohman window 2. As can be seen. FIR filter optim ized realization structure The first example (low-pass filter designed using Hamming window) explains the algorithm used to compute the needed filter order when it is unknown. These zeros appear in impulse response because of the stopband width which amounts to 0. The number of zeros contained in an impulse response is larger in this case. which results in reducing the number of multiplication operations in design process. otherwise the most demanding operation in filtering process. The filter order can also be found using Kaiser window. whereas the number of multiplications.4. 2. In the given example.

0 ≤ n ≤ 10 The FIR filter coefficients h[n] rounded to 6 digits are: www. Step 4: The Bohman window function coefficients are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Chapter 2: FIR filters .9/22/13 Filter order – Nf=10. Step 2: Method – filter design using Bohman window Step 3: Filter order is Nf=10. i.com/chapters/view/72/#id24 76/100 .mikroElektronika A total number of filter coefficients is larger by 1. Normalized cut-off frequency ωc may be computed using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . and Passband cut-off frequency – fc=5KHz. Sampling frequency – fs=20KHz. N=Nf+1=11.e.mikroe. and Coefficients have indices between 0 and 10.Digital Filter Design .

There is no need to additionally change it. Stopband cut-off frequency – fc2=4KHz. whereas figure 2-4-44 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.9/22/13 Step 7: The filter order is predetermined.6. Passband cut-off frequency – fc1=1. www. Figure 2-4-43. and Minimum stopband attenuation – 35dB. Filter realization: Chapter 2: FIR filters .mikroElektronika Figure 2-4-43 illustrates the direct realization of designed FIR filter. FIR filter direct realization Figure 2-4-44. symmetric about their middle element.com/chapters/view/72/#id24 77/100 .2 Example 2 Step 1: Type of filter – high-pass filter Filte specifications: Sampling frequency – fs=22050Hz.mikroe. FIR filter optim ized realization structure 2.Digital Filter Design .4.5KHz. for the sake of linear phase characteristic.

31π 0. i. This value is specified according to the data contained in the table 2-4-2 below: NO RM A L I Z ED L ENG T H O F T HE M A I N L O BE F O R N= 2 0 0. The smallest change is ±2. the high-pass FIR filter must be of even order.9/22/13 Step 2: Method – filter design using Bohman window Step 3: The needed filter order is determined via iteration. A total number of filter coefficients is larger by 1. Filter order is Nf=18.12π 0. during filter design process. and Coefficients have indices between 0 and 18. In this case. It means that filter order can be changed in odd steps. it is possible to compute cut-off frequencies: The required transition region is: The transition region of the filter to be designed is somewhat wider than that of the filter given in table 2-4-2. the filter order can be lower.32π 0.32π M I NI M UM S T O P BA ND A T T ENUA T I O N O F W I NDO W F UNC T I O N 13 dB 26 dB 31 dB 36 dB 41 dB 46 dB 58 dB 91 dB M I NI M UM S T O P BA ND A T T ENUA T I O N O F DES I G NED F I L T ER 21 dB 26 dB 44 dB 39 dB 53 dB 51 dB 75 dB 109 dB W I NDO W F UNC T I O N Rectangular Triangular (Bartlett) Hann BartlettHanning Hamming Bohman Blackman BlackmanHarris Table 2-4-2.23π 0.13π 0. The same applies to band-pass and band-stop filters.mikroElektronika It is necessary to specify the initial value of filter order that is to be changed as many times as needed.21π 0. Step 4: The coefficients of Bohman window are found via expression: www.2π 0. can be decreased by 2 for the purpose of defining initial value.14π 0. Com parison of w indow functions According to the specifications for the transition region of required filter.21π 0. N=Nf+1=19.11π 0.2π 0.e.Digital Filter Design .2π 0.mikroe.041π 0.1π 0. the filter order.43π T RA NS I T I O N REG I O N F O R N= 2 0 0. Unlike the low-pass FIR filter. For the first iteration.com/chapters/view/72/#id24 78/100 . Chapter 2: FIR filters . comparing to that from the table (20).

However. Frequency characteristics of the resulting filter Figure 2-4-45 illustrates the frequency characteristic of the resulting filter. Since the filter order must be changed by an even number. Normalized cut-off frequency ωc is equal to passband cut-off frequency: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .Digital Filter Design . The filter order is decreased by 2. The whole process of designing filters is repeated from the step 3 on. the specified value is -2.9/22/13 Step 5: Chapter 2: FIR filters . It is obtained in the Filter Designer Tool program. 0 ≤ n ≤ 18 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: Analyse in the frequency domain is performed using the Filter Designer Tool program. Step 3: www. which is more than enough. Figure 2-4-45.04dB only. the final objective when designing a filter is to find a minimum filter order that satisfies the filter specifications.com/chapters/view/72/#id24 79/100 .mikroe. As seen. the resulting filter satisfies the required specifications.mikroElektronika The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. The attenuation at the frequency of 1500Hz amounts to 37.

i.9/22/13 Filter order is Nf=16. Chapter 2: FIR filters . 0 ≤ n ≤ 16 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: www.com/chapters/view/72/#id24 80/100 .mikroElektronika A total number of filter coefficients is larger by 1.Digital Filter Design . Step 4: The coefficients of Bohman window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. N=Nf+1=17.mikroe. Normalized cut-off frequency ωc is equal to the passband cut-off frequency: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . and Coefficients have indices between 0 and 16.e.

The objective is to find the minimum filter order.e. the correct order is probably 16. Since the attenuation is close to the required attenuation. However. Figure 2-4-46. As seen. and Coefficients have indices between 0 and 14. Step 4: The coefficients of Bohman window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.com/chapters/view/72/#id24 81/100 . Step 3: Filter order is predetermined. The filter order is decreased by 2. Normalized cut-off frequency ωc is equal to passband cut-off freqency: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse reaponse coefficients of the ideal high-pass filter: www. The figure is obtained in the Filter Designer Tool program. the specified value is -2. it is necessary to check it. i.mikroElektronika Analyse in the frequency domain is performed using the Filter Designer Tool program.mikroe. The whole process of designing filter is repeated from the step 3 on. therefore. Frequency characteristic of the resulting filter Figure 2-4-46 illustrates the frequency characteristic of the resulting filter. A total number of filter coefficients is larger by 1. Nf=14. N=Nf+1=15.9/22/13 Chapter 2: FIR filters .Digital Filter Design . the resulting filter satisfies the required specifications. Since the filter order must be changed by an even number.

mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .24dB only.Digital Filter Design . The previous value (Nf=16) represents the minimum FIR filter order that satisfies the given specifications.9/22/13 Step 6: Chapter 2: FIR filters . whereas impulse response of the resulting filter is as follows: Filter realization: Figure 2-4-48 illustrates the direct realization of designed FIR filter. The filter order is Nf=16. the resulting filter doesn’t satisfy the required specifications. Frequency characteristic of the resulting filter Figure 2-4-47 illustrates the frequency characteristic of the resulting filter. whereas figure 2-4-49 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. The attenuation at the frequency of 1500KHz amounts to 26. 0 ≤ n ≤ 14 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: Analyse in the frequency domain is performed using the Filter Designer Tool program. symmetric about their middle element. As seen. for the sake of linear phase characteristic. Figure 2-4-47. www. The figure is obtained in the Filter Designer Tool program. which is not sufficient.com/chapters/view/72/#id24 82/100 .mikroe.

e. and Passband cut-off frequency – fc1=4KHz. fc2=15025Hz.9/22/13 Chapter 2: FIR filters . Step 4: The coefficients of Bohman window are found via expression: www.4. A total number of filter coefficients is larger by 1. FIR filter direct realization Figure 2-4-49.mikroElektronika Figure 2-4-48.mikroe.3 Example 3 Step 1: Type of filter – band-pass filter Filte specifications: Filter order – Nf=12. and Coefficients have indices between 0 and 12. Nf=12.6.Digital Filter Design .com/chapters/view/72/#id24 83/100 . i. FIR filter optim ized realization structure 2. Sampling frequency – fs=44100Hz. Step 2: Method – filter design using Bohman window Step 3: Filter order is predetermined. N=Nf+1=13.

Digital Filter Design . for the sake of linear phase characteristic. www. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. whereas figure 2-4-51 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are.mikroElektronika Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Filter realization: Figure 2-4-50 illustrates the direct realization of designed FIR filter.mikroe. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.9/22/13 Chapter 2: FIR filters .com/chapters/view/72/#id24 84/100 . symmetric about their middle element. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The coefficients of designed FIR filter are found via expression: h[n] = w[n] * hd[n] . There is no need to additionally change it.

mikroe. Step 4: www.6. and Passband cut-off frequency – fc1=2KHz. Step 2: Method – filter design using Bohman window Step 3: Filter order is predetermined. FIR filter optim ized realization structure 2. N=Nf+1=13. A total number of filter coefficients is larger by 1.Digital Filter Design . FIR filter direct realization Figure 2-4-51. Nf=12. fc2=6KHz.9/22/13 Chapter 2: FIR filters . i.e. and Coefficients have indices between 0 and 12.4 Example 4 Step 1: Type of filter – band-stop filter Filte specifications: Filter order – Nf=12. Sampling frequency – fs=16000Hz.com/chapters/view/72/#id24 85/100 .4.mikroElektronika Figure 2-4-50.

whereas figure 2-4-53 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Filter realization: Figure 2-4-52 illustrates the direct realization of designed FIR filter.mikroe.Digital Filter Design .com/chapters/view/72/#id24 86/100 . ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . There is no need to additionally change it.9/22/13 Chapter 2: FIR filters .mikroElektronika The coefficients of Bohman window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Normalized cut-off frequencies ωc1 and ωc2 can be calculated using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. for the sake of linear phase characteristic. symmetric about www. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined.

Coefficients have indices between 0 and 12.7.Digital Filter Design . Nf=12.1 Example 1 Step 1: Type of filter – low-pass filter Filte specifications: Filter order – Nf=12. FIR filter direct realization Figure 2-4-53. A total number of filter coefficients is larger by 1. Sampling frequency – fs=44100KHz.com/chapters/view/72/#id24 87/100 .mikroe. Chapter 2: FIR filters . N=Nf+1=13.4.e. and Attenuation of 0dB at 0Hz – 0dB. FIR filter optim ized realization structure 2. Step 2: Method –Filter design using Blackman window Step 3: Filter order is predetermined. Passband cut-off frequency – fc=15KHz.9/22/13 their middle element.4.mikroElektronika Figure 2-4-52. www.7 Filter design using Blackman window 2. i.

the following condition must be met: The sum of the previously obtained coefficients is: As the sum is greater than one.Digital Filter Design .com/chapters/view/72/#id24 88/100 . In order to provide attenuation of 0 dB. Normalized cut-off frequency ωc can be computed using expression: The values of coefficients are obtained (rounded to six digits) by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .9/22/13 Step 4: Chapter 2: FIR filters .mikroe. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: The resulting coefficients must be scaled in order to provide attenuation of 0dB at 0Hz. it is necessary to divide all coefficients of the impulse response by 1. these coefficients have the following values: www.000274. After division.mikroElektronika The coefficients of Blackman window are found via expression: Step 5: The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.

9/22/13 Chapter 2: FIR filters .mikroe. i. most processors containing hardware multipliers (which is almost necessary for filtering) have registers with extended band. Prevention of possible filtering overflows.com/chapters/view/72/#id24 89/100 .37001 (1. Coefficients have indices between 0 and 12. Namely. In this case. it is somewhat less.e. In such cases.mikroElektronika The sum of scaled coefficients is equal to 1.Digital Filter Design . Negative coefficients in impulse response make that both conditions cannot be met. it is far more important to faithfully transmit a direct signal to a FIR filter output. Filter realization: Figure 2-4-54 illustrates the direct realization of designed FIR filter. Step 2: Method –filter design using Blackman window Step 3: Filter order is Nf=12. Step 4: The coefficients of Blackman window function are found via: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. In order to prevent a filtering overflow from occuring it is necessary to satisfy the condition below: The resulting filter doesn’t meet this condition.4. possible filtering overflows are not dangerous. A total number of filter coefficients is larger by 1. The sum of apsolute values of coefficients in the resulting filter is: The sum of coefficients apsolute values before scaling amounts to 1. FIR filter direct realization Figure 2-4-55.7. Note that these coefficients cannot be used in designing a FIR filter safe from filtering overflow. Passband cut-off frequency – fc=4KHz.000274).369636⋅1. FIR filter optim ized realization structure 2. Normalized cut-off frequency ωc can be computed using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal high-pass filter: Step 6: www. symmetric about their middle element.2 Example 2 Step 1: Type of filter – high-pass filter Filte specifications: Filter order– Nf=12. whereas figure 2-4-55 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. There is no need to additionally change it. so it is less likely that an overflow occurs. which means that attenuation at 0Hz frequency amounts to 0dB. Figure 2-4-54. N=Nf+1=13. After scaling. Sampling frequency – fs=22050Hz. for the sake of linear phase characteristic. Step 7: The filter order is predetermined.

for the sake of linear phase characteristic.9/22/13 Chapter 2: FIR filters . Sampling frequency – fs=44100Hz.com/chapters/view/72/#id24 90/100 .Digital Filter Design . Prevention of possible filtering overflow. Filter realization: Figure 2-4-56 illustrates the direct realization of designed FIR filter. whereas figure 2-4-57 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Passband cut-off frequency – fc1=4KHz. Coefficients have indices between 0 and 12.4. There is no need to additionally change it. Step 2: Method –filter design using Blackman window Step 3: Filter order is predetermined. Step 4: The coefficients of Blackman window function are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. their values are: Step 7: The filter order is predetermined.mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . FIR filter optim ized realization structure 2.e. After that. i. Figure 2-4-56. Normalized cut-off frequencies ωc1 and ωc2 can be computed using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. symmetric about their middle element. Nf=12.34807.7. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: In order to prevent filtering overflow. FIR filter direct realization Figure 2-4-57.3 Example 3 Step 1: Type of filter – band-pass filter Filte specifications: Filter order – Nf=12. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: www.mikroe. fc2=15025Hz. the following condition must be met: The sum of absolute values of the resulting FIR filter coefficients is: The obtained coefficients must be scaled (divided) by 1. A total number of filter coefficients is larger by 1. N=Nf+1=13.

0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: In order to prevent filtering overflows. i.mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .4 Example 4 Step 1: Type of filter – band-stop filter Filte specifications: Filter order – Nf=12. Nf=12. symmetric about their middle element. A total number of filter coefficients is larger by 1. Passband cut-off frequencies – fc1=2KHz. whereas figure 2-4-59 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Coefficients have indices between 0 and 12. N=Nf+1=13. There is no need to additionally change it. After this.e. Normalized cut-off frequencies ωc1 and ωc2 can be computed using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M.9/22/13 Chapter 2: FIR filters .7. Prevention of possible filtering overflows. FIR filter direct realization Figure 2-4-59. for the sake of linear phase characteristic. Filter realization: Figure 2-4-58 illustrates the direct realization of designed FIR filter. Step 4: The coefficients of Blackman window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Step 2: Method – filter design using Blackman window Step 3: Filter order is predetermined. FIR filter optim ized realization structure 2. Figure 2-4-58.4. fc2=6KHz.102056. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: Step 6: www.Digital Filter Design .com/chapters/view/72/#id24 91/100 .mikroe. their values are: Step 7: The filter order is predetermined. Sampling frequency – fs=16000Hz. the following condition must be met: The sum of absolute values of the resulting FIR filter coefficients is: The obtained coefficients must be scaled (divided) by 1.

8 Filter design using Blackman-Harris window 2. Figure 2-4-60. After this. Normalized cut-off frequency ωc may be calculated using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with expression for the impulse response coefficients of the ideal low-pass filter: Step 6: www.4. i. symmetric about their middle element.com/chapters/view/72/#id24 92/100 . whereas figure 2-4-61 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Passband cut-off frequency – fc=15KHz. the following condition must be met: The sum of absolute values of the resulting FIR filter coefficients is: The obtained coefficients must be scaled (divided) by 0.90107. Step 2: Method –filter design usng Blackman-Harris window Step 3: Filter order is predetermined. There is no need to additionally change it.mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] .Digital Filter Design . Filter realization: Figure 2-4-60 illustrates the direct realization of designed FIR filter. Step 4: The coefficients of Blackman-Harris window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient.e.9/22/13 Chapter 2: FIR filters . for the sake of linear phase characteristic. N=Nf+1=13. Attenuation of 0dB at 0Hz. FIR filter direct realization Figure 2-4-61. Nf=12.mikroe. A total number of filter coefficients is larger by 1. Sampling frequency – fs=44100KHz. FIR filter optim ized realization structure 2. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: In order to prevent filtering overflows.4.1 Example 1 Step 1: Type of filter –low-pass filter Filte specifications: Filter order – Nf=12. and Coefficients have indices between 0 and 12. their values are: Step 7: The filter order is predetermined.8.

37001 (1.977947.Digital Filter Design .4.com/chapters/view/72/#id24 93/100 . whereas figure 2-4-63 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. In order to prevent a filtering overflow from occuring it is necessary to satisfy the condition below: The resulting filter doesn’t meet this condition. Negative coefficients in impulse response indicate that both conditions cannot be met. Note that these coefficients cannot be used in designing a FIR filter safe from filtering overflow. In such cases.8. which means that attenuation at 0Hz frequency amounts to 0dB. so it is less possible that an overflow occurs. In this case. for the sake of linear phase characteristic. Figure 2-4-62. it is far more important to faithfully transmit a direct signal to a FIR filter output.mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: The resulting coefficients must be scaled in order to provide attenuation of 0dB at 0Hz.2 Example 2 Step 1: Type of filter – high-pass filter Filte specifications: Filter order – Nf=12. Optim ized FIR filter design 2.mikroe. most processors containing hardware multipliers (which is almost necessary for filtering) have registers with extended band. Step 4: The coefficients of Blackman-Harris window are found via: Step 5: www. possible filtering overflows are not dangerous. Namely. Prevention of filtering overflows. After this. FIR filter Figure 2-4-63. After scaling. Step 7: The filter order is predetermined. There is no need to additionally change it. Filter realization: Figure 2-4-62 illustrates the direct realization of designed FIR filter. Sampling frequency – fs=22050Hz. To provide 0 dB attenuation. the values of these coefficients are: The sum of scaled coefficients is equal to 1. Passband cut-off frequency – fc=4KHz. the following condition must be met: The sum of the previously obtained coefficients is: As the sum is greater than one.e.9/22/13 Chapter 2: FIR filters . and Coefficients have indices between 0 and 12.369636⋅1. Step 2: Method – filter design using Blackman-Harris window Step 3: Filter order is Nf=12. A total number of filter coefficients is larger by 1. i. N=Nf+1=13. The sum of apsolute values of coefficients in the resulting filter is: The sum of coefficients apsolute values before scaling amounts to 1. it is necessary to divide all the impulse response coefficients by 0. symmetric about their middle element. the sum of coefficients apsolute values is somewhat less.000274).

com/chapters/view/72/#id24 94/100 . i. Step 4: The coefficients of Blackman-Harris window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: www.8.4.mikroe.Digital Filter Design .mikroElektronika The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. and Coefficients have indices between 0 and 12. N=Nf+1=13.3 Example 3 Step 1: Type of filter –band-pass filter Filter specification: Filter order – Nf=12.397791.9/22/13 Chapter 2: FIR filters . fc2=15025Hz. Optim ized FIR filter design 2. the following condition must be met: The sum of absolute values of the resulting FIR filter coefficients is: The obtained coefficients must be scaled (divided) by 1. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: In order to prevent filtering overflow. After this. Normalized cut-off frequency ωc can be computed using expression: The values of coefficients (rounded to six digits) are obtained by combining the values of M and ωc with the expression for the impulse response coefficients of the ideal high-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . There is no need to additionally change it. their values are: Step 7: The filter order is predetermined. symmetric about their middle element. and Prevention of possible filtering overflows. Sampling frequency – fs=44100Hz. Filter realization: Figure 2-4-64 illustrates the direct realization of designed FIR filter. Figure 2-4-64.e. whereas figure 2-4-65 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Passband cut-off frequencies – fc1=4KHz. A total number of filter coefficients is larger by 1. FIR filter direct realization Figure 2-4-65. Nf=12. Step 2: Method – filter design using Blackman-Harris window Step 3: Filter order is predetermined. for the sake of linear phase characteristic.

8. whereas figure 2-4-67 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Nf=20. A total number of filter coefficients is larger by 1. Chapter 2: FIR filters . and Prevention of possible filtering overflows. Step 4: The coefficients of Blackman-Harris window are found via expression: Step 5: The ideal high-pass filter coefficients (ideal filter impulse response) are expressed as: where M is the index of middle coefficient. Figure 2-4-66.9/22/13 where M is the index of middle coefficient. Filter reaization: Figure 2-4-66 illustrates the direct realization of designed FIR filter.mikroe. N=Nf+1=21. and Coefficients have indices between 0 and 20. FIR filter direct realization Figure 2-4-67. symmetric about their middle element.com/chapters/view/72/#id24 95/100 . fc2=6KHz.Digital Filter Design .4 Example 4 Step 1: Type of filter – band-stop filter Filter specification: Filter order – Nf=20. Optim ized FIR filter design 2. Sampling frequency – fs=16000Hz.e. There is no need to additionally change it. 0 ≤ n ≤ 12 The FIR filter coefficients h[n] rounded to 6 digits are: Step 7: The filter order is predetermined. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-stop filter: www. for the sake of linear phase characteristic.4. Step 2: Method – filter design using Blackman-Harris window Step 3: Filter order is predetermined. ωc1 and ωc2 with expression for the impulse response coefficients of the ideal band-pass filter: Step 6: The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . Normalized cut-off frequencies ωc1 and ωc2 can be computed using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. Passband cut-off frequency – fc1=2KHz.mikroElektronika Normalized cut-off frequencies ωc1 and ωc2 can be computed using expressions: The values of coefficients (rounded to six digits) are obtained by combining the values of M. i.

The maximum error that may occur during quantization is 1/2 quantization step.0625 0. symmetric about their middle element. Unfortunatelly.e. As one bit is a sign bit. This causes most impulse response coefficients of the resulting FIR filter to be zeros. the effects of the quantization error are negligible in this case. it is possible to affect design complexity. Quantization of num bers represented in the fixed-point form at The advantage of this presentation is that quantization errors tend to approximate 0. Optim ized FIR filter design 2. It is specified to give the passband amounting to 0. One of disadvantages is a smaller accuracy in coefficients representation. One of the objectives.Digital Filter Design . On software filter implementation. After this. whether it is hardware or software implementation.5 Finite word-length effects There are hardware and software FIR filter realizations.9/22/13 Step 6: Chapter 2: FIR filters . It further makes the filter realization structure simpler. Q UA NT I Z A T I O N ERRO R 0. there are only 4 multiplications. Regardless of which of them is used. a problem known as the finite word-length effect exists in either case.e. where N is the number of a bit used for saving the value. This is mostly used to represent numbers in the range -1 to +1. it is possible to use either fixed-point or floating-point arithmetic. +1) (-1. +1) (-1. that is 1/2N.4210108624275*10-20 NUM BER O F EX A C T DEC I M A L P O I NT S 1 2 4 9 19 Table 2-5-1. The difference between actual sampled value and quantized value. and the rest of bits denote the value of a number. their values are: Step 7: The filter order is predetermined. +1) (-1. when designing filters. There is no need to additionally change it. However. i. thus satisfying the initiative requirements (filter specifications). the buffer length cannot be minimized. i. the following condition must be met: The sum of absolute values of the resulting FIR filter coefficients is: The obtained coefficients must be scaled (divided) by 1. +1) (-1. even though the filter is of 20th order.mikroe. whereas figure 2-4-69 illustrates optimized realization structure of designed FIR filter which is based on the fact that all FIR filter coefficients are. Most commonly used fixed-point format is when one bit denotes a sign of a number.00390625 1.52587890625*10-5 2. www. BI T NUM BER 4 8 16 32 64 RA NG E O F NUM BERS (-1. This FIR filter is an excellent example showing the importance of the sampling frequency.0517578125*10-5 4. there are N-1 bits available for value quantization. Table 2-5-1 shows the values of quantization steps and maximum errors made due to quantization process in the fixed-point presentation.125 0. for the sake of linear phase characteristic. FIR filter direct realization Figure 2-4-69. +1) Q UA NT I Z A T I O N S T EP 0. whereas 1 denotes a negative number. Numbers represented in the fixed-point format are equidistantly quantized with the quantization step 1/2N-1.0078125 3. 0 ≤ n ≤ 20 The FIR filter coefficients h[n] rounded to 6 digits are: In order to prevent filtering overflows. The fixed-point representation is used for saving coefficients and samples in memory. Both representations of numbers have some advantages and disadvantages as well.6566128730774*1010 1. It can be noted that accuracy increases as the number of bits increases.com/chapters/view/72/#id24 96/100 . It is fixed and corresponds to the filter order. the quantization error. Filter realization: Figure 2-4-68 illustrates the direct realization of designed FIR filter.mikroElektronika The designed FIR filter coefficients are found via expression: h[n] = w[n] * hd[n] . In other words. As for optimized FIR filter design.12232. 0 denotes a positive. is smaller as the quantization level decreases.3283064365387*10-10 5. Figure 2-4-68. is to lessen the finite word-length effects as much as possible.5π. It means that errors are not accumulated in operations performed upon fixed-point numbers.0842021724855*1019 M A X .

it is easy to notice that finite word length. a coefficient error is less in the floating-point representation. the filter coefficients have the following values: {0. similar to the fixed-point format.mikroe. Some of disadvantages of this presentation are complex implementation and errors that do not tend to approximate 0. As seen. and www.000000002970695} As seen.mikroElektronika The floating-point arithmetic saves values with better accuracy due to dynamics it is based on. The finite word-length effect is the deviation of FIR filter characteristic. the fixed-point arithmetic is more often implemented in digital signal processors. whereas it cannot affect FIR filters that way. Coefficient quantization errors. It also enables an appropriate number of digits to be faithfully saved. 0.e. 2. The problem is extremely obvious when the operation is performed upon two values of which one is much less than the other. BI T NUM BER 16 32 M A NT I S S A SIZ E 7 23 EX P O NENT SIZ E 8 8 NUM BER O F EX A C T DEC I M A L P O I NT S 2 6-7 BA ND 2. Exponent varies in a way that the quantization step is as small as possible.4x10-45 . The value normally consists of three parts. 0. used for representing coefficients and samples being processed. A number in the floating-point format looks as follows: where M is the mantissa and E is the exponent.4x1038 1. Table 2-5-2 below provides the basic information on floatingpoint representation for several different lengths. After all mentioned. Quantization of num bers represented in the floating-point form at It is not possible to determine the quantization step in the floating-point representation as it depends on exponent.400000. causes some problems such as: 1. Example FIR filter coefficients: {0.151364997029305} Quantization errors produced while representing coefficients as 16-bit numbers in the floating-point format are: {0. coefficient representation can cause IIR filters to become instable.9/22/13 Chapter 2: FIR filters . which means that the corresponding pairs of coefficients will be quantized to the same value. which can be either positive or negative.000000005960464. represented by one bit known as the sign bit.0000021875} If filter coefficients are represented in the floated-point format. These effects are more prominent for IIR filters for their feedback property than for FIR filters. 3. it is not possible to determine quantization level. which further enables both extremely large and extremely small numbers to be saved with appropriate accuracy. the finite word-length effects are more prominent in fixed-point arithmetic.0000021875. Sample quantization errors (quantization noise). 0. As a result of greater error in coefficients representation. The second part is a mantissa M. If we suppose that numbers range between -1 and +1. and the third part is an exponent E. 0. FIR filters keep their linear phase characteristic after quantization. The reason for this is the fact that the coefficients of a FIR filter with linear phase characteristic are symmetric. 0.000006103515625.4x1038 Table 2-5-2. exponent provides the floating-point representation with dynamics. Floating-point representations cover a much wider range of numbers. -0. In addition.151365} Coefficients need to be represented as 16-bit numbers in the fixed-point and floating-point formats..000000002970695. The errors made in this case are considerably less than those made in the fixed-point arithmetic. i. After quantization. -0.400000005960464. The floating-point arithmetic is suitable for coefficient representation.1513671875. the finite word-length effects are negligible. It results in the impulse response symmetry remaining unchanged.1513671875} Quantization errors are: {-0.151364997029305. In this case. If such characteristic still meets the filter specifications. the coefficients have the following values: {0.0000152587890625. 0.3x10-38 .151365. The first part is. For this reason. In this number presentation. 0. The third part.. the sign bit along with mantissa represent a fixed-point format. Floating-point arithmetic can also be expressed in terms of fixed-point arithmetic. 0. 3. then quantization level amounts to 1 / 2^16 = 0.com/chapters/view/72/#id24 97/100 .399993896484375.Digital Filter Design . Such numbers could not be represented in the fixed-point format. special attention should be paid to the number of digits that are saved with no error. which is a fractional part of the number.

0.8 0. thus drastically reduced. is between -1 and +1. . Both filter realization and position of poles affect the quantization noise power. 0.63 0. which further means that the resulting filter is not suitable for intended implementation. Overflow effects I NP UT S A M P L E 0.9 0.88 As mentioned. it may happen that transfer function is deviated to such an extent that it no longer meets the specifications. The quantization noise is reduced as the number of bits used for sample and coefficient representation increases.63 + 0. The process of filtering can be represented as a sum of multiplications performed upon filter coefficients and signal samples appearing at filter input.1 I NT ERM EDI A T E RES UL T 0. The later is more preferable in practice because in this case the mid-value of quantization error (quantization noise) is equal to 0. Even though there is no danger of FIR filter destabilization. the effect of filter realization on the quantization noise is almost negligible.7.7 0. 2. a partial sum is accumulated in a register which is 2N in length. As all FIR filter poles are located in z=0. Figure 2-5-1 illustrates block diagram of input signal filtering and quantization of result as well. In most cases. Overflow I NP UT S A M P L E 0. Example: Assume that it is needed to filtrate input samples using a second-order filter. 0.1 Coefficient Quantization Chapter 2: FIR filters . These extra N bits are not necessary.. producing truncation or round-off errors. In other words. Signal sam ples filtering Multiplication of two numbers each N bits in length. If it drops below the limit defined by the specifications.07 = 1..63 0. it is easy to understand how an overflow occurs in the second step.1.5.56 . whereas the position of its poles remains unchanged as they are located in z=0. Figure 2-5-1.81 .26 As the range of values. the resulting filter is useless. the result is an undesirable negative value -0.com/chapters/view/72/#id24 98/100 . Transfer function changes occurring due to FIR filter coefficient quantization are more effective for high-order filters.8.1 I NT ERM EDI A T E RES UL T 0. an overflow occurs in the second step.Digital Filter Design . 0. F I L T ER C O EF F I C I ENT S 0.7}.2 Samples Quantization Another problem caused by the finite word length is sample quantization performed at multiplier’s output (after filtering). Overflow errors.7. shown in the table 2-5-3 below. These are: {0. The FIR filter quantization errors cause the stopband attenuation to become lower. hardware used for FIR filter realization is designed so that after each individual multiplication. Such filter has three coefficients.19..7 0.3 Overflow Overflow happens when some intermediate results exceed the range of numbers that can be represented by the given word-length.5.81 -0.mikroe.19 + 0.5. 2.7 Table 2-5-3.7 Table 2-5-4. there is a possibility that an overflow occurs at some point when the results of multiplications are added together. Input samples are: { . The reason for this is the fact that spacing between zeros of the transfer function get smaller as the filter order increases and such slight changes of zero positions affect the FIR filter frequency response. Not before the process of filtering ends.7 0. coefficients and samples values are represented in the range -1 to +1. the results of the filtering process will be as shown in the table 2-5-4. F I L T ER C O EF F I C I ENT S 0. The position of FIR filter zeros is also changed.9.} By analyzing the steps of the input sample filtering process. Quantization noise depends on the number of bits N. Quantization has no effect on them..56 = 1.7 0.07 = -0. In spite of the fact that both FIR filter input and output samples are in the given range. For the fixed-point arithmetic. an intermediate result is greater than 1 or less than -1..81. The conclusion is that quantization of FIR filter coefficients cannot cause a filter to become instable as is the case with IIR filters. will give a product which is 2N bits in length. 2. The final sum is greater than 1.9 0. the result is quantized on N bits and quantization noise is introduced.19 1. 0.8 0.mikroElektronika The coefficient quantization results in FIR filter changing its transform function. so the product has to be truncated or rounded off to N bits.63 + 0. defined by the fixed-point presentation.2 = -0. www. Instead of desired value +1.9/22/13 3.0.

which further causes highfrequency components to appear in the output spectrum. Figure 2-5-3.e.35 + 2 = 0. whereas the later is called a negative overflow. -0. in spite of the fact that two overflows have occured.9.84 As seen. Figure 2-5-2. it is not possible to apply scaling then the overflow effects can be lessened to some extend via saturation. F I L T ER C O EF F I C I ENT S 0. the final result will not be changed. 0. Obtained interm ediate results I NP UT S A M P L E 0. Example: The second-order filter has three coefficients. the final result remained unchanged. Saturation characteristic When the saturation characteristic is used to prevent an overflow. Note: If the number of positive overflows is equal to the number of negative overflows.. for any reason.mikroElektronika This difference of -2 between these two values is explained in Figure 2-5-2 below. Such filter has three coefficients. If.8... These are: {0. A necessary and sufficient condition required for FIR filter coefficients in this case is given in the following expression: where: bk are the FIR filter coefficients. overflow of partial results is not of the essence.7 Table 2-5-6. it does not necessarily cause an overflow in the final result.8 0.9 I NT ERM EDI A T E RES UL T 0. 0.7 0.81 . 0. The first overflow is called a positive overflow.9 0. The first one has decremented the final result by 2. This way.7 -0. 0.9 0. F I L T ER C O EF F I C I ENT S 0.7} Input samples are: { .7. 0.5 I NT ERM EDI A T E RES UL T 0. The apsolute value of the result is less than 1 in this case.63 0.7 0. as long as the final result is within the word-length. .. This situation is illustrated in the following example.0.7.19 .35 = 0.8 0. 0.com/chapters/view/72/#id24 99/100 . 0.84 So. These are: {0. F I L T ER C O EF F I C I ENT S 0. some intermediate results exceed the given range and two overflows occur.7 Table 2-5-5.63 + 0.mikroe.} The desirable intermediate results are shown in the table 2-7-7 below.7 -0.. Signal sam ples filtering However. It is possible to scale FIR filter coefficients to avoid overflow. Refer to the table 2-5-6 below..7.7. There are several ways to lessen the overflow effects. the intermediate result doesn’t change its sign.5 I NT ERM EDI A T E RES UL T 0. In other words. The reason for this is the nature of these two overflows. Desired interm ediate results I NP UT S A M P L E 0.63 0.56 .9.} The desired intermediate results are given in the table 2-5-5. if some intermediate result exceeds the range of presentation. 0.. the overflow effect is annuled..63 www. Overflow causes rapid oscillations in the input sample.Digital Filter Design .56 = 1. i. .2 = -0. For this reason. and N is the number of filter coefficients... whereas the second one has incremented the final result by 2. Let’s see what happens if we apply the saturation characteristic to the previous example: Example Again.81 -0. Figure 2-5-3 illustrates the saturation characteristic.19 1. 0.9/22/13 Chapter 2: FIR filters .5.7 I NP UT S A M P L E 0.63 + 0. the overflow effect is annuled.8.7} Input samples are: { . it is needed to filtrate input samples using a second-order filter. the oscillations in the output signal are not so rapid and undesirable high-frequency components are attenuated. Two most commonly used are scaling and saturation.0.1.

7 Table 2-5-7. Interm ediate results and saturation characteristic I NP UT S A M P L E 0.7 Table 2-5-8.mikroe.19 1. but the difference is far smaller than when there is no saturation: Without saturation: Δ = 1.8 0.1 0. the intermediate results are as shown in the table 2-5-8. the saturation characteristic lessens an overflow effect and attenuates undesirable components in the output spectrum. MikroElektronika.9/22/13 0.63 0.56 = 1 1 + 0.14 With saturation: Δ = 1. Desirable interm ediate results Chapter 2: FIR filters . All rights reserved.9 0. www.19 + 0.7 0. defined by the fixed-point presentation.1 I NT ERM EDI A T E RES UL T 0.7 0.07 = 1 The resulting sum is not correct.mikroElektronika 0.1 = 0.63 + 0.7 0.63 + 0. is between -1 and +1.56 = 1.88) = 2.07 = 1.2013. F I L T ER C O EF F I C I ENT S 0. ← previous chapter | table of contents | next chapter → MikroElektronika Embedded Solutions PIC Solution PIC De ve lopm e nt Boards PIC C om pile rs PIC Program m e rs/De bugge rs PIC Kits PIC Book s Follow us on PIC32 Solution PIC 32 De ve lopm e nt Boards PIC 32 C om pile rs PIC 32 Program m e rs/De bugge rs PIC 32 Kits dsPIC Solution dsPIC De ve lopm e nt Boards dsPIC C om pile rs dsPIC Program m e rs/De bugge rs dsPIC Kits dsPIC Book s Add-on boards C lick Boards m ik rom e dia shie lds C om m unication boards Storage boards R e al Tim e C lock boards Display boards Me asure m e nt boards Audio & Voice boards Powe r Supply boards GPS boards GSM/GPR S boards Additional Software Visual TFT Visual GLC D Pack age Manage r GLC D Font C re ator 8051 Solution 8051 De ve lopm e nt Boards 8051 C om pile rs 8051 Program m e rs/De bugge rs 8051 Book s 8051 Kits AVR Solution AVR De ve lopm e nt Boards AVR C om pile rs AVR Program m e rs/De bugge rs AVR Kits ARM Solution AR M De ve lopm e nt Boards AR M C om pile rs AR M Program m e rs/De bugge rs AR M Kits Support Forum m ik roBUS Le ts m ak e Pre ss Le gal Inform ation Product Archive About Us C opyright © 1998 .26 .com/chapters/view/72/#id24 100/100 .26 .(-0. All trade and/or services marks mentioned are the property of their respective owners.26 As seen from the example above.8 0.Digital Filter Design . and the saturation characteristic is used as well.26 As the range of values.