ELEN 5346/4304 DSP and Filter Design Fall 2008 1 Lecture 11: LTI FIR filter design Instructor: Dr. Gleb V. Tcheslavski Contact:

Slides:



Advertisements
Similar presentations
Chapter 8. FIR Filter Design
Advertisements

Digital Filter Banks The digital filter bank is set of bandpass filters with either a common input or a summed output An M-band analysis filter bank is.
Hossein Sameti Department of Computer Engineering Sharif University of Technology.
EE513 Audio Signals and Systems Digital Signal Processing (Synthesis) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
ELEN 5346/4304 DSP and Filter Design Fall Lecture 8: LTI filter types Instructor: Dr. Gleb V. Tcheslavski Contact:
Hossein Sameti Department of Computer Engineering Sharif University of Technology.
Equiripple Filters A filter which has the Smallest Maximum Approximation Error among all filters over the frequencies of interest: Define: where.
Filtering Filtering is one of the most widely used complex signal processing operations The system implementing this operation is called a filter A filter.
ELEN 5346/4304 DSP and Filter Design Fall Lecture 7: Z-transform Instructor: Dr. Gleb V. Tcheslavski Contact:
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
Chapter 8: The Discrete Fourier Transform
LINEAR-PHASE FIR FILTERS DESIGN
Chapter 8 FIR Filter Design
Parks-McClellan FIR Filter Design
AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters.
EEE422 Signals and Systems Laboratory Filters (FIR) Kevin D. Donohue Electrical and Computer Engineering University of Kentucky.
Relationship between Magnitude and Phase (cf. Oppenheim, 1999)
1 Lecture 2: February 27, 2007 Topics: 2. Linear Phase FIR Digital Filter. Introduction 3. Linear-Phase FIR Digital Filter Design: Window (Windowing)
Practical Signal Processing Concepts and Algorithms using MATLAB
ELEN 5346/4304 DSP and Filter Design Fall Lecture 4: Frequency domain representation, DTFT, IDTFT, DFT, IDFT Instructor: Dr. Gleb V. Tcheslavski.
1 Chapter 8 The Discrete Fourier Transform 2 Introduction  In Chapters 2 and 3 we discussed the representation of sequences and LTI systems in terms.
Lecture 1 Signals in the Time and Frequency Domains
1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Filtros Digitais.
1 Lecture 5: March 20, 2007 Topics: 1. Design of Equiripple Linear-Phase FIR Digital Filters (cont.) 2. Comparison of Design Methods for Linear- Phase.
Chapter 7 IIR Filter Design
Filter Design Techniques
Zhongguo Liu_Biomedical Engineering_Shandong Univ. Biomedical Signal processing Chapter 7 Filter Design Techniques Zhongguo Liu Biomedical.
DSP-CIS Chapter-4: FIR & IIR Filter Design Marc Moonen Dept. E.E./ESAT, KU Leuven
IIR Filter design (cf. Shenoi, 2006) The transfer function of the IIR filter is given by Its frequency responses are (where w is the normalized frequency.
Copyright ©2010, ©1999, ©1989 by Pearson Education, Inc. All rights reserved. Discrete-Time Signal Processing, Third Edition Alan V. Oppenheim Ronald W.
1 Chapter 7 Filter Design Techniques (cont.). 2 Optimum Approximation Criterion (1)  We have discussed design of FIR filters by windowing, which is straightforward.
Dan Ellis 1 ELEN E4810: Digital Signal Processing Topic 9: Filter Design: FIR 1.Windowed Impulse Response 2.Window Shapes 3.Design by Iterative.
1 Lecture 3: March 6, 2007 Topic: 1. Frequency-Sampling Methods (Part I)
Lecture 11: FIR Filter Designs XILIANG LUO 2014/11 1.
1 Chapter 7 FIR Filter Design Techniques. 2 Design of FIR Filters by Windowing (1)  We have discussed techniques for the design of discrete-time IIR.
1 Lecture 1: February 20, 2007 Topic: 1. Discrete-Time Signals and Systems.
Fundamentals of Digital Signal Processing. Fourier Transform of continuous time signals with t in sec and F in Hz (1/sec). Examples:
Chapter 7 Finite Impulse Response(FIR) Filter Design
Chapter 9-10 Digital Filter Design. Objective - Determination of a realizable transfer function G(z) approximating a given frequency response specification.
Chapter 7. Filter Design Techniques
1 Digital Signal Processing Digital Signal Processing  IIR digital filter structures  Filter design.
1 Lecture 4: March 13, 2007 Topic: 1. Uniform Frequency-Sampling Methods (cont.)
Design of FIR Filters. 3.1 Design with Least Squared Error Error Criterion.
Summary of Widowed Fourier Series Method for Calculating FIR Filter Coefficients Step 1: Specify ‘ideal’ or desired frequency response of filter Step 2:
The IIR FILTERs These are highly sensitive to coefficients,
Optimum Approximation of FIR Filters Quote of the Day There are three kinds of lies: lies, damned lies, and statistics. Benjamin Disraeli Content and Figures.
DISP 2003 Lecture 5 – Part 1 Digital Filters 1 Frequency Response Difference Equations FIR versus IIR FIR Filters Properties and Design Philippe Baudrenghien,
Chapter 5. Transform Analysis of LTI Systems Section
EEE4176 Application of Digital Signal Processing
DSP-CIS Part-II / Chapter-4 : Filter Design Marc Moonen Dept. E.E./ESAT-STADIUS, KU Leuven
Math for CS Fourier Transforms
Professor A G Constantinides 1 Digital Filter Specifications We discuss in this course only the magnitude approximation problem There are four basic types.
IIR Filter design (cf. Shenoi, 2006)
Lecture: IIR Filter Design
EEE422 Signals and Systems Laboratory
IIR Filters FIR vs. IIR IIR filter design procedure
J McClellan School of Electrical and Computer Engineering
Fourier Series FIR About Digital Filter Design
LINEAR-PHASE FIR FILTERS DESIGN
Filter Design by Windowing
لجنة الهندسة الكهربائية
MMSE Optimal Design: The Least Squares method
Ideal Filters One of the reasons why we design a filter is to remove disturbances Filter SIGNAL NOISE We discriminate between signal and noise in terms.
Lecture 16a FIR Filter Design via Windowing
Chapter 7 FIR Digital Filter Design
Quadrature-Mirror Filter Bank
Chapter 7 Finite Impulse Response(FIR) Filter Design
ELEN E4810: Digital Signal Processing Topic 9: Filter Design: FIR
Tania Stathaki 811b LTI Discrete-Time Systems in Transform Domain Ideal Filters Zero Phase Transfer Functions Linear Phase Transfer.
Chapter 7 Finite Impulse Response(FIR) Filter Design
Presentation transcript:

ELEN 5346/4304 DSP and Filter Design Fall Lecture 11: LTI FIR filter design Instructor: Dr. Gleb V. Tcheslavski Contact: Office Hours: Room 2030 Class web site: dsp/index.htm dsp/index.htm

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations FIR filter: unit-pulse responsetransfer function (11.2.1) Here M-1 is the filter order. M is the number of filter’s coefficients. Assuming that M is odd: BTW, using our “rational notation”: (11.2.2) (11.2.3)

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations For an FIR filter to have a linear phase: That means an even symmetry of the coefficients. (11.3.1) (11.3.2) Remember: FIR filters are always stable (no poles other than at the origin)!

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations Since the filter is stable: Here is a real function of frequency. (11.4.1) As a result of symmetry: (11.4.2)

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations Therefore: Generalized linear phase We can use to design ANY amplitude of frequency response: LPF, HPF, BPF,… When changes sign, the phase undergoes an abrupt change of In M is even: (11.5.1) (11.5.2)

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations An FIR filter will also have a linear phase in the case of odd symmetry of filter coefficients (antisymmetric impulse response), i.e.: It can be shown that (11.6.1) (11.6.2) (11.6.3) Therefore: (11.6.4) BTW: (11.6.5) (11.6.6)

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations Thus: Generalized linear phase (11.7.1) Summarizing, a unit-pulse response of a GLP FIR filter must satisfy: (11.7.2) (11.7.3) (11.7.4) We only need to specify (M-1)/2 (odd M) or M/2 unique coefficients (even M).

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations Combining (11.7.2) and (11.7.3), we arrive at: (11.8.1) Example: if M = 5: Has two pairs of reciprocal zeros. firls(4,[0 0.25],[1 0]);

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations There are four types of real GLP FIR filters: indicate “structural zeros” Type I: symmetric h n, odd M (number of coefficients) – even order. Type II: symmetric h n, even M Type III: antisymmetric h n, odd M Type IV: antisymmetric h n, even M

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations 1. For M = 4, symmetrical pulse response ( Type II FIR): 2. For M = 4, antisymmetrical pulse response ( Type IV FIR): 3. For M = 5, antisymmetrical pulse response ( Type III FIR): ( ) ( ) ( ) This is where structural zeros come from…

ELEN 5346/4304 DSP and Filter Design Fall Preliminary considerations As a result of structural zeros… Type II FIR HPF would have a zero at  - specs will be violated! Type III FIR HPF would have a zero at  - specs will be violated! Type IV FIR LPF would have a zero at 0 - specs will be violated! If something like tis happens, increase or decrease the FIR order to change the type of your filter. We need to be careful with selection of filter orders!

ELEN 5346/4304 DSP and Filter Design Fall Least-square error minimization The desired magnitude response (something we specify): ( ) Filter coefficients could be found as: Example: Ideal LPF ( ) ( ) Not causal, infinite length! We need to preserve the main features while making the filter causal.

ELEN 5346/4304 DSP and Filter Design Fall Least-square error minimization The filter specified by ( ) has an infinite impulse response. Therefore, we need to truncate it at some point to make an FIR filter. As a criterion for such truncation, we need to minimize the approximation error (the difference between the desired and the truncated frequency responses). The magnitude of the frequency response of the “truncated filter”: Where L and U are points at which the pulse response was truncated. Therefore, the objective is to find a finite-duration impulse response sequence, whose DTFT would approximate the desired frequency response. ( ) We need to minimize the least-square integral error of approximation.

ELEN 5346/4304 DSP and Filter Design Fall Least-square error minimization In particular: Apparently, to minimize  R (LS error), we select h t,n = h d,n for n = L…U. Moreover, GLP requires symmetry of filter coefficients, therefore L = -U. The best finite length approximation of the ideal infinite length impulse response in the LS error sense is obtained by truncation. To make the resulting FIR causal, we need to shift it by  L radians. ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Least-square error minimization Relating the point of truncation to the FIR filter order: L = (M – 1)/2 Note: filter length M (number of filter coefficients) can be both even or odd. ( ) Non-causalCausal

ELEN 5346/4304 DSP and Filter Design Fall Windowing effects We can view the truncation of the infinite impulse response of an ideal filter as windowing. In frequency domain, this operation is equivalent to convolution of a frequency response of the window function with the frequency response of an ideal filter. from the Modulation theorem: ( ) ( ) Gibbs phenomenon (comes from truncated Fourier series) Ripples of equal magnitude in PB and SB Transition band – another window artifact W R :

ELEN 5346/4304 DSP and Filter Design Fall Windowing effects: window types As discussed previously, different window functions can be used… Window MLW (4  /M) PSL (dB) TB (2  /M) Max SB ripple (dB) Rectangular  Hanning  Hamming  Blackman  Window propertiesFilter properties Fixed windows:

ELEN 5346/4304 DSP and Filter Design Fall Windowing effects: window types Rectangular: Hanning: Hamming: Blackman: ( ) ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Windowing effects: window types Kaiser window: ( ) Where: ( ) Normally, terms in the summation are sufficient. Note: if  = 0, W n K = W n R. Adjustable windows:

ELEN 5346/4304 DSP and Filter Design Fall Windowing effects: window types  TB (2  /M) Max SB ripple (dB) Properties: Kaiser window is the most frequently used for the FIR filter design. Hanning Hamming Blackman

ELEN 5346/4304 DSP and Filter Design Fall Windowing: experimental design For the given transition band: Stop-band attenuation: Order estimate: Adjustable parameter: ( ) ( ) ( ) ( ) M controls transition band,  changes ripples. Note: in practice, ripples in SB and PB are approximately equal. If this does not hold, need to select minimum of  s,  p.

ELEN 5346/4304 DSP and Filter Design Fall Windowing: experimental design Example 11.1: design an FIR LPF using a Kaiser window for the following specs: The transition band: Order: Parameter: We select M = 24,  = 4. The filter is given by ( ) with the cutoff frequency: The resulting filter is a type II FIR which is ok for LPF. The transfer function:

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling The desired frequency response can be specified by its frequency samples at equally spaced (discrete) frequencies: Where ( ) ( )  = 0: ( ) ( ) 2  /M  /M  = 0.5:

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling The sampled frequency response will be: Evaluating IDFT: Therefore, we can compute the filter coefficients from the specified M frequency samples. ( ) ( ) Since h n is real: Since h n is symmetric, we only need to specify either (M+1)/2 (M is odd) or M/2 (M is even) frequency samples to determine the pulse response. ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling We can rewrite the FIR filter frequency response (11.7.4) as: Sampled at the frequencies the response becomes: ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Here: For simplicity, we specify the following set of real frequency samples: Therefore: ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Case 1: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Since h n is real: Since H r is real: ( ) ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Therefore: ( ) The number of coefficients (frequency samples) to be specified: - forced zero at z = -1 ( ) Since the unit-pulse response is already evaluated, we can estimate the corresponding frequency response as its zero-padded DFT: and check whether the specifications are satisfied.

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Case 2: ( ) ( ) ( ) The desired frequency samples:

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Case 3: ( ) ( ) The desired frequency samples: ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling Case 4: ( ) The desired frequency samples: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling We specify the desired response in the SB and the PB only… The stopband attenuation in this case (only SB and PB samples are given) is approximately -20 dB. Alternatively, we can add transition sample(s) and make the frequency response smoother. The stopband attenuation would be: for one TB sample: approximately -40 dB. for two TB sample: approximately -60 dB. for three TB sample: approximately -80 dB.

ELEN 5346/4304 DSP and Filter Design Fall Frequency sampling The transition band sample(s) “optimized” experimentally are: # of TB samplesSample(s) value(s)SB attenuation, dB T – if  = – if  = 0.5 ~ 40 T2[ ]~ 60 T3[ ] [ ] Note: only one of them is correct. ~ 80 T4[ ]~ 100 Effects of adding TB sample(s) are increased SB attenuation and wider TB. These samples must be optimized for the situation. Selection of the offset  can help too. Note: we can specify any desired frequency response at the samples but not in between! Ultimately, we can view all frequency samples as the TB samples, which leads to an optimal (equiripple) design.

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design We are interested in a LP filter satisfying the following requirements: Considering four FIR types: Type 1: symmetric pulse response, odd M. The real-valued frequency response: ( ) ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Type 2: symmetric pulse response, even M. The real-valued frequency response: ( ) ( ) ( ) Or: Where: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Type 3: antisymmetric pulse response, odd M. The real-valued frequency response: ( ) ( ) ( ) Or: Where: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Type 4: antisymmetric pulse response, even M. The real-valued frequency response: ( ) ( ) ( ) Or: Where: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Therefore, we can express the frequency response for all FIR types as: Where: Filter typeQ(e j  )P(e j  ) 1: M odd1 2: M even 3: M odd 4: M even ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design The desired frequency response: We can compute and compare it to. Adjusting P(  ) and selecting filter type, we can obtain the desired frequency characteristic. We introduce the weighting function on the approximation error: If  s <  p – bigger error in the passband is allowed. ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design The weighted approximation error: ( ) Where the modified weighting function and the modified desired frequency response are: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design For the given error function E(e j  ), the Chebyshev (mini-max) approximation problem is to determine the filter parameters  k that minimize the maximum absolute error over the frequency bands of interest: ( ) Usually, the frequency bands of interest are specified as: ( ) a disjoint union of the passband and the stopband: 0 -  p and  s -  (for a LPF). That is we “ignore” the transition band. More precisely speaking, error over the TB will not be optimized. The solution of this problem can be found via the alternation theorem.

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design The alternation theorem A necessary and sufficient conditions for to be unique and best approximation to in S is that the error function E(e j  ) exhibit at least L + 2 extremal frequencies in S. That is, there must exist at least L + 2 frequencies {  i }, such that: I.e., error alternates in sign between two successive extremal frequencies. ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design: Example Example 11.2: design a LPF. Since both the desired frequency response H dr and the weighting function W are piecewise constants: Consequently, the frequencies {  i } that correspond to the peaks of the error function E(e j  ) also correspond to the peaks of H r (e j  ), i.e., where the frequency response meets the specified error tolerance. Since H r (e j  ) is a polynomial of degree L: ( ) ( ) H r (e j  ) has at most L-1 local minima and maxima and, therefore, at most L+1 extremal frequencies (bandages) since we add  = 0 and  = . Furthermore, the band-edge frequencies  p and  s are also extrema of the error function. Therefore, E(e j  ) has at most L+3 extremal frequencies.

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design: Example However, from the alternation theorem, there are at least L+2 extremal frequencies in E(e j  ). Thus the error function for the LPF design will have either L+2 or L+3 (extra ripple filters) extremal frequencies. At the specified extremal frequencies  n : Here  represents the maximum value of the error function E(e j  ). alternations or alternatively: ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design: Example We can consider the {  k } and  as the unknown (to be determined) design parameters for the given extremal frequencies. Therefore: ( ) Note: initially, both the design parameters and the extremal frequencies are unknown. The above system can be solved by the iterative algorithm (Remez exchange algorithm): 1)Guess the set of L + 1 extremal frequencies; 2)Solve for {  k } and  ; 3)Determine the error function as in ( ); 4)Determine the new set of L + 1 extremal frequencies and go to 2)… Keep running until E(e j  )   - convergence.

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Alternatively, we can compute  analytically [Rabiner ‘75]: where: ( ) ( ) Therefore, the initial guess of the L + 2 extremal frequencies allows us to compute the maximum value of the error . Thus: ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Since we know that the polynomial at the points x n = cos  n has the values: the Lagrange interpolation formula can be used, which leads to Here: ( ) ( ) ( ) ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Optimal equiripple design Having the solution for P, we can compute the error function: on a dense set of frequency points. Usually, 16M frequency points are sufficient. If the error exceeds the estimated tolerance , we select a new set of frequencies corresponding to the L+2 largest peaks of error function and the procedure starts from ( ). New set of critical frequencies will lead to increased . As a result, the algorithm produces the optimal solution with equal ripples in the PB and the SB for the given M. The order of the filter can be estimated as: ( ) ( )

ELEN 5346/4304 DSP and Filter Design Fall Summary Historically, the window-based algorithm was the first proposed method for FIR design. Its major disadvantage is the lack of precise control of the critical frequencies, such as  s and  p. These values, in general, depend on the type of the window and the filter length M. The frequency sampling method is attractive since it specifies an arbitrary frequency response at the uniformly spaced frequencies and the transition band is a multiple of 2  /M. However, no control for the response in between the samples. The Chebyshev approximation method provides a total control of the filter specifications and may lead to an equiripple design. This way, the approximation error is spread evenly across the PB and SB, which leads to an optimal filter. This method is usually preferred.

ELEN 5346/4304 DSP and Filter Design Fall Remarks and conclusions Since orders of FIR filters can be quite high, these filters can introduce a considerable group delay, which is approximately M/2. The following Matlab functions are handy for FIR design: fir1 – FIR filter design using the windowing method fir2 – FIR filter design via the frequency sampling method firpm – Parks-McClellan optimal equiripple FIR design firpmord - Parks-McClellan optimal equiripple FIR order estimator

ELEN 5346/4304 DSP and Filter Design Fall Appendix: the ideal transfer functions LPF: HPF: BPF: BSF: ( ) ( ) ( ) ( )