In the previous article of this series, I showed you how we can take an FIR filter and analyze its properties using the Z-Transform. I showed you how the Z-Transform is conducted using a small number of coefficients for a single value of z. This is a tedious process. I then showed you how that equation can be solved for a large number of values for z in order to display the system as a mesh.

I also showed that you can take the magnitude response in decibels at any value of z. Furthermore, we can get the system’s magnitude-frequency response (DTFT) if z is on the unit circle.

Lastly, the mesh representation allowed us to visually see the pole and zero locations for a system. For an FIR filter, the poles were located at the center while the zeros could be anywhere.

Clearly the last article was important…

In this article, I want to show you how we can examine IIR systems and filters. I will show you how we can examine a filter for stability and how the coefficients of the system are related to the pole and zero coordinates. In this article we will have to back track a bit to refine our understanding of IIR systems.

A Recap on IIR Filters

It has been a while since I actually described the workings of an IIR filter system. In a previous article, I demonstrated the basic difference between an FIR and IIR filter. I said that the FIR system is constructed out of a number of taps that form a discrete convolution. I also said that the IIR filter can use feedback and feed-forward routing to create a filter. I also stated that an IIR filter can be stated as a difference equation.

While the system I proposed was correctly demonstrated and written, it was not a general view of IIR filters. Now I think is a good time to demonstrated how IIR systems are put together in a general formulation.

Below you will find a graph of a general IIR system. Please note that this graph is more complicated than the simple system used in a previous article (which had one feed-back coefficient). However, even that system is still valid according to this general system below. We should take a moment to look at the principle operation of this general IIR diagram [1] [2].

We have a system with input x[n] that produces an output y[n]. The output is a function of the difference of a feed-forward system (left-hand side) and a feed back system (right-hand side). The left-hand side has its gain coefficients denoted with b. The right-hand side has its gain coefficients denoted with a. Please note that we can have any number of a and b taps. These sides do not need to be symmetric.

You might not immediately notice this, but that left-hand side looks exactly like the FIR filter (below) even though the orientation is different. Remember that the highlighted section is known as a tap.

Going back to the IIR filter in the larger previous picture…

The right-hand side looks very similar to the left-hand side with some differences:

  • Notice how there is no a0 coefficient that is complementary to b0. This is because a0==1 in this formulation. In other words, the sample is not modified at this point.
  • The right-hand side takes the input from the left-hand side and the result of itself. This is the feedback nature of an IIR filter system. This feedback path is what leads to the infinite nature of the impulse response.

Now think about the last point. If we had no feedback paths, as if our filter did not require any, then our filter would be an FIR filter.

The basic thing to remember is that FIR and IIR systems may seem different. However, you can also remember this general IIR filter diagram by thinking of two FIR systems feeding samples in opposite directions.

Expressing IIR Filters Mathematically

The general IIR filter can be transcribed as follows.

This can also be sometimes written with the a0 term as:

Notice that a0 simply acts as an overall gain control for the system.

The output y is a function of x and delayed y signals. The coefficients a are the feedback terms. The coefficients b are the feed-forward terms. There are F number of feed-forward coefficients and B number of feedback coefficients. Note the sign change for the a terms.

This long summation can be written in a more condensed manner (difference equation) [1].

Which is equivalent to this version which includes the a0 term.

As shown by the signal flow diagram for the general IIR, we have a left-hand side and a right-hand side. This means that the feed forward summation and the feedback summation can be considered as separate terms which allows us to write the following equivalence [2].

Now this way of writing the equation is not helpful to us when writing code. But it is helpful when breaking down this IIR system. We can think of this as being two separate convolutions. One acting on the y terms with B number of a coefficients. One acting on the x terms with F number of b coefficients.

This is useful as it will allow us to analyze these as two separate systems. The right-hand side of this equivalence statement corresponds with the feed forward term and we are convolving the coefficients with the input signal x. The right-hand side of this equivalence statement corresponds with the feedback terms and we are convolving the coefficients with the output signal y. Of course, y is the result of the right-hand side.

Back to the Z-Transform

The previous equivalence statement means that we can perform a Z-Transform on each side of the equation simultaneously [2]. You will often see this as follows:

If we re-arrange terms we can get the Total System Transfer Function which is often denoted H(z). This is akin to saying the Z-Transform of the entire system. Effectively the Transfer Function is a ratio of the output terms to the input terms. (Apologies for the odd formatting bug…)

Notice that if we have no a coefficients then your system equation is the Unilateral Z-Transform over 1. This means that if you do not have any feedback then your system is an FIR system.

Just like in the previous article, it is now doubly tedious to do this by hand. So, let’s test some systems using my Python code. If you want any Python code that relates to this, then feel free to grab it from my GitHub.

Analyzing an IIR System

So lets use what we have discussed to analyze a common filter. Using the following code, we can create an Elliptic Low-pass Filter with a pass band deviation of 6 dB and a stop band attenuation of 54 dB with 6 dB variance.

bEllip, aEllip = scipy.signal.iirfilter(3, 0.5, rp=6, rs=54, btype='lowpass', ftype='ellip')

Our filter coefficients are as follows:

b Coefficients :
 [0.07166155 0.18822804 0.18822804 0.07166155]
a Coefficients :
 [ 1.         -0.88402525  0.96119644 -0.55739203]

The scipy.signal module gives us stable filters. For this article, we do not need to concern ourselves with the calculations. I would still like to show you the characteristics of the filter that we have created. Here is the result of the DTFT (the magnitude of H(z) along the unit circle).

Let’s actually take a look on that circle mesh.

You have probably noticed that our poles are within the unit circle but away from the center of the mesh. The zeros appear at the edge of the unit circle but they can reside anywhere on the z-plane. This system is stable as shown by the impulse response below.

Of course, we should ask ourselves: What if the poles move outside of the unit circle?

To investigate this, I want to now make an arbitrary IIR filter. Here are the filter coefficients I will use:

b Coefficients :
 [0.6, -0.5, 0.1, -0.2, 0.3]
a Coefficients :
 [0.2, -0.1, -0.0005, 0.2, -0.0002]

Here is the system frequency response.

The poles and zeros are located at:

poles : 
 [0.67835673+0.j         0.10283426-0.90061364j 0.10283426+0.90061364j]
zeros : 
 [-0.8133127+0.58182682j -0.8133127-0.58182682j -1.       +0.j        ]

And here is the system as a mesh

It looks as if there is trouble here. We have two poles outside of the unit circle and the zeros are located within the radius of the poles farthest from the unit circle. Extending the mesh out to a radius of 2 would reveal the location of these hyper-extended poles. As a result our system does not converge and the impulse response is unstable.

A filter system can be stable for certain values of z and not for others. A rule to remember is that a system can be evaluated for values of z that are farther out than the furthest pole from the center of the unit circle. Remember that FIR filters always have their poles in the center, therefore all values of z (that are not at the center) can be evaluated. IIR filter can have poles that are placed elsewhere. This means that the values of z beyond that pole can be evaluated. However, if any poles are at or beyond the unit circle then the system is unstable as the DTFT cannot actually be determined. Practically speaking, this is why you need a computer to analyze the Z-Domain.

I would like to key you in on to a supplementary video from a DSP lecturer in Ireland named David Doran. He has an excellent video explaining analysis of IIR systems in the Z-Domain as well.

Conclusion

In this article I have covered the essentials of using the Z-Transform to characterize an IIR system. We have now solidified our understanding of IIR filters and how they can be described in a general manner both graphically and mathematically. And we have finalized how we can use the Z-Transform to describe the feed-forward and feedback phenomena of a system in order to get the System Transfer Function. Lastly we have looked at preliminary components of stability using the position of the poles in relation to the zeros and also the impulse response.

In future articles, I want to show how we can examine electronic circuits in order to model analog systems. I then want to show how we can take those analog systems and model them in the digital domain. Exciting stuff ahead! Until next time:

Be good to each other and take it easy…

-Will ☜(゚ヮ゚☜)

Bibliography/Citations/Resources:

[1] The z-transform and Analysis of LTI Systems 

[2] Schaums Outline of Digital Signal Processing, 2nd Edition (Schaum’s Outlines)

[3] Understanding Digital Signal Processing

Liked it? Take a second to support William Fehlhaber on Patreon!

Shopping cart

Subtotal
Shipping and discount codes are added at checkout.
Checkout

Sign up here to learn about our premium courses and more!

 

Thank you for being a part of The Audio Programmer Community!