Chapter IIR Filters 8 In this chapter we finally study the general infinite impulse response (IIR) difference equation that was mentioned back in Chapter 5. The filters will now include both feedback and feedforward terms. The system function will be a rational function where in general both the zeros and the poles are at nonzero locations in the z-plane. The General IIR Difference Equation The general IIR difference equation described in Chapter 5 was of the form N a l yn l b k xn k l k In this chapter the text rearranges this equation so that on the left and all of the other terms are on the right N yn a l yn l+ b k xn k l In so doing notice the sign change of the and also we assume that a M k (8.) yn is (8.) coefficients, The total coefficient count is N+ M +, meaning that this many multiplies are needed to compute each new output from the difference equation M a l ECE 6 Signal and Systems 8
Block Diagram As a special case consider 3 N M 3 yn a l yn l + b k xn k l 3 k Time-Domain Response xn yn z b z xn yn z b a z xn yn z b a z xn 3 yn 3 Feed-forward part b 3 a 3 Feedback part Direct Form I Structure The above logically extends to any order This structure is known as Direct-Form I Time-Domain Response To get started with IIR time-domain analysis we will consider a first-order filter ( N ) with M ECE 6 Signals and Systems 8
Time-Domain Response yn a yn + b xn (8.3) Impulse Response of a First-Order IIR System The impulse response can be obtained by setting xn n and insuring that the system is initially at rest Definition: Initial rest conditions for an IIR filter means that: () The input is zero prior to the start time, that is xn for n n () The output is zero prior to the start time, that is yn for n n We now proceed to find the impulse response of (8.3) via direct recursion of the difference equation y a y + b b y a y + b a b y a y + b a b yn n a b n In summary we have shown that the impulse response of a st-order IIR filter is n hn b a n un (8.4) where the unit step un has been utilized to make it clear that the output is zero for n ECE 6 Signals and Systems 8 3
Time-Domain Response Example: First-Order IIR with The impulse response is b a.8 hn.8 n un hn.8.6.4 FirstOrder IIR a.8, b. 5 5 n Linearity and Time Invariance of IIR Filters Recall that in Chapter 5 the definitions of time invariance and linearity were introduced and shown to hold for FIR filters It can be shown that the general IIR difference equation also exhibits linearity and time invariance Using linearity and time invariance we can find the output of the first-order system to a linear combination of time shifted impulses xn N k N xk n k (8.5) From the impulse response of (8.4) ECE 6 Signals and Systems 8 4
Time-Domain Response yn N k N N k N xk hn k xk b a n k un k (8.6) Example: xn n n 4, a.5 and b Using the above result, it follows that yn.5 n un.5 n 4 un 4 Plotting this function results in yn.5.5.5 5 5 n Linearity and time-invariance can also be used to find the impulse response of related IIR filters, e.g., yn a yn + b xn + b xn (8.7) We can view this as the superposition of an undelayed and delayed input to the filter yn a yn + xn (8.8) ECE 6 Signals and Systems 8 5
Time-Domain Response Based on this observation, the impulse response is hn b a n un + b a n un b n + b + b a a n un (8.9) Step Response of a First-Order Recursive System The step response allows us to see how a filter (system) responds to an infinitely long input We now consider the step response of yn a yn + b xn Via direct recursion of the difference equation y a y + b u b y a y + b u a b + b y a y + b u a a b + b + b n k yn b + a + + a b a k The summary form indicates a finite geometric series, which has solution n L k r k r L + --------------------, r r L +, r (8.) ECE 6 Signals and Systems 8 6
Using (8.) and assuming that the first-order filter is Time-Domain Response, the step response of (8.) Three conditions for exist n +. When a the term a grows without bound as n becomes large, resulting in an unstable condition n +. When a the a term decays to zero as n, and we have a stable condition 3. When a we have the special case output of (8.) where the output is of the form grows without bound; with a the output alternates sign, hence we have a marginally stable condition Example: a.6 b and xn The step response of this filter is a n + a yn b --------------------- un a yn a b n +, which also un.6 n + ------------------------------u.6 n ECE 6 Signals and Systems 8 7
Time-Domain Response yn.5.5.5 5 5 n The step response can also be obtained by direct evaluation of the convolution sum yn For the problem at hand yn To evaluate this requires careful attention to details The product un k xn *hn k uk un k un *hn uk b a n k un k (8.4) (8.5) tells us how to set the sum limits n n n n uk k k ECE 6 Signals and Systems 8 8
System Function of an IIR Filter The result is n yn b a n k un k n b a n a k k b a n a n + ----------------------------------- a (8.6) a n + b ---------------------------- a which is the same result obtained by the direct recursion System Function of an IIR Filter From our study of the z-transform we know that convolution in the time (sequence)-domain corresponds to multiplication in the z-domain yn xn *hn Xz Hz z Yz For the case of IIR filters Hz will be a fully rational function, meaning in general both poles and zeros (more than at z ) Begin by z-transforming both sides of the general IIR difference equation using the delay property ECE 6 Signals and Systems 8 9
System Function of an IIR Filter Yz Form the ratio Hz N a l z l Yz + b k z k Xz l M k ZTyn l ZTxn k M Yz Xz b k z k ----------------------------- N a l z l l k Hz b + b z + + b M z M ----------------------------------------------------------- a z a N z N (8.7) (8.8) The coefficients of the numerator polynomial, denoted Bz, correspond to the feed-forward terms of the difference equation The coefficients of the denominator polynomial, denoted Az, for z l l correspond to the feedback terms of the difference equation We have used various MATLAB functions that take as input b and a coefficient vectors, e.g., filter(b,a,...), freqz(b,a,...), and zplane(b,a) In terms of the general IIR system we now identify those vectors as b b b b M a a a a N (8.9) ECE 6 Signals and Systems 8
System Function of an IIR Filter The General First-Order Case As a special case consider N M, then Hz b + b z ------------------------ a z (8.) Example: Impulse Response Using MATLAB Suppose that a.5, b 3, and b >> n :; >> x [ zeros(,)]; % impulse sequence input >> y filter([-3,],[ -.5],x); >> stem(n,y,'filled') >> axis([ -3..6]) >> grid >> ylabel('impulse Response h[n]') >> xlabel('time Index (n)').5 Impulse Response h[n].5.5.5 3 3 4 5 6 7 8 9 Time Index (n) ECE 6 Signals and Systems 8
System Function of an IIR Filter Example: y filter([ ],[ -.8],x) We wish to find the system function, impulse response, and difference equation that corresponds to the given filter() expression By inspection Hz + z -----------------------.8z The impulse response using page 8 5, eqns (8.7) (8.9) hn The difference equation is yn.8yn + xn + xn n + +.8.8 n un System Functions and Block-Diagram Structures We have already examined the Direct-Form I structure (p. 8 ) The Direct-Form I structure implements the feed-forward terms first followed by the feedback terms We can view this as a cascade of two systems, which due to linearity can also be written as Hz Bz ---------- Az ---------- Bz Az In the block diagram this is represented as (8.) ECE 6 Signals and Systems 8
System Function of an IIR Filter xn wn yn z z b wn a z z b wn a z z b wn 3 Az a 3 Combine common delay blocks b 3 Bz Shown for N M 3 xn wn yn z b a z b a z b a 3 Direct-Form II b 3 ECE 6 Signals and Systems 8 3
System Function of an IIR Filter The Direct-Form II structure uses fewer delay blocks than Direct-Form I The Transposed Structures A property of filter block diagrams is that When all of the arrows are reversed All branch points become summing nodes; all summing nodes become branch points The input and output are interchanged The system function is unchanged xn yn b z The MATLAB function filter() implements this block diagram b z a b z a b 3 a 3 Transposed Direct-Form II ECE 6 Signals and Systems 8 4
System Function of an IIR Filter Relation to the Impulse Response From Chapter 7 we know that the impulse response and system function are related via the z-transform For IIR systems more work is required to obtain the z-transform We have thus established the following z-transform relation- Consider yn ayn + xn, where we have learned that the impulse response is hn a n un From the definition of the z-transform, Hz a n z n az n n (8.) The sum of (8.) is an infinite geometric series which in general terms is S r n n Applying the sum formula to (8.) results in Hz az n ------------------ (8.3) n az z a The condition that z a tells us that the z-transform only exists for these values of z The z-plane region is known as the region of convergence n ---------- r r ECE 6 Signals and Systems 8 5
Poles and Zeros ship a n un ------------------ az We can use this result to find the z-transform of z hn b a n un + b a n un (8.4) (8.5) directly using just linearity and the delay property Hz b --------------------- a z + b z --------------------- a z b + b z ------------------------ a z We will learn later that we can work this operation in reverse, and when combined with partial fraction expansion, we will be able to find the inverse z-transform of almost any rational Hz Poles and Zeros Factoring the numerator denominator polynomials allows us to discover the poles and zeros of Hz For the case of a first-order system only algebra is needed Hz b + b z ------------------------ z b - a z z + b z + b b ------------------- b z z a ----------------------- z a ECE 6 Signals and Systems 8 6
Poles and Zeros The single pole and zero are p a and z b b z-plane b -------- b a Poles or Zeros at the Origin or Infinity For the general IIR filter/system the number of poles always equals the number of zeros For FIR systems we saw that all of the poles were at It is also possible to have poles or zeros at Example: Zero at Consider z Hz z -----------------------.8z z This system has a pole at z.8 and zero at z since lim Hz z z --------------- z.8 ECE 6 Signals and Systems 8 7
Poles and Zeros Example: Pole at Consider This system has a pole at z Hz +.5z ----------------------- z +.5 z z and a zero at z.5 Pole Locations and Stability We know that (8.6) We note that this system has a pole at z a and a zero at z The impulse response decays to zero so long as a, which is equivalent to requiring that the pole lies inside the unit circle System Stability: Causal LTI IIR systems, initially at rest, are stable if all of the poles of the system function lie inside the unit circle Example: hn a n un z ------------------ az Converting to positive powers of z Hz Hz 5z.995z Hz --------------------- z 5 Pole at z z.995.995 so stable ECE 6 Signals and Systems 8 8
Poles and Zeros Example: Second-order Suppose that Hz Hz +.z zz +. ------------------------------------------------ -------------------------------------.4z +.8z z.4z +.8 ------------------------------------------------------------------------------------------------- zz +. z.7 + j.4 z.7 j.4 In polar form the poles are p, so the poles are inside the unit circle and the system is stable We can check stability using zplane() to plot the poles and zeros for us >>> zplane([.],[ -.4.8]).9e j.68.8.6.4 Imaginary Part...4.6.8.5.5 Real Part ECE 6 Signals and Systems 8 9
Frequency Response of an IIR Filter Frequency Response of an IIR Filter From Chapter 7 we know that the frequency response is found by letting z e jˆ in the system function (provided the system is stable) Example: He jˆ Hz Hz +.z.4z +.8z Making the substitution He jˆ we have We can use freqz() to plot the magnitude and phase >> w -pi:(pi/5):pi; >> H freqz([.],[ -.4.8],w); z z e jˆ e jˆ +.e jˆ --------------------------------------------------------.4e jˆ +.8e jˆ (8.7) H(e jω ) 5 Bandpass Filter 3 3.68 H(e jω ) 3 3 hat(ω) ECE 6 Signals and Systems 8
Frequency Response of an IIR Filter This particular filter is a bandpass filter because it has a relative large magnitude response over a narrow band of frequencies and small response otherwise From the earlier pole-zero analysis, the peak gain is near the angle the poles make to the real axis,.68 Example: Here we have Hz.8z He jˆ --------------------------.8e jˆ Plotting using freqz() we have >> w -pi:(pi/5):pi; >> H freqz(,[ -.8],w); 6 H(e jω ) 4 Lowpass Filter 3 3 H(e jω ) 3 3 hat(ω) ECE 6 Signals and Systems 8
Frequency Response of an IIR Filter Example: Here we have Hz +.8z He jˆ -------------------------- +.8e jˆ Plotting using freqz() we have >> w -pi:(pi/5):pi; >> H freqz(,[.8],w); 6 H(e jω ) 4 Highpass Filter 3 3 H(e jω ) 3 3 hat(ω) Note that by just changing the sign of the coefficient filter changes from being lowpass to highpass A similar behavior was found for the first-order FIR filter a the ECE 6 Signals and Systems 8
The Inverse z-transform and Applications 3D Surface Plot of Hz Consider the second-order system Hz +.z ------------------------------------------------.4z +.8z A 3D surface plot of Hz can help clarify how the frequency response is obtained by evaluating Hz around the unit circle Unit circle conjugte poles Second-Order, Bandpass H(z) zeros at z and z -. 3 Im Re The Inverse z-transform and Applications Finding the impulse response of a first-order IIR system was not too difficult using difference equation recursion, but for system order N, this process becomes too difficult ECE 6 Signals and Systems 8 3
The Inverse z-transform and Applications We need an inverse z-transform approach that will allow us to work from any rational system function, Hz, backwards to hn Useful z-transform properties and pairs available to help this cause are listed below z-transform Relations. ax n xn z Xz + bx n z ax z + bx z. 3. 4. n z 5. yn xn n z z n Xz xn *hn z Yz n n z z n Hz Xz 6. a n un z ------------------ az A General Procedure for Inverse z-transformation The technique we develop here uses an algebraic decomposition known as partial fraction expansion The function we wish to inverse transform, Hz, is assumed for now to be proper rational, meaning that M N ECE 6 Signals and Systems 8 4
The Inverse z-transform and Applications Step : Factor the denominator polynomial into pole factors of the form p k z for k N Step : Create a partial fraction expansion of Hz --------------------- p k z k where A k Hz p k z z pk Step 3: The inverse z-transform via relation #6 is hn The limitation of this approach is that the N N k Hz via are distinct In general there may be repeated poles, in which case the partial fraction expansion takes a slightly different form from step Hence, at present we will only consider non-repeated poles A k A k p k n un p k Example: M N Hz First we factor the denominator p + z ------------------------------------ 3 --z 4 + --z 8 3 4 9 6 --------------------------------------------------- 3 -- -- 8 8 ECE 6 Signals and Systems 8 5
The Inverse z-transform and Applications Hz + z -------------------------------------------------- --z --z 4 A ------------------- --z A + ------------------- --z 4 Solving for Solving for So, A + z A -------------------------------------------------- --z --z 4 + z ------------------- --z 4 A z --z ----------- + 4 -- + z A -------------------------------------------------- --z --z 4 + z ------------------- --z Hz z 4 ------------------- --z --z 4 ----------- + 8 9 ------------------- 9 --z 4 Inverse z-transform term-by-term using #6 z z 4 ECE 6 Signals and Systems 8 6
The Inverse z-transform and Applications hn -- n un 9 4 -- n un The MATLAB signal processing toolbox has a function that can perform partial fraction expansion >> help residuez RESIDUEZ Z-transform partial-fraction expansion. [R,P,K] RESIDUEZ(B,A) finds the residues, poles and direct terms of the partial-fraction expansion of B(z)/A(z), B(z) r() r(n) ---- ------------ +... ------------ + k() + k()z^(-)... A(z) -p()z^(-) -p(n)z^(-) B and A are the numerator and denominator polynomial coefficients, respectively, in ascending powers of z^(-). R and P are column vectors containing the residues and poles, respectively. K contains the direct terms in a row vector. The number of poles is n length(a)- length(r) length(p) The direct term coefficient vector is empty if length(b) < length(a); otherwise, length(k) length(b)-length(a)+ If P(j)... P(j+m-) is a pole of multiplicity m, then the expansion includes terms of the form R(j) R(j+) R(j+m-) -------------- + ------------------ +... + ------------------ - P(j)z^(-) ( - P(j)z^(-))^ ( - P(j)z^(-))^m [B,A] RESIDUEZ(R,P,K) converts the partial-fraction expansion back to B/A form. Using residuez() we find: >> [A,p,K] residuez([ ],[ -3/4 /8]) A % The partial fraction coefficients -9 % agree p 5.e- % The pole factoring agrees.5e- % K [] % Results from long division % to make proper rational (NA here). ECE 6 Signals and Systems 8 7
The Inverse z-transform and Applications As a further check we can plot hn directly and compare it to the results obtained by direct evaluation of the difference equation via filter() n :; x [ zeros(,)]; y filter([ ],[ -3/4 /8],x); h *(/).^n -9*(/4).^n; subplot() stem(n,y,'filled') grid subplot() stem(n,h,'filled') grid 3 Compare h[n] via Simulation & Analysis h[n] via simulation h[n] via analysis 4 6 8 4 6 8 They agree! 3 4 6 8 4 6 8 Time Index (n) ECE 6 Signals and Systems 8 8
The Inverse z-transform and Applications Example: yn Find yn for an IIR system having input xn un and system function We will first find xn *hn From table entry #6 with As a result of table entry #3 Yz We now use a partial fraction expansion over the three real poles, -/3, and / Solving for the coefficients Hz Yz Xz Xz Hz Yz + z ------------------------------------ --z 6 a --z 6 ECE 6 Signals and Systems 8 9 --------------- z + z --------------------------------------------------------------- z --z --z 6 6 + z ------------------------------------------------------------------------ z + --z --z 3 A --------------- z A A 3 + ------------------- + ------------------- + --z --z 3
The Inverse z-transform and Applications Finally, A + z -------------------------------------------------- + + --z --z 4 -- -- 3 3 z and using #6 to inverse transform term-by-term We can check this result using residuez() >> [A,p,K] residuez([ ],conv([ -],[ -/6 -/6])) A 6.e+ < agrees with A 6-3.6e+ < agrees with A3-8/5-4.e- < agrees with A -/5 ----------- 6 + z 6 A ---------------------------------------------- ----------- z --z 4 5 -- z 3 + z A 3 ---------------------------------------------- ------------- + 4 z + --z 5 -- 3 3 yn Yz --------------- 6 z 6un z ------------------- 5 + --z 3 -- -- n un 5 3 ------------------- 8 5 --z 8 ----- 5 -- n un -- 5 ----- 8 5 ECE 6 Signals and Systems 8 3
The Inverse z-transform and Applications p.e+ 5.e- -3.3333e- K [] The results agree! The partial fraction expansion technique requires that M N If the rational function does not satisfy this condition we can perform long division to reduce the order of the denominator to the point where M N Example: Long Division Consider where Yz N M Perform long division We now have reduced.4z.4z --------------------------------------------.3z.4z (not proper rational).3z.4z.4z.4z.3z.4z.z Yz Yz to the form.z + --------------------------------------------.3z.4z ECE 6 Signals and Systems 8 3
The Inverse z-transform and Applications We can now perform a partial fraction expansion on the rational function Yz The coefficients are Finally, and.z --------------------------------------------.3z.4z A ----------------------- +.5z We can again check this with residuez(); which will automatically perform long division >> [A,p,K] residuez([ -.4 -.4],[ -.3 -.4]) A + -----------------------.8z A - < agrees with A - < agrees with A.z ---------------------------------------------------------- +.5z.8z.z + 4. A ----------------------- ----------------.8z +.6.z A ----------------------- +.5z z.65 ---------------------- +.65 yn Yz + z.5 ----------------------- +.5z -----------------------.8z n+.5 n un.8 n un ECE 6 Signals and Systems 8 3
Steady-State Response and Stability p 8.e- -5.e- K < Long division term The value K is the result of long division (see the help for residuez()) The answers agree! Steady-State Response and Stability The sinusoidal steady-state response developed in Chapter 6 for FIR filters also holds for IIR filters It can be shown (see Text Section 8-8 for more details, especially for N ) that for xn e jˆ n un (8.8) and Hz an IIR system with N M, the system output will be yn N A k p k n un + He jˆ k jˆ e n un (8.9) where p k k N are the poles of Hz and the A k are the corresponding partial fraction coefficients The first term represents the transient response, which provided all the poles of Hz lie inside the unit circle, will decay to zero, leaving just the sinusoidal term ECE 6 Signals and Systems 8 33
Steady-State Response and Stability For the output to reach sinusoidal steady-state we must have p k to insure that the transient term (first term) decays to zero, this then insures that the system is stable Summary: Poles inside the unit circle to insure stability Example: xn cos nun Input a cosine with ˆ. starting at n to the system Hz --------------------------------------------- 5.8z +.9z This is a second-order IIR filter, so the transient term consists of two exponentials Second-order system will be studied in more detail in the next section Observe the transient using MATLAB >> n -5:5; >> x cos(*pi/*n).*ustep(n,); >> y filter(5,[ -.5.8],x); >> subplot() >> stem(n,x,'filled') >> axis([-5 5 - ]); grid >> ylabel('x[n]') >> subplot() >> stem(n,y,'filled') >> axis([-5 5-3 3]); grid >> ylabel('y[n]') >> xlabel('time Index (n)') ECE 6 Signals and Systems 8 34
Steady-State Response and Stability.5 x[n].5 5 5 5 5 3 35 4 45 5 Transient Interval X 4 Y.6556 y[n] 5 5 5 5 3 35 4 45 5 Time Index (n) What is the filter gain at ˆ? From the plot above we see that in steady-state output peak amplitude over the input peak amplitude is about We can check this by finding the filter frequency response magnitude >> w [.*pi]; % input two frequency values >> H_pts abs(freqz(5,[ -.5.8],w)) H_pts.6667e+ Gain at ˆ.66 ------------.66.65e+ < gain at [,. pi] The exact gain is.65, so the value from the plot is very close ECE 6 Signals and Systems 8 35
Second-Order Filters Second-Order Filters Second-order IIR filters allow for the possibility of complex conjugate pole and zero pairs, yet still have real coefficients The general second-order system function is Hz b + b z + b z -------------------------------------------- a z a z (8.) The corresponding difference equation is yn a yn + a yn + b xn + b xn + b xn (8.) The direct-form I and direct-form II structures, discussed on pages 8 and 8 3 respectively, can be used to implement (8.) Poles and Zeros To identify the poles and zeros of Hz we can first convert to positive powers of z and then factor into poles and zeros Hz b z + b z+ b z z z z ------------------------------------ b z ------------------------------------- a z + a z p z p The coefficients are related to the roots (poles & zeros) via b b z + z b b z z (8.) a p + p a p p ECE 6 Signals and Systems 8 36
Second-Order Filters Given real coefficients, numerator and denominator, the roots occur either as two real values or as a complex-conjugate pair Poles: From the quadratic formula Real poles occur when + 4a Complex-conjugate poles occur otherwise, and are given by where a a + 4a --------------------------------- p p a Zeros: Similar results hold for the zeros if we factor out b and then replace a with b b and replace a with b b --a j -- a 4a re j r a cos a --------------- a ECE 6 Signals and Systems 8 37
Second-Order Filters Example: Complex Poles and Zeros Consider Hz 3 + z +.5z ---------------------------------------------.5z +.8z 3 + --z +.5 ------z 3 3 --------------------------------------------------.5z +.8z Apply the quadratic formula to the numerator and denominator to find the zeros and poles 4 3.5 ---------------------------------------------------- 3.3333j.8498.99e j.9446 z.5.5 4.8 ----------------------------------------------------------.75j.4873.8944e j.576 p We can use the MATLAB function tfzp() to convert the system function form to a zero pole form, plus a gain term >> [z,p,k] tfzp([3.5],[ -.5.8]) z -3.3333e- + 8.4984e-i % these agree with the -3.3333e- - 8.4984e-i % hand calculations p 7.5e- + 4.8734e-i 7.5e- - 4.8734e-i K 3 % K is the same as b in this case ECE 6 Signals and Systems 8 38
Second-Order Filters Impulse Response Using a partial fraction expansion we can inverse transform any rational Hz back to the impulse response hn Given Hz b + b z + b z -------------------------------------------- a z a z b + b z + b z ----------------------------------------------------- p z p z (8.3) we first perform long division to reduce the numerator order by one It can be shown that the partial fraction expansion will be of the form Hz b ---- a A A + --------------------- + --------------------- p z p z (8.4) where A k Hz p k z z pk The impulse response is found using the table on page 8 4 hn b ---- n + A p n un + A p n un a (8.5) This is a very general result, because the poles may be either real or complex conjugates Note that if b (no long division is required) then the delta function term in (8.5) is not needed ECE 6 Signals and Systems 8 39
Second-Order Filters For complex conjugates poles further simplification is possible because A and A will also be complex conjugates Complex Conjugate Poles: To simplify (8.5) for this case we first write A and p in polar form A p e j re j (8.6) We can now write A p n + A p n r n e jn + + r n e jn + and (8.5) specializes to b a r n cosn + ---- n + r n cosn + un (8.7) (8.8) We also see from this form that if we place the poles on the unit circle, the impulse response will contain a pure sinusoid, since r n n Example: Conjugate Poles Inside the Unit Circle Find the impulse response corresponding to Hz 3 + z ------------------------------------------------------------------------------ 3 --e j 4 z 3 --e j 4 z 4 4 The partial fraction expansion is of the form ECE 6 Signals and Systems 8 4
Second-Order Filters We know that Using the general result of (8.8) we see that.867,., r.75, and 4, so Check using residuez() >> [A,p,K] residuez([3 ],[ -*3/4*cos(pi/4) 9/6]) A.5e+ -.448e+i.5e+ +.448e+i p 5.333e- + 5.333e-i 5.333e- - 5.333e-i K [] Hz A -------------------------------- 3 --e j 4 z 4 * A A A 3 + z ---------------------------------- 3 --e j 4 z 4.867e j. 4 3 >> [abs(a()) angle(a())] % Get mag and angle of A ans.8666e+ -.e+ % The results agree z A + ---------------------------------- 3 --e j 4 z 4 j 4 --e 4 3 + --e j 3 --------------------------- 3 + j hn.867.75 n cos -- n. 4 ECE 6 Signals and Systems 8 4
Second-Order Filters Plot hn from the above analysis and compare it with a MATLAB simulation using filter() >> n :; >> h_anal *.867*(3/4).^n.*cos(pi/4*n -.); >> subplot() >> stem(n,h_anal,'filled') >> grid >> ylabel('h_{analysis}[n]') >> subplot() >> x [ zeros(,)]; >> h_sim filter([3 ], conv([ -3/4*exp(j*pi/4)],... [ -3/4*exp(-j*pi/4)]),x); >> stem(n,h_sim,'filled') >> grid >> ylabel('h_{simulation}[n]') >> xlabel('time Index (n)') h analysis [n] 6 4 5.734.75 n cos --n 4. un 4 6 8 4 6 8 They agree! 6 h simulation [n] 4 4 6 8 4 6 8 Time Index (n) ECE 6 Signals and Systems 8 4
Second-Order Filters Frequency Response He jˆ b b e jˆ + + b e jˆ ---------------------------------------------------- a e jˆ a e jˆ (8.9) With just a second-order filter we can realize a frequency response that is lowpass, highpass, bandpass, or bandstop Idealized filter responses are shown below Lowpass Highpass He jˆ He jˆ Bandpass Bandstop (notch) He jˆ He jˆ With just two poles and two zeros the filter action achievable is limited Lowpass/Highpass: Place zeros on the unit circle as a conjugate pair and poles inside the unit circle as a conjugate pair Hz cosˆ z + z ------------------------------------------------------------- rcosˆ z + r z (8.3) ECE 6 Signals and Systems 8 43
Second-Order Filters z-plane ˆ r ˆ Bandpass: Place zeros at z unit circle as a conjugate pair Hz z ------------------------------------------------------------- rcosˆ z + r z and - and poles inside the (8.3) z-plane r ˆ ECE 6 Signals and Systems 8 44
Example of an IIR Lowpass Filter Bandstop (notch): Hz cosˆ z + z ------------------------------------------------------------- rcosˆ z + r z (8.3) See the final project Example of an IIR Lowpass Filter IIR filters can be designed to meet a desired amplitude response requirement Lowpass Filter Amplitude Response Requirements log He jˆ (db) db Passband Transition Band Stopband 5 -- 3 -- ˆ In the above the filter amplitude response is to remain within a db tolerance band of db or unity gain, from ˆ to 3, and have a gain less than -5 db for ˆ This requirement specification defines a lowpass filter ECE 6 Signals and Systems 8 45
Example of an IIR Lowpass Filter A variety of IIR filters can be designed to meet these requirements, one such filter type is an elliptic filter, which is available in the MATLAB signal processing toolbox >> ellipord(*(pi/3/(*pi)),*(pi//(*pi)),,5) ans 5 % The required filter order, N, to meet % the design requirements. >> [b,a] ellip(5,,5,*(pi/3/(*pi)));%design filter >> b.943e-.3e- 3.778e- 3.778e-.3e-.943e- % M5 >> a.e+ -.758e+ 4.e+ -3.37e+.654e+ -3.7959e- % N5 >> zplane(b,a) >> w -pi:(pi/5):pi; >> H freqz(b,a,w); >> subplot(); plot(w,*log(abs(h))) >> subplot(); plot(w,angle(h)).8.6.4 Imaginary Part...4.6.8.5.5 Real Part ECE 6 Signals and Systems 8 46
Example of an IIR Lowpass Filter H(e jω ) db db 4 5 6 3 -- 3 3 H(e jω ) 3 3 hat(ω) The fifth-order elliptic design has more than met the amplitude response requirements as it achieves the -5 db gain level before ˆ The complete Hz is Hz.943 +.z +.377z +.377z 3 +.z 4 +.943z 5 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.758z + 4.z 3.37z 3 +.654z 4.3796z 5 ECE 6 Signals and Systems 8 47
Example of an IIR Lowpass Filter ECE 6 Signals and Systems 8 48