Module-16: (FIR) Digital Filters

Objectives:

• To understand the concept of linear phase • To know the method of identifying the linear phase filter from its impulse response • To know the ways of identifying various types of linear phase filters • To understand the characteristics of FIR digital filters • To understand the frequency response of FIR filters • To differentiate between FIR and IIR filters based on various Characteristics

Introduction:

❖ Linear Time Invariant systems can be classified according to whether the unit sample response sequence is of finite duration or is of infinite duration i.e. whether or not it has only a finite number of non zero terms. ❖ If the unit sample response sequence of the LTI system is of finite duration, the system is referred to as Finite Impulse Response system. ❖ The system with unit sample response ℎ(푛) = 푎푛푢(푛) is an example for IIR system and the system with unit sample response ℎ(푛) = 2 푓표푟 푛 = −1, 1 { 1 푓표푟 푛 = 0 } is an example for FIR system. 0 표푡ℎ푒푟푤푖푠푒 ∞ ❖ The response 푦(푛) for an input of 푥(푛) has the form 푦(푛) = ∑푘=−∞ 푥(푛 − 푘)ℎ(푘) = 푥(푛 + 1)ℎ(−1) + 푥(푛)ℎ(0) + 푥(푛 − 1)ℎ(1) = 2푥(푛 + 1) + 푥(푛) + 2푥(푛 − 1) This is the difference equation or recurrence relation expressing 푦(푛) in terms of the input only. It does not depend on other output values. ❖ A discrete LTI system can be described by the Nth order linear constant coefficient difference equation as 푁 푀 ∑푘=0 푎푘 푦(푛 − 푘) = ∑푚=0 푏푚 푥(푛 − 푚) ----(1) 1 푁 푀 ❖ From the above eqn., 푦(푛) = [− ∑푘=1 푎푘 푦(푛 − 푘) + ∑푚=0 푏푚 푥(푛 − 푎0 푚)] ---(2)

❖ If some 푎푘, 1 ≤ 푘 ≤ 푁 푖푠 푛표푛 푧푒푟표, the system represented by above eqn. Is an IIR system.

❖ If some 푎푘 = 0, 1 ≤ 푘 ≤ 푁, the above eqn. becomes 푦(푛) = 푀 푏푚 ∑푚=0 푥(푛 − 푚) --(3) 푎0 ∞ ❖ Comparing this eqn. with 푦(푛) = ∑푚=−∞ ℎ(푚)푥(푛 − 푚), 푏 푚 푓표푟 푚 = 0,1, … 푀 ℎ(푚) = [ 푎0 ] which is an FIR system ---(4) 0 표푡ℎ푒푟푤푖푠푒 ❖ A discrete LTI is stable if and only if its unit sample response is absolutely summable i.e. ∞ ∑푘=−∞|ℎ(푘)| < ∞ ---(5)

❖ An FIR system described by eqn.(1) when 푎푘 = 0, 푘 = 1,2, … , 푁 is always stable since there are only a finite number of non zero samples h(n) and the series in eqn.(5) always converges. ❖ For any system to be physically realizable, it should be causal. ❖ A LTI system can be checked for causality by using the condition ℎ(푛) = 0 푓표푟 푛 < 0 , where h(n) is the unit sample response of the system. ❖ In the case of an FIR filter, even though h(n) is non causal, it can be sufficiently delayed to obtain a causal sequence( because of its finite length) representing a realizable filter. Thus, a realizable filter can always be obtained for an FIR filter. concept of Linear Phase:

➢ An ideal filter shows perfect transmission in the pass band and perfect ejection in the stop band ➢ Perfect transmission implies a transfer function with constant gain and linear phase over the pass band. ➢ The corresponding transfer Function can be given as 퐻(푓) = 퐾. 푒−푗푛휔, over the pass band, where 휔 = 2휋푓 ➢ The gain of a filter is given by |퐻(푓)| ➢ Constant gain 퐾 ensures that the output is an amplitude scaled replica of the input. ➢ If the gain is not constant over the required frequency range, it results in amplitude distortion ➢ The phase response of the filter is 휑(휔) = −휔푛. Linear phase ensures that the output is a time shifted replica of the input. ➢ If the phase shift is not linear with frequency, it results in Phase distortion, as the signal undergoes different delays for different frequencies. ➢ The DC gain of the filter will be at 푓 = 0 표푟 휔 = 0 and the high frequency gain is at 푓 = 0.5 표푟 휔 = 휋 . ➢ Computation of DC gain: ▪ 퐻(푧)푎푡 푧 = 1 ▪ 퐻(휔)푎푡 푓 = 0 표푟 휔 = 0 ▪ 퐻(0) = ∑ ℎ(푛) ▪ Ratio of sum of the RHS coefficients to that of LHS coefficients of the difference equation, where RHS refers to excitation and LHS refers to the response ➢ Computation of High Frequency gain: ▪ 퐻(푧)푎푡 푧 = −1 ▪ 퐻(휔) 푎푡 푓 = 0.5 표푟 휔 = 휋 푛 ▪ 퐻(휔)|휔=0.5 = ∑(−1) ℎ(푛) ▪ 푅푒푣푒푟푠푒 푡ℎ푒 푠푖푔푛 표푓 푎푙푡푒푟푛푎푡푒 푐표푒푓푓푖푐푖푒푛푡푠 표푓 푅퐻푆 푎푛푑 퐿퐻푆 표푓 푡ℎ푒 푑푖푓푓푒푟푒푛푐푒 푒푞푢푎푡푖표푛 푎푛푑 푡푎푘푒 푡ℎ푒 푟푎푡푖표 표푓 푡ℎ푒푖푟 푠푢푚

➢ Phase delay of a sinusoid 푥(푡) = 퐴. cos(휔0푡 + 휃) = 퐴. cos [휔0(푡 − 푡푝)] is the quantity 휃 푡푝 = − and describes the time delay in the signal caused by a phase shift 휔0 of ‘휃′ 1 퐻(푓0) ➢ Phase delay of a is defined as 푡푝(푓0) = − . 2휋 푓0

➢ Ex. 푐표푛푠푖푑푒푟 푦(푛) = 푥(푛) + 푥(푛 − 1) 휔 푗휔 . 푇ℎ푒 푐표푟푟푒푠푝표푛푑푖푛푔 퐻(휔) = 4퐶표푠2 ( ) . 푒− ⁄2. 2 푇ℎ푢푠, 푡ℎ푒 푝ℎ푎푠푒 푟푒푠푝표푛푠푒 푖푠휃(휔) = 휔 휃(휔) 1 − . 푇ℎ푒 푐표푟푟푒푠푝표푛푑푖푛푔 푝ℎ푎푠푒 푑푒푙푎푦 푖푠 = . This system exhibits 2 휔 2 half a sample of time delay at each frequency.

1 푑퐻(푓) ➢ The Group delay of a digital filter is defined as푡 (푓) = − . 푔 2휋 푑푓

➢ The group delay may be interpreted as the time delay of the amplitude of a sinusoid at frequency 휔 ➢ It refers to the fact that it specifies the delay experienced by a narrow-band ``group'' of sinusoidal components which have frequencies within a narrow frequency interval about ➢ For linear phase responses, i.e.,휃(휔) = −훼휔 for some constant 훼, the group delay and the phase delay are identical, and each may be interpreted as time delay (equal to 훼 samples when 휔 ∈ (−휋, 휋) ➢ For the system 푦(푛) = 푥(푛) + 푥(푛 − 1), 푡ℎ푒 푝ℎ푎푠푒 푟푒푠푝표푛푠푒 푖푠휃(휔) = 휔 − . 2 ➢ Thus, both the phase delay and the group delay of the above system are equal to half a sample at every frequency. ➢ For a linear phase filter, both Group delay and phase delay are constant. ➢ If the phase response is nonlinear then the relative phases of the sinusoidal signal components are generally altered by the filter.

FIR filters and Linear Phase: ▪ The DTFT of a filter whose impulse response is symmetric about the origin is purely real or purely imaginary. ▪ The phase of such a filter is thus piecewise constant ▪ If the symmetric sequence is shifted (to make it causal), the phase is augmented by a linear phase term and becomes piecewise linear ▪ Generally, a filter whose impulse response is symmetric about its midpoint is termed as Linear Phase Filter. ▪ Linearity in phase results in a pure time delay with no amplitude distortion. ▪ An FIR filter with an impulse response symmetric about the midpoint will have linear phase and provides constant delay. ▪ For the sequence h(n) to be of finite length, the poles must lie at the origin. ▪ Sequences that are symmetric about the origin also require ℎ(푛) = ±ℎ(푛) 1 , which implies 퐻(푧) = ±퐻( ) 푧 ▪ The zeros of a linear phase sequence must occur in reciprocal pairs(conjugate pairs if complex to ensure real coefficients)

Classification of Linear Phase Sequences ➢ The length N of finite symmetric sequences can be odd or even, since the center of symmetry may fall on a sample point (for odd N) or midway between samples (for even N). This results in four possible types of symmetric sequences

Type-1 Sequence: • It has even symmetry and Odd length N and the centre of symmetry being 푁−1 the integer value = . 2

푁−1 −푗휔( ) • It’s frequency response may be expressed as 퐻(푓) = 퐻1(푓). 푒 2 , where 푁−3 ( ) 2 푁 − 1 푁 − 1 퐻 (푓) = ℎ ( ) + 2 ∑ ℎ(푛). cos (n − ) 휔 1 2 2 푛=0

푁−1 푁−1 • It has a linear phase of – 휔( ) and a constant group delay of . 2 2

• The amplitude spectrum is even symmetric about both f = 0 and f = 1 when the spectrum is studied over = (−2휋 ,2휋) . |퐻1(0)|푎푛푑|퐻1(1)| can be non zero . • The amplitude spectrum is even symmetric about both f=0 and f=0.5, when the spectrum is studied over = (−휋 ,휋) . |퐻1(0)|푎푛푑|퐻1(0.5)| can be non zero

**It is sufficient to study over (ퟎ, ퟐ흅) 풐풓 (−흅, 흅)

Type-2 Sequence • It has even symmetry and even length N and the centre of symmetry being 푁−1 the half integer value = 2

푁−1 −푗휔( ) • It’s frequency response may be expressed as 퐻(푓) = 퐻1(푓). 푒 2 , where 푁 ( −1) 2 푁 − 1 퐻 (푓) = 2 ∑ ℎ(푛). cos (n − ) 휔 1 2 푛=0

푁−1 푁−1 • It has a linear phase of – 휔( ) and a constant group delay of . 2 2

• The amplitude spectrum has even symmetry about f = 0 and odd symmetry about f = 1 when the spectrum is studied over 휔 = (−2휋 ,2휋).As a result, |퐻1(1)| is always zero . • The amplitude spectrum is even symmetric about both f=0 and f=0.5, when the spectrum is studied over = (−휋 ,휋).|퐻1(0.5)| is always zero

Type-3 Sequence • It has odd symmetry and odd length N and the centre of symmetry being 푁−1 the integer value = 2

푁−1 휋 −푗휔( ) 푗 • It’s frequency response may be expressed as 퐻(푓) = 퐻1(푓). 푒 2 푒 2 , where 푁−3 ( ) 2 푁 − 1 퐻 (푓) = 2 ∑ ℎ(푛). sin ( − 푛) 휔 1 2 푛=0

휋 푁−1 푁−1 • It has a linear phase of – 휔( ) and a constant group delay of . 2 2 2

• The amplitude spectrum has odd symmetry both about f = 0 and f = 1 when the spectrum is studied over 휔 = (−2휋 ,2휋).As a result, |퐻1(0)| 푎푛푑 |퐻1(1)| are always zero .

Type-4 Sequence • It has odd symmetry and even length N and the centre of symmetry being 푁−1 the half integer value = 2

푁−1 휋 −푗휔( ) 푗 • It’s frequency response may be expressed as 퐻(푓) = 퐻1(푓). 푒 2 푒 2 , where 푁 ( −1) 2 푁 − 1 퐻 (푓) = 2 ∑ ℎ(푛). sin ( − 푛) 휔 1 2 푛=0

휋 푁−1 푁−1 • It has a linear phase of – 휔( ) and a constant group delay of . 2 2 2

• The amplitude spectrum has odd symmetry about f = 0 and even symmetry about f = 1 when the spectrum is studied over 휔 = (−2휋 ,2휋).As a result, |퐻1(0)| is always zero .

Poles and Zeros of Linear Phase sequences:

✓ The poles of any finite-length sequence must lie at z = 0. ✓ The zeros of linear phase sequence must occur in conjugate reciprocal pairs. ✓ Real zeros at z = 1 or z = −1 need not be paired (they form their own reciprocals) ✓ All other real zeros must be paired with their reciprocals. ✓ Complex zeros on the unit circle must be paired with their conjugates (that also form their reciprocals), ✓ Complex zeros anywhere else must occur in conjugate reciprocal quadruples. Identifying the type of linear phase sequence: ➢ To identify the type of sequence from its pole-zero plot, check for the presence of zeros at z = ±1 and count their number. ➢ Type 1: Even number of zeros at z= -1( if present) and at z=1( if present) ➢ Type 2: Odd number of zeros at z= -1(and even number of zeros at z=1, if present) ➢ Type 3: Odd number of zeros at z =1 and odd number of zeros at z= -1 ➢ Type 4: Odd number of zeros at z = 1( and even number of zeros at z= -1, if present)

Difference Equation representation of FIR filters:

• An FIR system is generally represented by a Non recursive difference equation such as

푦(푛) = 퐵0. 푥(푛) + 퐵1. 푥(푛 − 1) + − − − − 퐵푀푥(푛 − 푀) Since the output 푦(푛) depends only on the input 푥(푛) and its shifted versions, the response is simply a weighted sum of the input terms exactly as described by the system equation. • The terms FIR and Non recursive are synonymous. • A Non recursive filter always has a finite impulse response. • But, a Non recursive can be implemented in recursive form also Ex. ✓ Consider a non recursive filter 푦(푛) = 푥(푛) + 푥(푛 − 1) + 푥(푛 − 2). ✓ The unit sample response of this filter is ℎ(푛) = 훿(푛) + 훿(푛 − 1) + 훿(푛 − 2). ✓ To implement this in recursive form, compute 푦(푛 − 1) from the above system equation ✓ 푦(푛 − 1) = 푥(푛 − 1) + 푥(푛 − 2) + 푥(푛 − 3). ✓ Then, 푦(푛) − 푦(푛 − 1) = 푥(푛) − 푥(푛 − 3) is the recursive formulation for the given non recursive filter.

Characteristics of FIR filters: ➢ The impulse response h(n) has a finite length, i.e h(n) is non-zero only for a finite range of indices n. ➢ For a general 푁-length FIR system, h(n) ≠ 0only for 푁1 ≤ 푛 ≤ 푁2 = 푁1 + 푁 − 1 When 푁1 ≥ 0, the filter is also causal. ➢ The unit sample response sequence h(n) of length N, of a causal FIR system with piecewise linear phase characteristic satisfies ℎ(푛) = ±ℎ(푁 − 1 − 푛) ➢ The FIR frequency response 퐻(휔)is a finite-degree polynomial in ejωof the form −푛 퐻(휔) = ∑푁2 ℎ(푛). (푒푗휔) 푛=푁1 where 푁1 and 푁2are (negative or positive) integers corresponding to the indices of the first and last samples of h(n) respectively.

➢ Designing an FIR filter consists in finding the polynomial H(ω)that best approximates the design specifications. ➢ This is done by computing the “optimal” (relative to some criteria) impulse response samples {ℎ(푛)}푁2 which correspond to the unknown coefficients 푁1 of the polynomial 퐻(휔). ➢ The impulse response length 푁 is usually fixed, but it could also be considered as a free parameter to be optimized. . ➢ The filter transfer function, denoted by H(z) is the z-transform of h(n) and is useful for studying the stability of the system. ➢ For FIR filters, H(z) is a finite-degree polynomial in the complex variable z and is given by 푗휔 푁2 −푛 퐻(푧) = 퐻(푒 )| 푗휔 = ∑ ℎ(푛). (푧) 푒 =푧 푛=푁1

It follows that the function H(z) has no poles except possibly at 0 or1, i.e., it cannot be infinite for any point z with 0 < |z|< 1. It has only zeros (points z at H(z)=0). Therefore, an FIR filter is always stable.

➢ FIR filters allow the design of causal linear-phase systems which are very important and widely used in practice. In many signal processing applications, such as speech and image processing, it is desirable to pass some portion of the signal frequency band with minimal distortion. For that purpose, linear-phase systems are particularly desirable since the effect of the linear-phase is a pure time delay.

➢ Because the impulse response is of finite length, FIR filters are realized using the convolution operation which can be implemented directly in the time/space domain, or in terms of the FFT in the frequency domain.

➢ Since FIR filters have no feedback loops, they are relatively insensitive to round-off noise.

➢ Noise due to coefficient quantization can be a problem for very long filters, but can be mitigated by avoiding the direct-form structures, and using special structures such as the cascade form for implementation.

➢ FIR filters with very long impulse responses (푁 ≈ 500)might be required to meet certain design specifications, e.g., high accuracy and/or short transition bands. Longer filters lead to an increased complexity for both design and implementation. They require significant computing time to optimize all the parameters of h(n) and also many operations per second in the actual filter implementation.

Frequency Response The frequency response of an LTI system is defined as 퐻(푒푗휔) = ∞ −푗휔푘 ∑푘=−∞ ℎ(푘)푒 , where ℎ(푘) is its unit sample response. The output 푦(푛) of an LTI system is given by the convolution of its unit sample response ℎ(푛) and the input 푥(푛).

∞ 푦(푛) = ∑푘=−∞ ℎ(푘)푥(푛 − 푘)€

푗휔푛 ∞ ∞ 푗휔(푛−푘) Let 푥(푛) = 푒 . Then 푦(푛) = ∑푘=−∞ ℎ(푘)푥(푛 − 푘) = ∑푘=−∞ ℎ(푘)푒 = 푗휔푛 ∞ −푗휔푘 푒 ∑푘=−∞ ℎ(푘)푒

This can be written as 푦(푛) = 푥(푛). 퐻(푒푗휔). Thus, the output sequence 푦(푛)is the product of the input sequence and the frequency response.

The Magnitude of 퐻(푒푗휔) multiplies the input magnitude and the argument or phase of 퐻(푒푗휔) changes the phase of the complex exponential input.

Thus, for an input of 푥(푛) = 퐴 푐표푠(휔0푛 + 휃), the response of LTI system with 푗휔0 푗휔0 unit sample response ℎ(푛) is 푦(푛) = 퐴| 퐻(푒 )|cos [휔0푛 + 휃 + 푎푟푔퐻(푒 )].

Thus, the output to a sinusoid is another sinusoid of same frequency but with different phase and magnitude.

Correspondingly, if a dc signal of magnitude A is applied to the system, the dc output is A times 퐻(푒푗0), which is the dc gain of the system and is the value of the frequency response at 휔 = 0

Properties of Frequency Response:

1. 퐻(푒푗휔) takes on values for all values of 휔 2. 퐻(푒푗휔) is periodic in 휔 with period 2휔 3. |퐻(푒푗휔)| is an even function of 휔 and symmetrical about 휋 4. 푎푟푔퐻(푒푗휔) is an odd function of 휔 and anti-symmetrical about 휋

Worked out Examples:

1.Does 퐻(푧) = 1 − 푧−4 describe a linear phase filter?

Soln.:

푧4 − 1 퐻(푧) = 푧4 • All the poles are at origin requirement of a Finite duration sequence • Zeros are z=1 requirement of a linear phase sequence: real zeros at z=1 can individually occur and need not be paired as it forms its own reciprocal and complex conjugate 1 • Since 퐻(푧) ≠ ±퐻( ), the corresponding unit sample response can not be 푧 symmetric about n=0, but should be symmetric about its mid point. • This can be concluded by finding its unit sample response which is equal to ℎ(푛) = {1,0,0,0,1}푓표푟 푛 = {0,1,2,3,4}. 푁−1 • It can be verified that h(n) is symmetric about 푛 = = 2, 푤ℎ푒푟푒 푁 = 5. 2 • Thus, the given system H(z) represents a linear phase system whose unit sample response h(n) possesses even symmetry about its mid point n=2.

2.Sketch the pole-zero plot for 퐻(푧) = 2푧2 + 3푧 + 3푧−1 + 2푧−2. Is this a linear phase filter? Soln.:

• Zeros are 푧 = −1.7931 + 0.0000푖 (푟푒푎푙 푧푒푟표) • 푧 = 0.4254 + 0.9050푖 (푐표푚푝푙푒푥 푧푒푟표) • 푧 = 0.4254 − 0.9050푖

(푐표푚푝푙푒푥 푧푒푟표 푤ℎ푖푐ℎ 푖푠 푡ℎ푒 푐표푛푗푢푔푎푡푒 표푓 푡ℎ푒 푎푏표푣푒 푐표푚푝푙푒푥 푧푒푟표)

• −0.5577 + 0.0000푖 (푟푒푎푙 푧푒푟표 푤ℎ푖푐ℎ 푖푠 푡ℎ푒 푟푒푐푖푝푟표푐푎푙 표푓 푡ℎ푒 푎푏표푣푒 푟푒푎푙 푧푒푟표) • Poles are 푧 = 0( 2푛푑 표푟푑푒푟 푝표푙푒) 1 • It can be observed that 퐻(푧) = 퐻( ). This means that ℎ(푛) = ℎ(−푛), 푧 where ℎ(푛) = {2,3,0,3,2}푓표푟 푛 = {−2, −1,0,1,2}, the centre of symmetry being n=0. • This describes a linear phase filter. • All the poles are at origin Requirement of a finite duration sequence • Zeros on unit circle occurred in conjugate pairs Characteristic of a linear phase filter • Real zeros are reciprocal of each other Characteristic of a linear phase filter

3.An FIR filter is described by the difference eqn. 푦(푛) = 푥(푛) + 푥(푛 − 10). (i) Compute and plot the Magnitude and phase response of the system (i) Find the response of the above system for an input of 푥(푛) = 10 + 2휋 휋 5 cos ( 푛 + ) 5 2 Soln.: (i) The unit sample response of the above system is ℎ(푛) = 훿(푛) + 훿(푛 − 10). 푗휔 ∞ −푗휔푛 The frequency response of the system is 퐻(푒 ) = ∑푛=0 ℎ(푛) 푒 = 1 + 푒−푗10휔 = 푒−푗5휔(푒푗5휔 + 푒−푗5휔) = 2 cos(5휔) . 푒−푗5휔 The corresponding Magnitude and Phase Responses are

(ii) The input x(n) consists of one term with zero frequency(휔1 = 0), and one 2휋 term with a frequency of 휔 = . 2 5 The response of the system is 푦(푛) = 푗휔 ( ) 퐻(푒 )|휔=휔1. 푐표푚푝표푛푒푛푡 표푓 푥 푛 푤푖푡ℎ 푓푟푒푞푢푒푛푐푦 휔1 푗휔 ( ) + 퐻(푒 )|휔=휔2. 푐표푚푝표푛푒푛푡 표푓 푥 푛 푤푖푡ℎ 휔2 푗휔 ( ) −푗5휔 퐻(푒 )|휔=휔1 = 2 cos 5휔 . 푒 |휔=0 = 2

푗휔 −푗5휔 퐻 푒 | = 2 cos(5휔) . 푒 | 2휋 = 2 ( ) 휔=휔2 휔= 5 2휋 휋 2휋 휋 푦(푛) = 2푥10 + 2푥5 cos ( 푛 + ) = 20 + 10 cos ( 푛 + ) 5 2 5 2 4.Determine the magnitude and phase response of the Multipath channel 푦(푛) = 푥(푛) + 푥(푛 − 푀) and find the frequency at which the frequency response of the above channel is zero.

Soln.: The unit sample response of the given system is ℎ(푛) = 훿(푛) + 훿(푛 − 푀) and 푗휔 ∞ −푗휔푛 the corresponding frequency response is 퐻(푒 ) = ∑푛=0 ℎ(푛) 푒 = 1 + 푒−푗푀휔

For 퐻(푒푗휔) 푡표 푏푒 푧푒푟표, 푒−푗푀휔 = −1 푀휔 = (2푘 + 1)휋푓표푟 푘 = 0, 1 2, − − −

휋 The frequency for which the frequency response is zero is 휔 = (2푘 + 1) 푀 5.The relation between the input and output of an FIR system is as follows:

푁 푦(푛) = ∑푘=0 푏(푘). 푥(푛 − 푘) Find the coefficients 푏(푘) of the smallest order filter that satisfied the following conditions:

✓ The filter has (generalized linear phase)

✓ It completely rejects a sinusoid of frequency 휔0 = 휋/3 ✓ The magnitude of the frequency response is equal to 1 at 휔 = 0 푎푛푑 휔 = 휋

Soln.:

To reject a sinusoid of frequency 휔0 = 휋/3, the system function should have a ±푗휋 pair of zeros on the unit circle at 푧 = 푒 3 . Therefore, the system function H(z) should contain a factor of the form

푗휋 −푗휋 휋 퐻 (푧) = (1 − 푒 3 . 푧−1)( (1 − 푒 3 . 푧−1) = 1 − 2 cos ( ) 푧−1 + 푧−2 = 1 − 1 3 푧−1 + 푧−2.

If 퐻(푧) = 퐴(1 − 푧−1 + 푧−2), the magnitude of the frequency response at 휔 = 푗휔 푗휔 0 is 퐻(푒 )|휔=0 = 퐴 and at 휔 = 휋 is 퐻(푒 )|휔=휋 = 3퐴.

A single value of A can not satisfy both the constraints as required.

So, a second linear phase term is to be added to 퐻(푧). To minimize the order of the filter, a similar term is considered which can be (1 − 퐵푧−1 + 푧−2) as one of the options

Thus, 퐻(푧) = 퐴(1 − 푧−1 + 푧−2)(1 + 퐵푧−1 + 푧−2).

푗휔 퐻(푒 )|휔=0 = 퐴(2 + 퐵) = 1

푗휔 퐻(푒 )|휔=휋 = 3퐴(2 − 퐵) = 1

1 Solving for A and B results in 퐴 = 푎푛푑 퐵 = 1 3

1 Hence, 퐻(푧) = (1 + 푧−2 + 푧−4) 3 6. An FIR has a unit sample response with ℎ(푛) = 0 푓표푟 푛 < 휋 푗 0 푎푛푑 푁 > 7. 퐼푓 ℎ(0) = 1 and the system function has a zero at 푧 = 0.4푒 3 and a zero at z=3, find H(z).

Soln.:

Since ℎ(푛) = 0 푓표푟 푛 < 0 푎푛푑 푁 > 7, it is non zero from n=0 to n=7.

The corresponding H(z) consists of a constant and 7 terms involving the –ve powers of z, and corresponds to 7 zeros at z=0.

휋 푗 Since the filter is of linear phase, the zero at 푧 = 0.4푒 3 should have its conjugate 휋 −푗 also i.e. 0.4푒 3 .

Hence, H(z) should consists of the terms

휋 휋 푗 −푗 (1 − 0.4푒 3 푧−1)( 1 − 0.4푒 3 푧−1)= 1 − 0.4푧−1 + 0.16푧−2

Since the zeros should have the reciprocals also, H(z) should contain 휋 휋 −푗 푗 2.5푒 3 푎푛푑 2.5푒 3 as zeros and consists of the terms

휋 휋 푗 −푗 (1 − 2.5푒 3 푧−1)( 1 − 2.5푒 3 푧−1)= 1 − 2.5푧−1 + 6.25푧−2 Since, there is a zero at Z=3, there should be a zero reciprocal location also i.e. z=1/3.

1 Hence, the additional terms in H(z) are (1 − 3푧−1) (1 − 푧−1). 3 Thus, 퐻(푧) = 1 (1 − 0.4푧−1 + 0.16푧−2)(1 − 2.5푧−1 + 6.25푧−2)(1 − 3푧−1) (1 − 푧−1) 3 Excercise Problems:

푛휋 1.Verify that the system 푦(푛) = 푥(푛) − 푥(푛 − 4) attenuates the signal 푐표푠( ) 4 to zero level

2.Is the filter 푦(푛) = 푥(푛) − 푥(푛 − 1) + 푥(푛 − 2) a linear phase filter? verify

3. The system function of an FIR filter is 퐻(푧) = (1 + 0.2푧−1 + 0.8푧−2)2 . Find another linear phase system that has a frequency response with the same magnitude

Simulation:

1.Find the frequency response of the discrete FIR system with transfer function 퐻(푧) = 0.5 − 0.5푧−1 syms j w z e H=0.5-0.5*z^-1; H=subs(H,z,e^(j*w)); disp('The frequency response of the given system is H=') disp(H) clear all n=input('enter the number of frequency points over which the response is to be plotted') w=0:2*pi/n:2*pi; h1=zeros(1,length(w)); for k=1:length(h1) h1(k)=0.5-0.5*exp(-i*w(k)); end Magh1=abs(h1); phaseh1=angle(h1); subplot(2,1,1) plot(w/pi,Magh1) title('Magnitude Response of H(z)=0.5-0.5*z^-1 with n=100') xlabel('frequency normalized with respect to pi') ylabel('Magnitude') grid subplot(2,1,2) plot(w/pi,phaseh1/pi) title('phase Response of H(z)=0.5-0.5*z^-1 with n=100') xlabel('frequency normalized with respect to pi') ylabel('phase in pi units') grid

Using Inbuilt Function n=input('enter the number of frequency points over which the response is to be plotted') a=input('enter the numerator coefficients as a vector starting from constant') b=input('enter the denominator coefficients as a vector starting from constant') [H w]=freqz(a,b,n,'whole'); magH=abs(H); phaH=angle(H); subplot(2,1,1) plot(w/pi,magH,'k') title('Magnitude Response of H(z)=0.5-0.5*z^-1 with n=100') xlabel('frequency normalized with respect to pi') ylabel('Magnitude') grid subplot(2,1,2) plot(w/pi,phaH/pi,'k') title('phase Response of H(z)=0.5-0.5*z^-1 with n=100') xlabel('frequency normalized with respect to pi') ylabel('phase in pi units') grid enter the number of frequency points over which the response is to be plotted 100 n=100 enter the numerator coefficients as a vector starting from constant[0.5 -0.5] a = [ 0.5000 -0.5000] enter the numerator coefficients as a vector starting from constant 1 b =1

2. Find and plot the frequency response of the discrete FIR system represented by the difference equation 푦(푛) = 푥(푛) − 0.5푥(푛 − 2) syms e j w n1=input('enter the time indices of the excitation') n2=input('enter the time indices of the response') a=input('enter the coefficients of input starting from x(n)') b=input('enter the coefficients of output starting from y(n)') for i=1:length(a) X(i)=a(i)*(1/(e^(j*w*n1(i)))); end X=sum(X); for i=1:length(b) Y(i)=b(i)*(1/(e^(j*w*n2(i)))); end Y=sum(Y); disp('Frequency response of the system is') disp(X/Y) n=input('enter the number of frequency points over which the response is to be plotted') [H w]=freqz(a,b,n); magH=abs(H); phaH=angle(H); subplot(2,1,1) plot(w/pi,magH) title('Magnitude Response of the system represented by y(n)=x(n)-0.5x(n-2)') xlabel('frequency normalized with respect to pi') ylabel('Magnitude') grid subplot(2,1,2) plot(w/pi,phaH/pi) title('phase Response of the system represented by y(n)= x(n)-0.5x(n-2)') xlabel('frequency normalized with respect to pi') ylabel('phase in pi units') grid