Let’s continue on with our tour of the Z-Transform for understanding digital system design. In this article we are going to look at an FIR Filter as an example system. We will examine the system using the Z-Transform and graph out the entire analysis. If you need a brief refresh on FIR filters then please refer back to my other article.
The Unilateral Z-Transform is written as follows:
x[n] is some discrete signal and z^-n is some complex signal. Furthermore, the filter coefficients for an FIR filter are the impulse response. If you need a refresh on FIR filters please read my article here.
The impulse response of our example FIR Filter (filter coefficients) are as follows:
x[n] = [-0.2 , 0.3, 0.1]
We will evaluate this system at the point z = 0.3 – 0.3j. This choice of z is entirely arbitrary.
We will now attempt to undergo the tedious math that was introduced in the first article of this series (a correlation) . I have written the solution below. Essentially we must solve this for each value of x at index n. In the following equations, I have shown each stage of the solution of x[n], z^-n and their product x[n]z^-n.
Here is some Python code that I used to conduct this. You can find all relevant code on my GitHub.
def dBofHz(inputHz):''' this function will simply print to console... ''' outValue = 20*np.log10( inputHz ) print(outValue, " dB") return outValue def calculateForZ(Coefficient_Array = [-0.2,0.3,0.1],Z_Input = 0.3-0.3j):''' this function will simply print to console... an evaluation of x[n] for a specific value of z ''' summR = 0 summI = 0for index in range(len(Coefficient_Array)): #print("x[n] ", Coefficient_Array[index]) z_n_value = pow(Z_Input,-index) print("z^-n = ", z_n_value) print("np.real(Coefficient_Array[index] * z_n_value ", np.real(Coefficient_Array[index] * z_n_value)) print("np.imag(Coefficient_Array[index] * z_n_value ", np.imag(Coefficient_Array[index] * z_n_value)) summR += np.real(Coefficient_Array[index] * z_n_value) summI += np.imag(Coefficient_Array[index] * z_n_value) print("summR ", summR) print("summI ", summI) H_z = np.sqrt((summR**2) + (summI**2)) #print(H_z, " H_z") return H_z
Notice that H(z) is a complex number. However, H(z) can be used to tell us the magnitude of the response of the system at the particular value for z in deciBels . By using the following formula:
Which for our evaluation of z=0.3-0.3j:
H(z) = (0.3+1.0555555555555556j) 0.8069773237689783 dB
The Z-Plane as a Mesh
Right now I want you to notice that we only evaluated this impulse response for a single value of z. The coefficient set x was only 3 coefficients in length! This is a tedious process to do by hand. However, we can evaluate for thousands of values of z around the unit circle by using a computer. By doing so we can visualize the 2D unit circle plot in the last article as a 3D mesh.
As you can guess:
- x-axis is the real component
- y-axis is the imaginary component
- z-axis is the magnitude of the system expressed in dB
Feel free to edit the plot using the Python code provided in order to explore the mesh. I want you to notice a few key aspects that are typical for a Z-Surface plot.
- The surface changes over the values of z.
- There are areas where the mesh tends towards positive infinity (these are the parts that spike upwards). These are known as poles.  
- There are areas where the mesh tends towards negative infinity (these are the parts that spike downwards). These are known as zeros.  
This system has one pole and one zero and we can visualize this with greater ease by a top down view. Please note that a system can have any number of poles and zeros. For FIR filters, the value of H(z) cannot be determined when z = 0 + 0j as that is where the pole is . The zeros can vary in location on the mesh and may even exist outside of the unit circle.
Getting the Frequency Response of the System
As I have stated in previous articles in this series, the Z-Transform and Z-Domain analysis can allow us to analyze all aspects of a system. Of course, when designing filters, you may be concerned chiefly with the system’s frequency response.
As has been discussed in my previous articles, the impulse response (x[n]) of a LTI system describes the behavior of that system. While this is a set of filter coefficients, please remember that the impulse response of an FIR system are the filter coefficients. If we take the Fourier Transform of the impulse response, then we can get the frequency response of that LTI system. The Fourier Transform of sorts is often expressed as H(ω) which is just saying that a transform is expressed in the domain of frequency.  
It turns out, there are different forms of the Fourier Transform. On the surface, the different formulations and Fourier Transform algorithms do the same things but they exist for different applications and considerations to your signal duration. I hope to explain this in the near future.
When we are analyzing systems in the Z-Domain we use a formulation called the Discrete Time Fourier Transform (DTFT). Here is the definition of the unilateral DTFT :
Please note that some engineering texts will express this formula slightly differently. This is why I highly recommend looking at the resources I always list below.
Now the appearance of the equation above might throw you off because it looks a lot like the unilateral Z-Transform below:
In fact, there is a relationship between these two equations.
The DTFT equals the Z-Transform when z==e^(jω).
Essentially, this means that the magnitude response of the system along the edge of the unit circle/mesh is the frequency response of the system . Half of that response (the top half) is valid the other half (bottom half) is aliased . Here is the frequency response of the hypothetical filter of this article up to the Nyquist limit. The values are taken from the edge of the unit circle from the region of 0→π:
In this article, I showed you how we can use the Z-Transform and a Z-Domain representation in order to analyze an FIR filter system. We even took an arbitrary set of FIR filter coefficients and used a computer to analyze the system’s response. We also learned how we can understand the Z-Domain as a mesh surface. In the end, we even got a brief glimpse of the DTFT and its relationship with the Z-Domain. I hope this article proved insightful and helpful. In a future article, we will examine IIR systems and stability analysis using this same procedure. Feel free to experiment with my Python code as we will be using it in future articles. Until then:
Be good to each other and take it easy…