Computer-Aided Design of Digital Filters. Digital Filters. Digital Filters. Digital Filters. Design of Equiripple Linear-Phase FIR Filters

Similar documents
Multirate Digital Signal Processing

Filter Design Problem

Digital Signal Processing Lecture 9 - Design of Digital Filters - FIR

LINEAR-PHASE FIR FILTERS DESIGN

Quadrature-Mirror Filter Bank

Filter structures ELEC-E5410

1. FIR Filter Design

Filter Analysis and Design

Stability Condition in Terms of the Pole Locations

Perfect Reconstruction Two- Channel FIR Filter Banks

LABORATORY 3 FINITE IMPULSE RESPONSE FILTERS

EFFICIENT REMEZ ALGORITHMS FOR THE DESIGN OF NONRECURSIVE FILTERS

Optimal Design of Real and Complex Minimum Phase Digital FIR Filters

Design of IIR filters

FIR BAND-PASS DIGITAL DIFFERENTIATORS WITH FLAT PASSBAND AND EQUIRIPPLE STOPBAND CHARACTERISTICS. T. Yoshida, Y. Sugiura, N.

Basic Design Approaches

INF3440/INF4440. Design of digital filters

DIGITAL SIGNAL PROCESSING UNIT III INFINITE IMPULSE RESPONSE DIGITAL FILTERS. 3.6 Design of Digital Filter using Digital to Digital

LAB 6: FIR Filter Design Summer 2011

-Digital Signal Processing- FIR Filter Design. Lecture May-16

SYNTHESIS OF BIRECIPROCAL WAVE DIGITAL FILTERS WITH EQUIRIPPLE AMPLITUDE AND PHASE

Digital Signal Processing

On the Frequency-Domain Properties of Savitzky-Golay Filters

Multirate signal processing

Exercises in Digital Signal Processing

Digital Filter Structures. Basic IIR Digital Filter Structures. of an LTI digital filter is given by the convolution sum or, by the linear constant

ELEG 5173L Digital Signal Processing Ch. 5 Digital Filters

Chapter 7: Filter Design 7.1 Practical Filter Terminology

Absolute Specifications: A typical absolute specification of a lowpass filter is shown in figure 1 where:

EE 521: Instrumentation and Measurements

POLYNOMIAL-BASED INTERPOLATION FILTERS PART I: FILTER SYNTHESIS*

DISCRETE-TIME SIGNAL PROCESSING

Enhanced Steiglitz-McBride Procedure for. Minimax IIR Digital Filters

Chapter 7: IIR Filter Design Techniques

DSP. Chapter-3 : Filter Design. Marc Moonen. Dept. E.E./ESAT-STADIUS, KU Leuven

Digital Signal Processing

ECE 8440 Unit 17. Parks- McClellan Algorithm

UNIT - III PART A. 2. Mention any two techniques for digitizing the transfer function of an analog filter?

INFINITE-IMPULSE RESPONSE DIGITAL FILTERS Classical analog filters and their conversion to digital filters 4. THE BUTTERWORTH ANALOG FILTER

2. Typical Discrete-Time Systems All-Pass Systems (5.5) 2.2. Minimum-Phase Systems (5.6) 2.3. Generalized Linear-Phase Systems (5.

Lecture 7 Discrete Systems

Tunable IIR Digital Filters

Design of Orthonormal Wavelet Filter Banks Using the Remez Exchange Algorithm

Optimum Ordering and Pole-Zero Pairing of the Cascade Form IIR. Digital Filter

PS403 - Digital Signal processing

Digital Filter Structures

ECE 410 DIGITAL SIGNAL PROCESSING D. Munson University of Illinois Chapter 12

Filters and Tuned Amplifiers

1 1.27z z 2. 1 z H 2

ECSE 512 Digital Signal Processing I Fall 2010 FINAL EXAMINATION

DSP-CIS. Chapter-4: FIR & IIR Filter Design. Marc Moonen

We have shown earlier that the 1st-order lowpass transfer function

Digital Signal Processing

Butterworth Filter Properties

UNIVERSITY OF OSLO. Faculty of mathematics and natural sciences. Forslag til fasit, versjon-01: Problem 1 Signals and systems.

A Unified Approach to the Design of Interpolated and Frequency Response Masking FIR Filters

Signal Processing. Lecture 10: FIR Filter Design. Ahmet Taha Koru, Ph. D. Yildiz Technical University Fall

Optimum Ordering and Pole-Zero Pairing. Optimum Ordering and Pole-Zero Pairing Consider the scaled cascade structure shown below

Design of FIR Nyquist Filters with Low Group Delay

Fourier Series Representation of

ELEG 305: Digital Signal Processing

Problem Set 9 Solutions

DESIGN OF LINEAR-PHASE LATTICE WAVE DIGITAL FILTERS

Design of Stable IIR filters with prescribed flatness and approximately linear phase

IT DIGITAL SIGNAL PROCESSING (2013 regulation) UNIT-1 SIGNALS AND SYSTEMS PART-A

Digital Control & Digital Filters. Lectures 21 & 22

EE482: Digital Signal Processing Applications

Maximally Flat Lowpass Digital Differentiators

Neural Network Algorithm for Designing FIR Filters Utilizing Frequency-Response Masking Technique

2.161 Signal Processing: Continuous and Discrete Fall 2008

(Refer Slide Time: 01:28 03:51 min)

ECE503: Digital Signal Processing Lecture 5

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science Discrete-Time Signal Processing Fall 2005

Linear Programming Algorithms for Sparse Filter Design

REAL TIME DIGITAL SIGNAL PROCESSING

Analog and Digital Filter Design

MITOCW watch?v=jtj3v Rx7E

Digital Speech Processing Lecture 10. Short-Time Fourier Analysis Methods - Filter Bank Design

Review of Fundamentals of Digital Signal Processing

Cast of Characters. Some Symbols, Functions, and Variables Used in the Book

DIGITAL SIGNAL PROCESSING. Chapter 6 IIR Filter Design

EEO 401 Digital Signal Processing Prof. Mark Fowler

Discrete-time Symmetric/Antisymmetric FIR Filter Design

DEPARTMENT OF EI DIGITAL SIGNAL PROCESSING ASSIGNMENT 1

Review of Fundamentals of Digital Signal Processing

A DESIGN OF FIR FILTERS WITH VARIABLE NOTCHES CONSIDERING REDUCTION METHOD OF POLYNOMIAL COEFFICIENTS FOR REAL-TIME SIGNAL PROCESSING

SPEECH ANALYSIS AND SYNTHESIS

Analysis of Finite Wordlength Effects

Digital Signal Processing Lecture 8 - Filter Design - IIR

Design of Coprime DFT Arrays and Filter Banks

LTI Discrete-Time Systems in Transform Domain Ideal Filters Zero Phase Transfer Functions Linear Phase Transfer Functions

The basic structure of the L-channel QMF bank is shown below

A REALIZATION OF FIR FILTERS WITH SIMULTANEOUSLY VARIABLE BANDWIDTH AND FRACTIONAL DELAY. Håkan Johansson and Amir Eghbali

Lecture 3 - Design of Digital Filters

# FIR. [ ] = b k. # [ ]x[ n " k] [ ] = h k. x[ n] = Ae j" e j# ˆ n Complex exponential input. [ ]Ae j" e j ˆ. ˆ )Ae j# e j ˆ. y n. y n.

Part 4: IIR Filters Optimization Approach. Tutorial ISCAS 2007

Design of Narrow Stopband Recursive Digital Filter

representation of speech

Introduction to Digital Signal Processing

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science. Fall Solutions for Problem Set 2

Transcription:

Computer-Aided Design of Digital Filters The FIR filter design techniques discussed so far can be easily implemented on a computer In addition, there are a number of FIR filter design algorithms that rely on some type of optimization techniques that are used to minimize the error between the desired frequency response and that of the computer-generated filter Computer-Aided Design of Digital Filters Basic idea behind the computer-based iterative technique j et H ( e ) denote the frequency response of the digital filter H( to be designed approximating the desired frequency j response D( e ), given as a piecewise linear function of, in some sense 3 Computer-Aided Design of Digital Filters Objective - Determine iteratively the coefficients of H( so that the difference j j between between H ( e ) and D( e ) over closed subintervals of π is minimized This difference usually specified as a weighted error function j j j E ( = W ( e )[ H ( e ) D( e )] j where W ( e ) is some user-specified weighting function 4 Computer-Aided Design of Digital Filters Chebyshev or minimax criterion - Minimizes the peak absolute value of the weighted error: ε = maxe ( R where R is the set of disjoint frequency bands j in the range π, on which D( e ) is defined 5 inear-phase FIR Filters The linear-phase FIR filter obtained by minimizing the peak absolute value of ε = maxe( R is usually called the equiripple FIR filter After ε is minimized, the weighted error function E( exhibits an equiripple behavior in the frequency range R 6 inear-phase FIR Filters The general form of frequency response of a causal linear-phase FIR filter of length M+: j jm jβ ( H ( e ) = e e H ( where the amplitude response H ( ( is a real function of Weighted error function ( is given by E ( = W ( [ H ( D( ] where D( is the desired amplitude response and W ( is a positive weighting function

7 inear-phase FIR Filters Parks-McClellan Algorithm - Based on iteratively adjusting the coefficients of H ( ( until the peak absolute value of E( is minimized If peak absolute value of E( in a band a b is εo, then the absolute error satisfies ( ε H ( ) D( o, a b W ( 8 inear-phase FIR Filters For filter design,, in the passband D( =, in the stopband H ( ( is required to satisfy the above desired response with a ripple of ± δ p in the passband and a ripple of in the stopband δ s 9 inear-phase FIR Filters Thus, weighting function can be chosen either as, in the passband W ( = δ p / δs, in thestopband or δs / δ p, in the passband W ( =, in thestopband inear-phase FIR Filters ( M Type FIR Filter - H ( = a[ k]cos( k) k= where a[] = h[ M ], a[ k] = h[ M k], k M Type FIR filter - (M + ) / H ( ( = where b k] k= b[ k]cos ( ( k ) ) M [ [ + + ], M = h k k inear-phase FIR Filters ( M Type 3 FIR Filter - H ( = c[ k]sin( k) k = where c[ k] = h[ M k], k M Type 4 FIR Filter - (M + ) / H ( ( = d[ k]sin ( k where k= d[ k] = h[ M + k], ( )) k M + inear-phase FIR Filters Amplitude response for all 4 types of linearphase FIR filters can be expressed as H ( ( = Q( A( where, for Type cos( /), for Type Q( = sin(, for Type 3 sin( / ), for Type 4

and inear-phase FIR Filters where A( = a [ k]cos( k) k= a[ k], b[ k], a [ k] = c [ k], d[ k], for Type for Type for Type 3 for Type 4 inear-phase FIR Filters with M, for Type M, for Type = M, for Type 3 M, for Type 4 b [ k ], c [ k], and d[ k], are related to b[k], c[k], and d[k], respectively 3 4 5 inear-phase FIR Filters Modified form of weighted error function E ( = W ( [ Q( A( D( ] D( = W ( Q( [ A( ] Q( = W ( [ A( D( ] where we have used the notation W ( = W ( Q( D( = D( / Q( 6 inear-phase FIR Filters Optimization Problem - Determine a [ k ] which minimize the peak absolute value ε of E( = W( [ a [ k]cos( k) D( ] k= over the specified frequency bands R After a [ k ] has been determined, corresponding coefficients of the original A( are computed from which h[n] are determined 7 inear-phase FIR Filters Alternation Theorem - A( is the best unique approximation of D( obtained by minimizing peak absolute value ε of E( = W ( [ Q( A( D( ] if and only if there exist at least + extremal frequencies, { i}, i +, in a closed subset R of the frequency range π such that < < < < + and E ) = E ( ), E ( i) = ε for all i ( i i + 8 inear-phase FIR Filters Consider a Type FIR filter with an amplitude response A( whose approximation error E ( satisfies the Alternation Theorem Peaks of E ( are at = i, i + where de ( / d = Since in the passband and stopband, W ( ) and D ( ) are piecewise constant, de ( da( = = at = i d d 3

9 inear-phase FIR Filters Using cos( k ) = Tk (cos, where T k (x) is the k-th order Chebyshev polynomial T ( ) cos( cos k x = k x) A( can be expressed as = k A( ) k= α[ k](cos which is an th-order polynomial in cos Hence, A( can have at most local minima and maxima inside specified passband and stopband inear-phase FIR Filters At bandedges, = p and = s, E ( is a maximum, and hence A( has extrema at these points A( can have extrema at = and = π Therefore, there are at most +3 extremal frequencies of E ( For linear-phase FIR filters with K specified bandedges, there can be at most +K+ extremal frequencies inear-phase FIR Filters The set of equations W ( )[ A( ) D( )] = ( ) i i i i ε, i + is written in a matrix form [] D ( cos( ) cos( ) / W ( ) a cos( ) cos( ) / W ( ) a [] D( M M O M M M = cos( ) cos( ) ( ) / W ( ) a [ ] M D( cos( ε + ) cos( + ) ( ) / W ( + ) ) ) ) D ( + ) inear-phase FIR Filters The matrix equation can be solved for the unknowns a [ i ] and ε if the locations of the + extremal frequencies are known a priori The Remez exchange algorithm is used to determine the locations of the extremal frequencies 3 Remez Exchange Algorithm Step : A set of initial values of extremal frequencies are either chosen or are available from completion of previous stage Step : Value of ε is computed using cd( + cd( + + c + ( ) ε = D + ( ) + c c c + + + W ( W ( W ( + ) where = + c n cos( ) cos( i= n i) i n 4 Remez Exchange Algorithm Step 3: Values of A( at = i are then computed using ( ) i ε A( i ) = + D( i ), i + W ( ) i Step 4: The polynomial A( is determined by interpolating the above values at the + extremal frequencies using the agrange interpolation formula 4

Remez Exchange Algorithm Step 4: The new error function E ( = W ( [ A( D( ] is computed at a dense set S ( S ) of frequencies. In practice S = 6 is adequate. Determine the + new extremal frequencies from the values of E ( evaluated at the dense set of frequencies. Step 5: If the peak values ε of E ( are equal in magnitude, algorithm has converged. Otherwise, go back to Step. Remez Exchange Algorithm Illustration of algorithm Iteration process is stopped if the difference between the values of the peak absolute errors between two consecutive stages is less than a preset value, e.g., 6 5 6 Remez Exchange Algorithm Example-Approximate the desired function D( x) =.x. defined for the range x by a linear function a x + a by minimizing the peak value of the absolute error max.x. a ax x [,] Stage : Choose arbitrarily the initial extremal points x =, x =.5, x.5 3 = Remez Exchange Algorithm Solve the three linear equations l a + axl ( ) ε = D( xl ), l =,,3 i.e., a..5 a =.75.5 ε.375 for the given extremal points yielding a =.375, a =.65, ε.75 = 7 8 9 Remez Exchange Algorithm Plot of E ( x) =.x.65x +.75 along with values of error at chosen extremal points shown below Error.5.5 -.5.5.5 x Note: Errors are equal in magnitude and alternate in sign 3 Remez Exchange Algorithm Stage : Choose extremal points where E ( x) assumes its maximum absolute values These arex =, x =.75, x3 = New values of unknowns are obtained by solving a..75 a =.588 ε 4.3 yielding a =.656, a =., ε.556 = 5

3 Remez Exchange Algorithm Plot of E ( x) =.x.x +.556 along with values of error at chosen extremal points shown below Error.5 -.5 -.5.5 x 3 Remez Exchange Algorithm Stage 3: Choose extremal points where E ( x) assumes its maximum absolute values These arex =, x =, x3 = New values of unknowns are obtained by solving a a =.. ε 4.3 yielding a =.65, a =., ε.55 = 33 Remez Exchange Algorithm Plot of E3 ( x) =.x.x +.55 along with values of error at chosen extremal points shown below Error.5 -.5 -.5.5 x Algorithm has converged as ε is also the maximum value of the absolute error 34 Design of Minimum-Phase FIR Filters inear-phase FIR filters with narrow transition bands are of very high order, and as a result have a very long group delay that is about half the filter order By relaxing the linear-phase requirement, it is possible to design an FIR filter of lower order thus reducing the overall group delay and the computational cost Design of Minimum-Phase FIR Filters A very simple method of minimum-phase FIR filter is described next Consider an arbitrary FIR transfer function of degree N: N n N H ( = h[ n] z = h[ ] ( ξ z ) n= k= k Design of Minimum-Phase FIR Filters The mirror-image polynomial to H( is given by ˆ N H ( = z H ( z = N n= ) h[ N n] z n = h[ N] N ( k= z / ξ ) The zeros of Hˆ ( are thus at z = / ξk, i.e., are reciprocal to the zeros of H( at z = ξ k k 35 36 6

37 Design of Minimum-Phase FIR Filters As a result, ˆ N G( = H ( H ( = z H ( H ( z ) has zeros exhibiting mirror-image symmetry in the z-plane and is thus a Type linearphase transfer function of order N Moreover, if H( has a zero on the unit circle, Hˆ ( will also have a zero on the unit circle at the conjugate reciprocal position Design of Minimum-Phase FIR Filters Thus, unit circle zeros of G( occur in pairs On the unit circle we have H ( e j ( ) = G( G ( ( Moreover, the amplitude response G ( ( has double zeros in the frequency range [, π] 38 Design of Minimum-Phase FIR Filters Design Procedure Step : Design a Type linear-phase transfer function F( of degree N satisfying the specifications: ( δ p F( + δ p for [, p] ( δs F( δ p for [ s, π] Note that F( has single unit circle zeros Design of Minimum-Phase FIR Filters Step : Determine the linear-phase transfer function N G( = δ s z + F( Its amplitude response satisfies ( + δs δ p G( + δs + δ p for [, p] ( G( δ s for [ s, π] 39 4 4 Design of Minimum-Phase FIR Filters Note that G( has double zeros on the unit circle and all other zeros are situated with a mirror-image symmetry Hence, it can be expressed in the form N G( = z Hm( Hm( z ) where H m ( is a minimum-phase transfer function containing all zeros of G( that are inside the unit circle and one each of the unit circle double zeros Design of Minimum-Phase FIR Filters Step 3: Determine H m ( from G( by applying a spectral factorization (F ) The passband ripple δ p and the stopband ripple (F ) δ s of F( must be chosen to ensure that the specified passband ripple δ p and the stopband ripple of H m ( are satisfied δ s 4 7

43 Design of Minimum-Phase FIR Filters It can be shown δ p δ δ s p = +, δs = + δs + δs An estimate of the order N of H m ( can be found by first estimating the order of F( and then dividing it by If the estimated order of F( is an odd integer, it should be increased by 44 FIR Digital Filter Design Using MATAB Order Estimation - Kaiser s Formula: log( δ pδs ) N 4.6( s p) / π Note: Filter order N is inversely proportional to transition band width ( s p ) and does not depend on actual location of transition band 45 FIR Digital Filter Design Using MATAB Hermann-Rabiner-Chan s Formula: D ( δ p, δs) F( δ p, δs)[( s p) / π] N ( s p) / π where D ( δ p, δs) = [ a(log δ p) + a(log δ p) + a3] log + [ a4(log δ p ) + a5(log δ p) + a6] F( δ p, δs) = b + b[log δ p log δs] with a =.539, a =.74, a3 =.476 a4 =.66, a5 =.594, a6 =.478 b =.7, b =.544 46 δ s FIR Digital Filter Design Using MATAB Formula valid for δ p δ s For δ p < δ s, formula to be used is obtained by interchanging δ p and δs Both formulas provide only an estimate of the required filter order N Frequency response of FIR filter designed using this estimated order may or may not meet the given specifications If specifications are not met, increase filter order until they are met 47 FIR Digital Filter Design Using MATAB MATAB code fragments for estimating filter order using Kaiser s formula num = - *log(sqrt(dp*ds)) - 3; den = 4.6*(Fs - Fp)/FT; N = ceil(num/den); M-file remezord implements Hermann- Rabiner-Chan s order estimation formula 48 FIR Digital Filter Design Using MATAB For FIR filter design using the Kaiser window, window order is estimated using the M-file kaiserord The M-file kaiserord can in some cases generate a value of N which is either greater or smaller than the required minimum order If filter designed using the estimated order N does not meet the specifications, N should either be gradually increased or decreased until the specifications are met 8

49 The M-file remez can be used to design an equiripple FIR filter using the Parks- McClellan algorithm Example-Design an equiripple FIR filter with the specifications: F p =.8 khz, Fs = khz, FT = 4 khz, α p =. 5dB, α s = 4 db Here, δ p =. 559 and =. δ s 5 MATAB code fragments used are [N, fpts, mag, wt] = remezord(fedge, mval, dev, FT); b = remez(n, fpts, mag, wt); where fedge = [8 ], mval = [ ], dev = [.559.],and FT = 4 5 The computed gain response with the filter order obtained (N = 8) does not meet the specifications ( α p =.6dB, α s = 38. 7dB) Specifications are met with N = 3 - -4 Equiripple FIR owpass Filter -6..4.6.8.5 Passband Details -.5...3.4 5 Example- Design a linear-phase FIR bandpass filter of order 6 with a passband from.3 to.5, and stopbands from to.5 and from.55 to The pertinent input data here are N = 6 fpts = [.5.3.5.55 ] mag = [ ] wt = [ ] 53 Computed gain response shown below where α p = db, =8. 7 db - -4 α s N = 6, weight ratio = -6..4.6.8 54 We redesign the filter with order increased to Computed gain response shown below where =.4 db, = 5. db α p Note: Increase in order improves gain response at the expense of increased computational complexity α s - -4-6 N =, weight ratio = -8..4.6.8 9

55 α s can be increased at the expenses of a larger α p by decreasing the relative weight N =, weight ratio = / ratio W ( ) = δ p / δs Gain response of - bandpass filter of -4 order obtained -6 with a weight vector [. ] -8..4.6.8 Now α p =.76dB, = 6. 86 db α s 56 Plots of absolute error for st design Absolute error has same peak value in all bands As = 3, and there -...4.6.8 are 4 band edges, there can be at most + 6 = 8 extrema Error plot exhibits 7 extrema Absolute Error.. -. N = 6, weight ratio = 57 Absolute error has same peak value in all bands for the nd design Absolute error in passband of 3rd design is times the error in the stopbands Absolute Error 4 x -3 - N =, weight ratio = -4..4.6.8..5 -.5 N =, weight ratio = / -...4.6.8 58 Example- Design a linear-phase FIR bandpass filter of order 6 with a passband from.3 to.5, and stopbands from to.5 and from.6 to with unequal weights The pertinent input data here are N = 6 fpts = [.5.3.5.6 ] mag = [ ] wt = [.3] 59 Plots of gain response and absolute error shown below - -4-6 -8..4.6.8 Absolute Error..5 -.5 -...4.6.8 6 Response in the second transition band shows a peak with a value higher than that in passband Result does not contradict alternation theorem As N = 6, M = 3, and hence, there must be at least M + = 3 extremal frequencies Plot of absolute error shows the presence of 3 extremal frequencies

6 If gain response of filter designed exhibits a nonmonotonic behavior, it is recommended that either the filter order or the bandedges or the weighting function be adjusted until a satisfactory gain response has been obtained Gain plot obtained by moving the - second stopband -4 edge to.55-6 -8..4.6.8 6 Equiripple FIR Differentiator A lowpass differentiator has a bandlimited frequency response j j, p H DIF ( e ) =, s π where p represents the passband and s π represents the stopband For the design phase we choose W ( = /, D( =, p 63 Equiripple FIR Differentiator The M-file remezord cannot be used to estimate the order of an FIR differentiator Example-Design a full-band ( p = π) differentiator of order Code fragment to use b = remez(n, fpts, mag, differentiator ); where N = fpts = [ ] mag = [ pi] 64 Equiripple FIR Differentiator Plots of magnitude response and absolute error Magnitude 3..4.6.8 Absolute error increases with as the algorithm results in an equiripple error of the function [ A ( ) ] Absolute Error..5 -.5 -...4.6.8 Equiripple FIR Differentiator Example-Design a lowpass differentiator of order 5 with p =. 4π and s =. 45π Code fragment to use b = remez(n, fpts, mag, differentiator ); where N = 5 fpts = [.4.45 ] mag = [.4*pi ] Equiripple FIR Differentiator Plot of the magnitude response of the lowpass differentiator Magnitude.5.5..4.6.8 65 66

67 Equiripple FIR Hilbert Transformer Desired amplitude response of a bandpass Hilbert transformer is D( ) =, H with weighting function W ( ) =, H Impulse response of an ideal Hilbert transformer satisfies the condition h HT [ n] =, for n even which can be met by a Type 3 FIR filter 68 Equiripple FIR Hilbert Transformer Example-Design a linear-phase bandpass FIR Hilbert transformer of order with =. π, H =. 9π Code fragment to use b = remez(n, fpts, mag, Hilbert ); where N = fpts = [..9] mag = [ ] Equiripple FIR Hilbert Transformer Plots of magnitude response and absolute error Magnitude.8.6.4...4.6.8 Absolute Error.4. -. -.4..4.6.8 Window-Based FIR Filter Window Generation - Code fragments to use w = blackman(); w = hamming(); w = hanning(); w = chebwin(, Rs); w = kaiser(, beta); where window length is odd 69 7 7 Window-Based FIR Filter Example-Kaiser window design for use in a lowpass FIR filter design Specifications of lowpass filter: p =. 3π, s =. 4π, α s = 5 db δ s =. 36 Code fragments to use [N, Wn, beta, ftype] = kaiserord(fpts, mag,dev); w = kaiser(n+, beta); where fpts = [.3.4] mag = [ ] dev = [.36.36] 7 Window-Based FIR Filter Plot of the gain response of the Kaiser window - -4-6 Gain Response of Kaiser Window -8..4.6.8

73 Window-Based FIR Filter M-files available are fir and fir firis used to design conventional lowpass, highpass, bandpass, bandstop and multiband FIR filters firis used to design FIR filters with arbitrarily shaped magnitude response Infir, Hamming window is used as a default if no window is specified 74 Window-Based FIR Filter Example-Design using a Kaiser window a lowpass FIR filter with the specifications: p =. 3π, s =. 4π, δ s =. 36 Code fragments to use [N, Wn, beta, ftype] = kaiserord(fpts, mag, dev); b = fir(n, Wn, kaiser(n+, beta)); where fpts = [.3.4] mag = [ ] dev = [.36.36] 75 Window-Based FIR Filter Plot of gain response owpass Filter Designed Using Kaiser Window - -4-6 -8..4.6.8 76 Window-Based FIR Filter Example-Design using a Kaiser window a highpass FIR filter with the specifications: p =. 55π, s =. 4π, δ s =. Code fragments to use [N, Wn, beta, ftype] = kaiserord(fpts, mag, dev); b = fir(n, Wn, ftype, kaiser(n+, beta)); where fpts = [.4.55] mag = [ ] dev = [..] Window-Based FIR Filter Plot of gain response Higpass Filter Designed Using Kaiser Window - -4-6 -8..4.6.8 Window-Based FIR Filter Example- Design using a Hamming window an FIR filter of order with three different constant magnitude levels:.3 in the frequency range [,.8],. in the frequency range [.3,.5], and.7 in the frequency range [.5,.] 77 78 3

79 Window-Based FIR Filter Code fragment to use b = fir(, fpts, mval); where fpts = [.8.3.5.5 ]; mval = [.3.3...7.7]; Magnitude Multiband Filter.8.6.4...4.6.8 8 Minimum-Phase FIR Filter The minimum-phase FIR filter design method outlined earlier involves the spectral factorization of a Type linear-phase FIR transfer function G( with a non-negative amplitude response in the form N G( = z Hm( Hm( z ) where H m ( contains all zeros of G( that are inside the unit circle and one each of the unit circle double zeros Spectral Factorization Spectral Factorization 8 We next outline the basic idea behind a simple spectral factorization method Without any loss of generality we consider the spectral factorization of a 6-th order linear-linear phase FIR transfer function G( with a non-negative amplitude response: 3 G ( = g + g z + g z + g z 3 4 z 5 z 6 3 + g + g + g z 8 Our objective is to express the above G( in the form 3 G( = z Hm( Hm( z ) where 3 H m ( = a + az + az + a3z is the minimum-phase factor of G( Spectral Factorization Spectral Factorization 83 Expressing G( in terms of the coefficients of H m ( we get G( = ( a 3 z + az + az + a3 ) ( a + a z + a z + a z 3 3 Forming the product of the two polynomials given above and comparing the coefficients of like powers of z the product with that of G( given on the previous slide we arrive at 4 equations given in the next slide ) 84 = a + a + a a3 = aa + aa aa3 = aa aa3 3 a3 g + g + g + g = a The above set of equations is then solved iteratively using the Newton-Raphson method 4

85 Spectral Factorization First, the initial values of a i are chosen to ensure that H m ( has all zeros strictly inside the unit circle Then, the coefficients a i are changed by adding the corrections e i so that the modified values a i + e i satisfy better the set of 4 equalities given in the previous slide The process is repeated until the iteration converges 86 Spectral Factorization Substituting a i + e i in the 4 equations given earlier and expanding the products, a set of linear equations are obtained by eliminating all quadratic terms in e i from the expansion In matrix form, these equations can be written as Ae = b where a a a a3 a + + = a a a3 a a A a a3 a a a3 a 87 Spectral Factorization and e g a a a a3 e e =, b = g e aa aa aa3 g aa aa 3 e3 g aa3 The matrix A can be expressed as a a a a3 a a a a3 a = a a3 a + a a A a a3 a a a3 a 88 Spectral Factorization The iteration convergence is checked at each step by evaluating the error term 3 i e = i The error term first decreases monotonically and the iteration is stopped when the error starts increasing The M-file minphase.m implements the above spectral factorization method 89 Minimum-Phase FIR Filter Example Design a minimum-phase lowpass FIR filter with the following specifications: p =. 45π, s =. 6π, Rp = db and R s = 6 db Using Program _3.m we arrive at the desired filter Plots of zeros of G(, zeros of H m (, and the gain response of H m ( are shown in the next slide 9 Imaginary Part.5 -.5 - Minimum-Phase FIR Filter Zeros of G( 6 - - Real Part - -4-6 Imaginary Part.5 -.5-8..4.6.8 - Gain response of H m ( Zeros of H m ( -.5 - -.5.5.5 Real Part 8 5

Maximum-Phase FIR Filter Design of Computationally Efficient FIR Digital Filters A maximum-phase spectral factor of a linear-phase FIR filter with an impulse response b of even order with a nonnegative zero-phase frequency response can be designed by first computing its minimum-phase spectral factor h and the using the statement G = fliplr(h) As indicated earlier, the order N of a linearphase FIR filter is inversely proportional to the width of the transition band Hence, in the case of an FIR filter with a very sharp transition, the order of the filter is very high This is particularly critical in designing very narrow-band or very wide-band FIR filters 9 9 Design of Computationally Efficient FIR Digital Filters Design of Computationally Efficient FIR Digital Filters The computational complexity of a digital filter is basically determined by the total number of multipliers and adders needed to implement the filter The direct form implementation of a linearphase FIR filter of order N requires, in general, N + multipliers and N two-input adders We now outline two methods of realizing computationally efficient linear-phase FIR filters The basic building block in both methods is an FIR subfilter structure with a periodic impulse response 93 94 95 The Periodic Filter Section Consider a Type linear-phase FIR filter F( of even degree N: F( = N n= f [ n] z n Its delay-complementary filter E( is given by N / N / N n E( = z F( = z f [ n] z = ( f [ N / ]) z N / N n n N = / n= n f [ n] z 96 The Periodic Filter Section The transfer function H( obtained by replacing z in F( with z, with being a positive integer, is given by H ( = F( z ) = N n= f [ n] z n The order of H( is thus N A direct realization of H( is obtained by simply replacing each unit delay in the realization of F( with unit delays 6

The Periodic Filter Section The Periodic Filter Section Note: The number of multiplers and delays in the realization of H( is the same as those in the realization of F( The transfer function H( has a sparse impulse response of length N +, with zero-valued samples inserted between every consecutive pair of impulse response samples of F( The parameter is called the sparsity factor The relations between the amplitude responses of these two filters is given by ( ( H ( = F( It follows from the above that the amplitude response H ( ( is a period function of with a period π/ 97 98 The Periodic Filter Section The Periodic Filter Section One period of H ( ( is obtained by compressing the amplitude response F ( ( in the interval [, π] to the interval [, π/] A transfer function H( with a frequency response that is a periodic function of with a period π/ is called a periodic filter If F( is a lowpass filter with a single pasband and a single stopband, H( will be a multiband filter with / + pasbands and / stopbands as shown in the next slide for = 4 99 The Periodic Filter Section ( F) π p s (F) F( G( = E( delay-complementary filter E( periodic filter H( H( = F( E( = _ F( ( (F) π p F) π s ( F) ( F) π+ ( F) s π s π p delay-complementary periodic filter G( The Periodic Filter Section et F( be a lowpass filter with passband (F ) edge at p and and stopband edge at (F ) s, where (F s ) < π Then, the passband and stopband edges of the first band of H( are at p / and p /, respectively The passband and stopband edges of the second band of H( are at ( π ± p ) / and ( π ± p ) /, respectively, and so on as shown on the previous slide 7

3 The Periodic Filter Section The width of the transition bands of H( are ( s p ) /, which is -th of that of F( ikewise, the transfer function G( by replacing z in E( with z, is given by N / G( = E( z ) = z F( z ) = z N / N n= f [ n] z n The amplitude response of G( is given by ( ( ( G( = H ( = F( 4 The overall filter H IFIR ( is designed as a cascade of a linear-phase FIR filter F( z ) and another filter I( that suppreses the undesired passbands of the periodic filter section as shown below F( z ) I( periodic filter interpolator The widths of the transition band and the passband of the cascade are th of those of F( 5 The cascaded structure is called the interpolated finite impulse response (IFIR) filter, as the missing impulse response samples of the periodic filter section are being interpolated by the filter section I(, called the interpolator As the filter F( determines approximately the shape of the amplitude response of the IFIR filter, it is called a shaping filter 6 Design Steps IFIR specifications: passband edge, stopband edge s, passband ripple δ p p, stopband ripple δ s Shaping filter specifications: F passband edge ( p ) = p F stopband edge ( s ) = s passband ripple δ p = δ p / F stopband ripple δ ( ) = δ s s 7 The interpolator I( has to be designed to preserve the passband of F( z ) in the frequency range [, p] and mask the amplitude response of F( z ) in the frequency range [ s, π], where the periodic subfilter has unwanted passbands and transition bands This latter region is defined by / π k πk R = + π U s,min s, k= 8 The transition band of the interpolator is the frequency range π p, s Figure below shows the amplitude responses of H IFIR ( and I( H IFIR( p I ( s π s π +s don't care 4 π s π 8

9 Summarinzing, the design specifications for F( and I( are as follows: ( δ for p F( + δ p [, p] ( δ for s F( δs [ s, π] ( I ) ( ( I ) for δ p I ( + δ p [, p] ( I ) ( ( I ) for δs I ( δs R The two linear-phase FIR filters F( and I( can be designed using the Parks- McClellan method Example Filter specifications are as follows:,,, p =. 5π s =. π δ p =. δ s =. It follows from the figure in Slide that to ensure no overlaps between adjacent passbands of F( z ), we should choose to satisfy the condition s π < s For our example, this reduces to. π < π. π implying < 5 Hence, the largest value of that can be used is = 4, yielding an IFIR structure requiring the least number of multipliers As a result, the specifications for F( and I( are as given in the next slide F(: p =. 6π, s =. 8π δ p =., δs =. ( I ) ( I ) I(: p =. 5π, s =. 3π ( I ) ( I ) δ p =., δs =. The filter orders of F( and I( obtained using remezord are: Order of F( = 3 Order of I( = 43 3 It can be shown that the filters F( and I( designed using remez with the above orders do not lead to an IFIR design meeting the minimum stopband attenuation of 6 db To meet the stopband specifications, the orders of F( and I( need to be increased to 33 and 46, respectively 4 The pertinent gain responses of the redesigned IFIR filter are shown below: - -4-6 I( F(z 4 ) -8..4.6.8-8..4.6.8 The number of multipliers needed to implement F( and hence, F( z 4 ) is R F - -4-6 H IFIR ( = ( 33 + ) / = 7 9

5 The number of multipliers needed to implement I( is: R I = ( 46 + ) / = 4 As a result, the total number of multipliers needed to implement H IFIR ( is R IFIR = 7 + 4 = 4 The number of multipliers needed to implement the direct single-stage implementation of the FIR filter is = 6 ( + ) / 6 This approach makes use of the relation between a periodic filter H ( = F( z ) generated from a Type linear-phase FIR filter of even degree N and its delaycomplementary filter G( given by N / N / G( = z H ( = z F( z ) The amplitude responses of F(, its delaycomplentary filter E(, the periodic filter H( and its delay-complentary filter G( are shown in the next slide 7 F( delay-complementary filter E( E( = _ F( ( F) π p s (F) G( = E( periodic filter H( H( = F( ( π p F) s (F) π ( F) ( F) π+ ( F) s π s π p delay-complementary periodic filter G( 8 By selectively masking out the unwanted pasbands of both H( and G( by cascading each with appropriate masking filters I ( and I (, respectively, and connecting the resulting cascades in prallel, we can design a large class of FIR filters with sharper transition bands The overall structure is then realized as indicated in the next slide 9 F( z ) I ( + N/ z + I ( z N / Note:The delay block can be realized by tapping the FIR structure implementing F( z ) Also, I ( and I ( can share the same delay-chain if they are realized using the transposed direct form structure The transfer function of the overall structure is given by ( = H ( I ( G( I ( H FM + N / = F( z ) I( + [ z F( z )] I ( The corresponding amplitude response is ( ( ( ( ( H FM ( = F( I( + [ F( ] I(

The overall computational complexity is given by the complexities of F(, I ( and I ( All these three filters have wide transition bands and, in general, require considerably fewer multipliers and adders than that required in a direct design of the desired sharp cutoff filter Design Objective Given the specifications of H FM (, determine the specifications of F(, I ( and I ( design these 3 filters Design method Illustrated for lowpass filter design Two different situations may arise depending on how the transition band of H FM ( is created Case A Transition band of H FM ( is from one of the transition bands of H( I ( I ( π π ( p F) ( F) π+ p (F) 4π s H FM ( Bandedges of H FM ( are related to the bandedges of F( as follows: lπ + lπ + s p p =, s =, l 3 ( F) π π+ ( F) p π+ s 4 Case B Transition band of H FM ( is from one of the transition bands of G( I ( I ( (F ) π (F) (F) s π p π+ p H FM ( Bandedges of H FM ( are related to the bandedges of F( as follows: lπ p lπ p p =, s =, Example Specifications for a lowpass filter: p =. 4π, s =. 4π, δ p =., and =. δ s 5 ( F) ( F) π π s π p 6

7 For designing H FM ( the optimum value of is in the range By calculating the total number of multipliers needed to realize F(, I (, and I ( for all possible values of, we arrive at the realization requiring the least number of multipliers obtained for =6 is 9 which is about 5% of that required in a direct single-stage realization 8 The gain response of the designed filter is shown below: 4 _ 6 _ 8..4.6.8