(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

Similar documents
(i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters

DIGITAL FILTERS. !! Finite Impulse Response (FIR) !! Infinite Impulse Response (IIR) !! Background. !! Matlab functions AGC DSP AGC DSP

IIR Filter Design Chapter Intended Learning Outcomes: (i) Ability to design analog Butterworth filters

4. Design of Discrete-Time Filters

Digital Filters IIR (& Their Corresponding Analog Filters) Week Date Lecture Title


Design of FIR Filters

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

F I R Filter (Finite Impulse Response)

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2026 Summer 2018 Lab #8: Filter Design of FIR Filters

(i) Understanding the basic concepts of signal modeling, correlation, maximum likelihood estimation, least squares and iterative numerical methods

Digital Filters FIR and IIR Systems

Window Method. designates the window function. Commonly used window functions in FIR filters. are: 1. Rectangular Window:

Experiment 4- Finite Impulse Response Filters

ECE438 - Laboratory 7a: Digital Filter Design (Week 1) By Prof. Charles Bouman and Prof. Mireille Boutin Fall 2015

The University of Texas at Austin Dept. of Electrical and Computer Engineering Final Exam

Advanced Digital Signal Processing Part 5: Digital Filters

ELEC-C5230 Digitaalisen signaalinkäsittelyn perusteet

Electrical & Computer Engineering Technology

Simulation Based Design Analysis of an Adjustable Window Function

Design of FIR Filter for Efficient Utilization of Speech Signal Akanksha. Raj 1 Arshiyanaz. Khateeb 2 Fakrunnisa.Balaganur 3

Aparna Tiwari, Vandana Thakre, Karuna Markam Deptt. Of ECE,M.I.T.S. Gwalior, M.P, India

Sampling and Reconstruction of Analog Signals

EEM478-DSPHARDWARE. WEEK12:FIR & IIR Filter Design

ME scope Application Note 01 The FFT, Leakage, and Windowing

CS3291: Digital Signal Processing

Multirate Digital Signal Processing

Part One. Efficient Digital Filters COPYRIGHTED MATERIAL

Discrete Fourier Transform (DFT)

FIR FILTER DESIGN USING A NEW WINDOW FUNCTION

Team proposals are due tomorrow at 6PM Homework 4 is due next thur. Proposal presentations are next mon in 1311EECS.

Final Exam Practice Questions for Music 421, with Solutions

Gibb s Phenomenon Analysis on FIR Filter using Window Techniques

EE 422G - Signals and Systems Laboratory

FIR Filters Digital Filters Without Feedback

Digital Processing of Continuous-Time Signals

Digital Processing of

Frequency-Response Masking FIR Filters

The University of Texas at Austin Dept. of Electrical and Computer Engineering Midterm #1

FIR Filter Design using Different Window Techniques

Corso di DATI e SEGNALI BIOMEDICI 1. Carmelina Ruggiero Laboratorio MedInfo

Experiment 2 Effects of Filtering

Digital Filtering: Realization

Copyright S. K. Mitra

ECE 4213/5213 Homework 10

Multirate DSP, part 1: Upsampling and downsampling

Chapter 5 Window Functions. periodic with a period of N (number of samples). This is observed in table (3.1).

Signal processing preliminaries

Department of Electrical and Electronics Engineering Institute of Technology, Korba Chhattisgarh, India

CHAPTER 2 FIR ARCHITECTURE FOR THE FILTER BANK OF SPEECH PROCESSOR

Keywords FIR lowpass filter, transition bandwidth, sampling frequency, window length, filter order, and stopband attenuation.

Narrow-Band Low-Pass Digital Differentiator Design. Ivan Selesnick Polytechnic University Brooklyn, New York

Performance Analysis of FIR Digital Filter Design Technique and Implementation

Design Digital Non-Recursive FIR Filter by Using Exponential Window

EC6502 PRINCIPLES OF DIGITAL SIGNAL PROCESSING

Analog Lowpass Filter Specifications

Signals. Continuous valued or discrete valued Can the signal take any value or only discrete values?

FIR window method: A comparative Analysis

Digital Signal Processing

Continuous-Time Signal Analysis FOURIER Transform - Applications DR. SIGIT PW JAROT ECE 2221

STANFORD UNIVERSITY. DEPARTMENT of ELECTRICAL ENGINEERING. EE 102B Spring 2013 Lab #05: Generating DTMF Signals

Understanding the Behavior of Band-Pass Filter with Windows for Speech Signal

Interpolated Lowpass FIR Filters

Final Exam Solutions June 14, 2006

Narrow-Band and Wide-Band Frequency Masking FIR Filters with Short Delay

UNIT-II MYcsvtu Notes agk

Continuous-Time Analog Filters

FIR Filters in Matlab

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

Digital FIR LP Filter using Window Functions

System Identification and CDMA Communication

ELEC3104: Digital Signal Processing Session 1, 2013

A Lower Transition Width FIR Filter & its Noise Removal Performance on an ECG Signal

B.Tech III Year II Semester (R13) Regular & Supplementary Examinations May/June 2017 DIGITAL SIGNAL PROCESSING (Common to ECE and EIE)

Signals and Systems Lecture 6: Fourier Applications

Signal Processing Toolbox

EECE 301 Signals & Systems Prof. Mark Fowler

ECE 421 Introduction to Signal Processing

Design and Simulation of Two Channel QMF Filter Bank using Equiripple Technique.

Part B. Simple Digital Filters. 1. Simple FIR Digital Filters

ijdsp Workshop: Exercise 2012 DSP Exercise Objectives

EEM478-WEEK8 Finite Impulse Response (FIR) Filters

Optimal FIR filters Analysis using Matlab

2) How fast can we implement these in a system

Signal Processing for Digitizers

Suggested Solutions to Examination SSY130 Applied Signal Processing

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

Signals and Systems Lecture 6: Fourier Applications

A Comparative Performance Analysis of High Pass Filter Using Bartlett Hanning And Blackman Harris Windows

y(n)= Aa n u(n)+bu(n) b m sin(2πmt)= b 1 sin(2πt)+b 2 sin(4πt)+b 3 sin(6πt)+ m=1 x(t)= x = 2 ( b b b b

DIGITAL FILTERING AND THE DFT

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 3

Performance Analysis of FIR Filter Design Using Reconfigurable Mac Unit

ECE 5650/4650 Exam II November 20, 2018 Name:

PROBLEM SET 6. Note: This version is preliminary in that it does not yet have instructions for uploading the MATLAB problems.

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

Encoding a Hidden Digital Signature onto an Audio Signal Using Psychoacoustic Masking

Filters. Phani Chavali

Frequency Domain Representation of Signals

EE 470 Signals and Systems

Transcription:

FIR Filter Design Chapter Intended Learning Outcomes: (i) Understanding of the characteristics of linear-phase finite impulse response (FIR) filters (ii) Ability to design linear-phase FIR filters according to predefined specifications using the window and frequency sampling methods H. C. So Page 1 Semester A 2017-2018

Steps in Digital Filter Design 1. Specification Determination The first step is to obtain the filter specifications or requirements which are determined by the applications. Suppose we have observations where is the signal of interest and is the additive noise. The only has low-frequency components such that for while is of wideband such that for the whole frequency range. If our task is to find from, we can use a lowpass filter with cutoff frequency of to obtain a noise-reduced version of. H. C. So Page 2 Semester A 2017-2018

Fig.10.1: Spectra of signal and noise The filter specification can be described by discrete-time Fourier transform (DTFT) : (10.1) which specifies both the magnitude and phase H. C. So Page 3 Semester A 2017-2018

Fig.10.2: Ideal lowpass filter unity gain for the whole range of complete suppression for step change in frequency response at H. C. So Page 4 Semester A 2017-2018

passband transition stopband Fig.10.3: Practical passband corresponds to where is the passband frequency and is the passband ripple or tolerance which is the maximum allowable deviation from unity in this band H. C. So Page 5 Semester A 2017-2018

stopband corresponds to where is the stopband frequency and is the stopband ripple or tolerance which is the maximum allowable deviation from zero in this band transition band corresponds to no restrictions on in this band 2. Filter Response Calculation where there are We then use digital signal processing techniques to obtain a filter description in terms of transfer function or impulse response that fulfills the given specifications 3. Implementation When or are known, the filter can then be realized in hardware or software according to a given structure H. C. So Page 6 Semester A 2017-2018

Advantages of FIR Filter Transfer function of a causal FIR filter with length is: (10.2) where is the finite-duration impulse response Phase response can be exactly linear which results in computation reduction and zero phase distortion. Note that when there is phase distortion, different frequency components of a signal will undergo different delays in the filtering process It is always stable because for finite Less sensitive to finite word-length effects H. C. So Page 7 Semester A 2017-2018

Efficient implementation via digital signal processors with multiply-and-add (MAC) instruction Existence of optimality theorem for FIR filter design Linear-Phase FIR Filter The phase response of a linear-phase filter is a linear function of the frequency : (10.3) where equals 0 or and is a constant which is function of the filter length. Note that (10.3) is slightly different from that in previous chapters where the phase response complements with the magnitude response. H. C. So Page 8 Semester A 2017-2018

Here, the phase response is related to by (10.4) where Comparing is real and is called the amplitude response. (10.5) where is nonnegative, we see that when is positive, the phase responses in (10.4) and (10.5) are identical but there is a phase difference of for a negative. H. C. So Page 9 Semester A 2017-2018

Example 10.1 Determine the amplitude response and the corresponding phase response for a FIR filter with impulse response : Plot the spectra for. Compare the results with the magnitude response and the corresponding phase response. Using Example 6.2: Hence the amplitude response is H. C. So Page 10 Semester A 2017-2018

and the corresponding phase response is On the other hand, the magnitude response and the corresponding phase response are: and The MATLAB program is provided as ex10_1.m. H. C. So Page 11 Semester A 2017-2018

10 Amplitude Response 5 0-1 -0.5 0 0.5 1 ω/p Phase Response 20 10 0-10 -20-1 -0.5 0 0.5 1 ω/p Fig.10.4: Amplitude and phase spectra H. C. So Page 12 Semester A 2017-2018

10 Magnitude Response 5 0-1 -0.5 0 0.5 1 ω/p Phase Response 20 10 0-10 -20-1 -0.5 0 0.5 1 ω/p Fig.10.5: Magnitude and phase spectra H. C. So Page 13 Semester A 2017-2018

For a causal linear-phase FIR filter, the impulse response is either symmetric or anti-symmetric: or (10.6) (10.7) For example, when is even in (10.7):,, (10.8) H. C. So Page 14 Semester A 2017-2018

How many multipliers and additions are needed? Example 10.2 Draw the block diagram using the direct form with minimum number of multiplications for the FIR filter whose impulse response is: Following (10.8), we obtain: The number of multiplications is reduced from to while the number of additions remains unchanged, which is 4. H. C. So Page 15 Semester A 2017-2018

Fig.10.6: Block diagram for symmetric impulse response H. C. So Page 16 Semester A 2017-2018

There are four types of linear-phase FIR filters: 1. Symmetric Impulse Response with Odd Taking the DTFT of yields (10.9) where and is an integer. H. C. So Page 17 Semester A 2017-2018

Example 10.3 The impulse response of a causal FIR filter satisfies, with is odd. Show that According to (10.6) with odd, we have H. C. So Page 18 Semester A 2017-2018

Hence which validates (10.9) with. H. C. So Page 19 Semester A 2017-2018

2. Symmetric Impulse Response with Even The DTFT of is: (10.10) where and is not an integer. 3. Anti-symmetric Impulse Response with Odd The DTFT of is: (10.11) H. C. So Page 20 Semester A 2017-2018

where and is an integer Note that due to anti-symmetric property 4. Anti-symmetric Impulse Response with Even Taking the DTFT of yields: (10.12) where and is not an integer. H. C. So Page 21 Semester A 2017-2018

Example 10.4 Consider an input sequence of length 400 such that for and, and it is a sinusoid with frequencies and for and, respectively. Examine the filter output systems: with the following two FIR (a) (b) with with Are they linear phase filters? The MATLAB program for this example is provided as ex10_4.m. H. C. So Page 22 Semester A 2017-2018

1 0.8 x[n] 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 0 50 100 150 200 250 300 350 400 n Fig.10.7: Pulsed sinusoid with two frequencies H. C. So Page 23 Semester A 2017-2018

2 1.5 x[n] y[n] 1 0.5 0-0.5-1 -1.5-2 0 50 100 150 200 250 300 350 400 n Fig.10.8: Filter output with nonlinear-phase filter H. C. So Page 24 Semester A 2017-2018

2 1.5 x[n] y[n] 1 0.5 0-0.5-1 -1.5-2 0 50 100 150 200 250 300 350 400 n Fig.10.9: Filter output with linear-phase filter H. C. So Page 25 Semester A 2017-2018

Example 10.5 The impulse response of a causal linear-phase FIR is: where. Determine. Plot the amplitude and phase responses and then deduce the function of the filter. Find the expected filter output when passing an input sequence of the form through the filter. As is odd and is anti-symmetric, we apply (10.11): H. C. So Page 26 Semester A 2017-2018

4 Amplitude Response 2 0-2 -4-1 -0.5 0 0.5 1 ω/p Phase Response 20 10 0-10 -20-1 -0.5 0 0.5 1 ω/p Fig.10.10: Amplitude and phase responses of differentiator H. C. So Page 27 Semester A 2017-2018

The amplitude response can be approximated as: According to the time-shifting property, the DTFT of a time advance of 5 samples is then: with This means that the causal FIR filter has a frequency response approximately equals with a delay of 5 samples. H. C. So Page 28 Semester A 2017-2018

The system with frequency response differentiator. Recall: is known as the Differentiating both sides with respect to yields: H. C. So Page 29 Semester A 2017-2018

which confirms: As a result, we expect the output is close to: with a delay of 5 samples The MATLAB program is provided as ex10_5.m. H. C. So Page 30 Semester A 2017-2018

1 0.8 0.6 x[n] y[n] 0.4 0.2 0-0.2-0.4-0.6-0.8-1 0 10 20 30 40 50 n Fig.10.11: Differentiator output with sinusoidal input H. C. So Page 31 Semester A 2017-2018

Window Method Based on directly approximating the desired frequency response Ideal impulse response is calculated from inverse DTFT: (10.13) What are the problems in using (10.13)? H. C. So Page 32 Semester A 2017-2018

Example 10.6 Determine the impulse response of an ideal lowpass filter with a cutoff frequency of. The DTFT of the filter is: Using Example 6.3, is: where Ideal filter is noncausal and its impulse response is of infinite length H. C. So Page 33 Semester A 2017-2018

The basic idea of window method is to truncate obtain a linear-phase and causal FIR filter via 2 steps: Windowing Extract a finite set of with positive and negative time indexes because the impulse response is generally symmetric or anti-symmetric around, say, {, } corresponding to a length of Filter response is linear phase but is only an approximation of due to the coefficient truncation Time Shifting Delay by samples to obtain with to achieve causality to Filter output is received after a delay of samples H. C. So Page 34 Semester A 2017-2018

ideal with windowing further with time shift Fig.10.12: Illustration of window method H. C. So Page 35 Semester A 2017-2018

Example 10.7 Use the window method to design a linear-phase and causal FIR system with 7 coefficients to approximate an ideal lowpass filter whose cutoff frequency is. From Example 10.6: Via windowing, we extract the set of. Notice that is symmetric around at as. Their values are calculated as: H. C. So Page 36 Semester A 2017-2018

Via time-shifting of 3 samples, a causal filter is obtained as: or : with. H. C. So Page 37 Semester A 2017-2018

0.7 Magnitude Response 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 ω/p Fig.10.13: Magnitude response of lowpass filter with H. C. So Page 38 Semester A 2017-2018

Note that we can use the MATLAB command fir1(6,0.1,boxcar(7),'noscale') to produce Alternatively, we can first perform the time shifting prior to windowing As there should be a phase of where in the practical filter, we modify the desired frequency response as: Note that multiplying in the frequency domain corresponds to a time shift of in the time domain. H. C. So Page 39 Semester A 2017-2018

The corresponding impulse response is As the filter length is :, we then perform windowing on Substituting and yields the same FIR impulse response. Note that we can base on this approach to determine even when is an even integer H. C. So Page 40 Semester A 2017-2018

The truncation operation can be considered as multiplying by a rectangular window function: That is, Generally speaking, is not restricted to be rectangular and it can be any symmetric function so that the resultant filter is linear phase H. C. So Page 41 Semester A 2017-2018

Example 10.8 Use the window method to design a linear-phase and causal FIR filter of length 101 such that the sampled version of a continuous-time sinusoid with frequency of 80 Hz can pass through it with negligible attenuation while the sampled signal corresponds to a tone of frequency 120 Hz will be suppressed. The sampling frequency is 1000 Hz. Let the continuous-time sinusoids be From (4.1), the corresponding discrete-time versions with sampling interval of s are H. C. So Page 42 Semester A 2017-2018

which gives: and The frequencies are and in discrete-time domain. In order to suppress while keeping, we can use a lowpass filter with cutoff frequency of, which is simply the average of the two discrete frequencies. Using Example 10.7 with and, the required filter impulse response is: H. C. So Page 43 Semester A 2017-2018

0.2 h[n] 0.15 0.1 0.05 0-0.05 0 20 40 60 80 100 n Fig.10.14: Impulse response of lowpass filter with H. C. So Page 44 Semester A 2017-2018

Magnitude Response 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 ω/p Fig.10.15: Magnitude response of lowpass filter with H. C. So Page 45 Semester A 2017-2018

1 0.8 s 1 [n] 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 100 120 140 160 180 200 n Fig.10.16: Discrete-time tone with frequency H. C. So Page 46 Semester A 2017-2018

1 0.8 0.6 s 2 [n] 0.4 0.2 0-0.2-0.4-0.6-0.8-1 100 120 140 160 180 200 n Fig.10.17: Discrete-time tone with frequency H. C. So Page 47 Semester A 2017-2018

1 0.8 filtered s 1 [n] 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 100 120 140 160 180 200 n Fig.10.18: Filter output for frequency H. C. So Page 48 Semester A 2017-2018

1 0.8 filtered s 2 [n] 0.6 0.4 0.2 0-0.2-0.4-0.6-0.8-1 100 120 140 160 180 200 n Fig.10.19: Filter output for frequency H. C. So Page 49 Semester A 2017-2018

Analysis of Windowing To incorporate passband and stopband frequencies and ripples in the FIR filter design, we need to study the windowing effect Recall (10.14) According to the multiplication property of (6.18): (10.15) H. C. So Page 50 Semester A 2017-2018

Transition Ripples Side lobes Main lobe width Fig.10.20: Illustration of H. C. So Page 51 Semester A 2017-2018

is a smeared version of ideal has a peaky main lobe and several side lobes of smaller magnitudes Main lobe produces the transition band in. That is, the transition width is proportional to the main lobe width, which is inversely proportional to the filter length Side lobes are responsible to produce the ripples in the passband and stopband with approaches when has the smallest main lobe width and side lobe magnitude. That is, the ideal but not practical form of gives H. C. So Page 52 Semester A 2017-2018

Rectangular Window (10.16) 1 0.9 w[n] 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 n Fig.10.21: Rectangular window function for H. C. So Page 53 Semester A 2017-2018

From Example 10.1: (10.17) The main lobe width is (10.18) which is proportional to the filter transition width That is, transition width decreases as the filter length increases. H. C. So Page 54 Semester A 2017-2018

10 N=10 2.2475 0-1 -0.2 0.2 1 ω/π N=20 20 4.495 0-1 -0.1 0.1 1 ω/π Fig.10.22: Magnitude responses of rectangular window for & H. C. So Page 55 Semester A 2017-2018

Relative peak side lobe,, is the ratio of the peak side lobe height to main lobe height in db: (10.19) A larger implies ripples with bigger magnitudes As increases, widths of the main lobe and all side lobes decrease but their areas remain unchanged, meaning that the ripples cannot be reduced. This is known as Gibbs phenomenon due to sudden change in transition from 0 to 1 and 1 to 0. This can be removed by tapering the window smoothly to zero at each end. However, the heights of the side lobes can be diminished but at the expense of wider main lobe and hence a wider transition. H. C. So Page 56 Semester A 2017-2018

Bartlett Window (10.20) 0.9 0.8 w[n] 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 n Fig.10.23: Bartlett window function for H. C. So Page 57 Semester A 2017-2018

Hanning Window (10.21) 1 0.9 w[n] 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 n Fig.10.24: Hanning window function for H. C. So Page 58 Semester A 2017-2018

Hamming Window (10.22) 1 0.9 w[n] 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 n Fig.10.25: Hamming window function for H. C. So Page 59 Semester A 2017-2018

Blackman Window (10.23) 1 0.9 w[n] 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 4 5 6 7 8 9 n Fig.10.26: Blackman window function for H. C. So Page 60 Semester A 2017-2018

Note that by using terms for a filter length of and then discarding the end points, we can avoid zero coefficients at both ends for Bartlett, Hanning and Blackman windows. Window (db) Rectangular Bartlett Hanning Hamming Blackman Table 10.1: Characteristics of window functions As a result, there is a tradeoff between transition and ripple H. C. So Page 61 Semester A 2017-2018

Example 10.9 Use the window method to design a linear-phase and causal FIR system to approximate an ideal lowpass filter whose cutoff frequency is. Try the rectangular and Bartlett window functions with filter lengths of 7, 21, 61 and 101, to investigate the frequency magnitude responses. Using Example 10.7, with the rectangular window is: with equals 7, 21, 61 and 101 and. Multiplying by (10.20) yields the corresponding filter coefficients for the Bartlett window. The MATLAB program is provided as ex10_9.m. H. C. So Page 62 Semester A 2017-2018

N=7 N=21 1 1 0.5 0.5 0 0 0.5 1 ω/π N=61 1 0 0 0.5 1 ω/π N=101 1 0.5 0.5 0 0 0.5 1 ω/π 0 0 0.5 1 ω/π Fig.10.27: Magnitude responses with rectangular window at different H. C. So Page 63 Semester A 2017-2018

N=7 N=21 1 1 0.5 0.5 0 0 0.5 1 ω/π N=61 1 0 0 0.5 1 ω/π N=101 1 0.5 0.5 0 0 0.5 1 ω/π 0 0 0.5 1 ω/π Fig.10.28: Magnitude responses with Bartlett window at different H. C. So Page 64 Semester A 2017-2018

Example 10.10 Use the window method to find the impulse response of a linear-phase and causal FIR filter which approximates an ideal lowpass filter whose cutoff frequency is. It is required that the filter is of fourth-order and Bartlett window is employed. A fourth-order filter implies a filter length of Example 10.7 with and :. Using To avoid zero coefficients, we set extract the middle 5 values to yield with. in (10.20) and H. C. So Page 65 Semester A 2017-2018

As a result with is: The MATLAB command fir1(4,0.25,triang(5),'noscale') can also produce. Note that if we use in (10.20), with. The resultant impulse response will be with, indicating that the effective length is only 3 H. C. So Page 66 Semester A 2017-2018

In window method, the ripple is: And the transition width is: or with and They are determined from in (10.15), which is not straightforward for computation Nevertheless, by noting that (10.15) corresponds to one of the forms in (10.9)-(10.12), is easily obtained by extracting the amplitude H. C. So Page 67 Semester A 2017-2018

Step 1: Find Step 2: Find Step 4: Find Step 3: Find Fig.10.29: Steps to find passband and stopband ripples and frequencies H. C. So Page 68 Semester A 2017-2018

Example 10.11 Use the window method with the rectangular window to find the impulse response of a linear-phase and causal FIR filter which approximates an ideal lowpass filter whose cutoff frequency is. It is required that the filter has a length of. Plot its amplitude response and then determine,,, and. Using Example 10.7 with and, is: As is symmetric and is odd, from (10.9): H. C. So Page 69 Semester A 2017-2018

N=21 1.0912 0.9088 0.0912-0.0912 0 0.45470.5453 1 ω/π Fig.10.30: Measuring parameters from H. C. So Page 70 Semester A 2017-2018

We see that Peak approximation error,, which is the ripple in db, is: Furthermore and which gives with The MATLAB program is provided as ex10_11.m. H. C. So Page 71 Semester A 2017-2018

Window (db) Rectangular Bartlett Hanning Hamming Blackman Table 10.2: Transition width and ripple due to different window functions Example 10.12 Use the window method to design a linear-phase and causal FIR filter which approximates an ideal lowpass filter whose cutoff frequency is. The maximum allowable transition width is and the maximum allowable tolerance is. H. C. So Page 72 Semester A 2017-2018

The ripple of corresponds to: From Table 10.2, Hamming and Blackman windows are the two candidates which can meet the ripple requirement We choose the former because it involves a shorter filter length. The required length for the Hamming window is: Using Example 10.7 with and, the filter impulse response is: H. C. So Page 73 Semester A 2017-2018

N=132 0-46 -53 0 0.5 1 ω/π Fig.10.31: Magnitude response with Hamming window H. C. So Page 74 Semester A 2017-2018

1 N=132 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 ω/π Fig.10.32: Amplitude response with Hamming window H. C. So Page 75 Semester A 2017-2018

N=132 1.0018 0.9982 0 0.475 ω/π 0.0022-0.0022 0.525 1 ω/π Fig.10.33: Zoomed amplitude responses with Hamming window H. C. So Page 76 Semester A 2017-2018

In summary: and db or with The designed filter meets the given specifications although it has a much smaller ripple than the desired value. The MATLAB program is provided as ex10_12.m. Extension to Typical Frequency Selective Filter Design For typical frequency selective filters, namely, highpass, bandpass and bandstop filters, inverse DTFT can be used H. C. So Page 77 Semester A 2017-2018

lowpass highpass bandpass bandstop Fig.10.34: Typical frequency-selective filters H. C. So Page 78 Semester A 2017-2018

Nevertheless, we can utilize the lowpass filter to obtain impulse responses for, and A highpass filter can be considered as subtraction of a lowpass filter from an allpass filter: (10.24) Assuming rectangular window: where (10.25) H. C. So Page 79 Semester A 2017-2018

Example 10.13 Use the window method with the rectangular window to find the impulse response of a linear-phase and causal FIR filter which approximates an ideal highpass filter whose cutoff frequency is. It is required that the filter has a length of. According to (10.25) with and : Note that we can also use the MATLAB command fir1(20,0.5,'high',boxcar(21),'noscale') to get the same result The MATLAB program is provided as ex10_13.m. H. C. So Page 80 Semester A 2017-2018

0.5 0.4 h[n] 0.3 0.2 0.1 0-0.1-0.2-0.3-0.4 0 5 10 15 20 n Fig.10.35: Impulse response of highpass filter with H. C. So Page 81 Semester A 2017-2018

Magnitude Response 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 ω/p Fig.10.36: Magnitude response of highpass filter with H. C. So Page 82 Semester A 2017-2018

Similarly, an ideal bandpass filter can be designed from subtraction of two lowpass filters with cutoff frequencies and : (10.26) An ideal bandstop filter impulse response can be obtained by subtracting a bandpass filter from an allpass filter: (10.27) H. C. So Page 83 Semester A 2017-2018

Kaiser Window A problem in typical window functions is that we cannot control the ripple Kaiser window can control both and in a nearly optimal manner and it has the form of: (10.28) where is the modified zero-order Bessel function. Apart from, there is which is responsible for the window shape H. C. So Page 84 Semester A 2017-2018

That is, by properly choosing and, the design specifications in terms of and can be precisely met is computed as: (10.29) where rounds up is the peak approximation error and to the nearest integer is determined from: (10.30) H. C. So Page 85 Semester A 2017-2018

Example 10.14 Use the window method with the Kaiser window to design a linear-phase and causal FIR filter which approximates an ideal lowpass filter whose cutoff frequency is. The maximum allowable transition width is and the maximum allowable tolerance is. Since and, we then have: and H. C. So Page 86 Semester A 2017-2018

As a result, the filter impulse response is: where is determined from (10.28). In summary: db or with The designed filter exactly meets the given specifications The MATLAB program is provided as ex10_14.m. H. C. So Page 87 Semester A 2017-2018

N=107 0-46 0 0.5 1 ω/π Fig.10.37: Magnitude response with Kaiser window H. C. So Page 88 Semester A 2017-2018

1 N=107 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 ω/π Fig.10.38: Amplitude response with Kaiser window H. C. So Page 89 Semester A 2017-2018

N=107 1.0046 0.9954 0 0.475 ω/π 0.0046-0.0046 0.525 1 ω/π Fig.10.39: Zoomed amplitude responses with Kaiser window H. C. So Page 90 Semester A 2017-2018

Frequency Sampling Method The basic idea is to utilize the discrete Fourier transform (DFT), which corresponds to samples of the desired frequency response, to produce Recall: (10.31) is equal to sampled at distinct frequencies between with a uniform frequency spacing of A causal and linear-phase filter is designed with 2 steps: Extract uniformly-spaced samples from in the frequency range of Compute by taking the inverse DFT of : H. C. So Page 91 Semester A 2017-2018

(10.32) Taking transform of : (10.33) H. C. So Page 92 Semester A 2017-2018

The filter frequency response is then: (10.34) From (10.33) and (7.7) together with (10.31): (10.35) It is simple as only uniformly-spaced samples of the desired frequency response or the DFT coefficients are needed At,, equals but we cannot control the values of the remaining frequency points H. C. So Page 93 Semester A 2017-2018

It lacks flexibility in specifying the passband and stopband cutoff frequencies since placement of 1 & 0 & transition samples is constrained to integer multiples of Example 10.15 Use the frequency sampling method to design a linearphase and causal FIR filter with a length of to approximate an ideal lowpass filter whose cutoff frequency is. From Example 10.7, the ideal frequency response with linear phase is where and H. C. So Page 94 Semester A 2017-2018

We consider the frequency interval of : Extracting the values of at, : Taking the inverse DFT: The MATLAB program is provided as ex10_15.m. H. C. So Page 95 Semester A 2017-2018

1.2 Magnitude Response 1 0.8 0.6 0.4 0.2 0 0 0.2 0.4 0.6 0.8 1 ω/p Fig.10.40: Magnitude response based on frequency sampling H. C. So Page 96 Semester A 2017-2018

Amplitude Response 1 0 0 0.2857 0.5714 0.8571 1.1429 1.4286 1.7143 ω/p Fig.10.41: Amplitude response based on frequency sampling H. C. So Page 97 Semester A 2017-2018

Optimal Equiripple Method The basic idea is to evenly distribute the ripples in both passband and stopband Required filter length will be shorter than that of the window method where its exactly meets the passband or stopband ripple specification at one frequency and is superior to it at other frequencies in the band Allow Passband and stopband frequencies can be precisely specified although and are implicitly implied in the window method H. C. So Page 98 Semester A 2017-2018

Fig.10.42: Illustration of optimal equiripple lowpass filter Ripples are uniformly distributed such that maximum deviations of and more than once reaches its H. C. So Page 99 Semester A 2017-2018

The impulse response determined from: of optimal equiripple design is (10.36) where (10.37) which corresponds to a minmax optimization problem is the frequency-domain error between the desired and actual responses weighted by is the weighting function incorporates all specification parameters, namely,,, and, into the design process H. C. So Page 100 Semester A 2017-2018

For example, in lowpass filter design, has the form of: (10.38) When, there is a larger weighting at the stopband. On the other hand, implies a larger weighting at the passband To solve for the minmax problem of (10.36), we can make use of the Parks-McClellan algorithm which requires iterations. The corresponding MATLAB command is firpm where the filter length parameter is also required. H. C. So Page 101 Semester A 2017-2018

We can employ (10.39) to get its initial estimate and then compute. If the tolerance specifications are not met, we increment until the maximum deviations are bounded by and. Example 10.16 Use the optimal equiripple method to design a linear-phase and causal FIR filter which approximates an ideal lowpass filter whose passband frequency is frequency is and stopband. The maximum allowable tolerance is in both passband and stopband. H. C. So Page 102 Semester A 2017-2018

According to (10.39), an initial value of is computed as: Starting with in the Parks-McClellan algorithm, we increment its value until so that the tolerance specifications are met. The MATLAB program is provided as ex10_16.m. In summary: db or, H. C. So Page 103 Semester A 2017-2018

0.5 0.4 N=96 h[n] 0.3 0.2 0.1 0-0.1 0 10 20 30 40 50 60 70 80 90 n Fig.10.43: Impulse response of optimal equiripple lowpass filter H. C. So Page 104 Semester A 2017-2018

Magnitude 0-46 0 0.5 1 ω/π Fig.10.44: Magnitude response of optimal equiripple lowpass filter H. C. So Page 105 Semester A 2017-2018

1 Amplitude Response 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 ω/p Fig.10.45: Amplitude response of optimal equiripple lowpass filter H. C. So Page 106 Semester A 2017-2018

N=96 1.0048 0.9952 0 0.475 ω/π 0.0048-0.0048 0.525 1 ω/π Fig.10.46: Zoomed amplitude responses of optimal equiripple lowpass filter H. C. So Page 107 Semester A 2017-2018