 Select Page

Finally! We will start getting into the nitty gritty of filter design. Apologies for the delay to this article. I have been focused on a few other obligations and I was unsure as to how I would teach this particular subject. There are some aspects that I do not want to explicitly teach and therefore I will have to make some assumptions.

I will have to assume that you, the reader, understand complex numbers and Euler’s formula as well as the basic concepts that I have discussed in previous articles on Digital Signal Processing. Other than that, feel free to follow along for the next few articles and look at the example code provided.

## Introduction

The Z-Transform is an important tool in DSP that is fundamental to filter design and system analysis. It will help you understand the behavior and stability conditions of a system. Over the next few articles I will explain how and why it works and hopefully give you a better understanding. This topic will often throw a wrench in the works for those new to DSP. However, I hope these articles provide a guide.

## What is the Z-Transform?

The Z-Transform is often denoted in the following form:

This is known as the Bilateral Z-Transform. Like previous articles n is a sample index and x[n] is a discrete signal. It is Bilateral as it goes from -∞ to ∞ samples. This is of course not practical as negative sample values or negative time means that we are describing a non-causal system. Unfortunately, this is the form you see in most text books (as it is the general definition) but I think this is somewhat misleading.

Thankfully, you will see engineers use the following form (Unilateral Z-Transform):

So let’s dissect this equation. Our system X(z) is the sum of the product of two functions x[n] and z^-n for all values of n from n = 0 to the end of time. Take note of that negative exponential term.

## So what are are we trying to figure out?

When we take a signal and change from one domain (such as the time domain) to another domain (such as the frequency domain) we gain insights as to the characteristics of that signal. Likewise, when conducting signal processing, we can investigate the characteristics of a system in much the same way.

The Z-Transform allows the designer to identify values that exponentially increase or decrease with time in x [n ].

Think back to my article on FIR and IIR Filters. Recall that all filters have stability conditions for the coefficients and that these are something you always have to check for. This is especially important in IIR filters. As I am sure you can appreciate, the IIR filter designed and coded in that article was small and easy to understand. However, you can have much more complicated relationships of feedback and feed-forward delay lines. The Z-Transform is a way of finding conditions of instability so that you can mitigate against these terms or change your system design.

## Why do we want to use the Z-Transform?

As has been explained in a previous article, the magnitude-frequency and phase-frequency response of a system shows how the amplitude and phase of sinusoidal components will be altered by a system. The fastest way to measure this is by applying an impulse to the system and analyzing the corresponding impulse response signal.

In a like manner, the Z-Transform allows us to analyze the frequency and phase of sinusoidal components of a system to characterize a system’s response. In short:

1. If the Z-Transform of a system identifies exponentially increasing output values, then your system exhibits instability for that value of x[n] and z^-n.
2. Another consequence of this formulation, is that we can also examine the frequency response of a system. This will be substantiated later using graphs.

## Back to the Math…

In my opinion, the best way to understand an equation is to break it down with the simplest inputs possible. As stated before x[n] and z^-n can be thought of as two signals. So let’s examine this equation for a very simple set of test values:

The first step is to multiply the signals so this gives us:

The final step is to sum these values:

Do not be concerned about this output value at the moment. The process is the important part. The main thing is not to be intimidated by the tedious nature of the math. If you understand the equations, then you can implement it in code.

What you have just performed is a correlation between two signals. You have just created a dimensionless number which is intended to help you identify the presence of one signal within another signal. In this example, the z^-n number can be thought of as a DC offset of 1. It appears that the signals have some related characteristics in regards to this offset.

## What is x[n]?

Remember that the Z-Transform helps us understand and describe a system. We also know that x[n] is a discrete signal. Technically x[n] can be any discrete signal however, is makes sense that the signal x[n] should describe the system.

Of course, we do know of a signal that can describe a system… the system’s impulse response. Therefore x[n] is usually the system’s impulse response.

## But what is z?

The variable z is a complex number. In electrical engineering, physics and acoustics, complex numbers are usually written in this form:

A is a gain component, j is the imaginary unit and ω is angular frequency. Angular frequency is in radians per second rather than Hz (cycles per second). Therefore z^-n is:

Now some of you from an engineering or trigonometry background may be well aware of Euler’s formula. Euler’s formula states that a complex exponential number can also be written as the sum of two periodic functions as follows:

Therefore z^-n is:

## Why these formulations are helpful…

Please note that the second and fourth equations from the section above are equivalent but written in different forms. This is vital. Essentially:

1. A is some gain factor that can change for each sample.
2. The cosine and sine functions are periodic functions over time and are the real and imaginary parts respectively.

Luckily we can express these real and imaginary parts of this complex number on a Cartesian grid. This means that we can visualize z.

## Conclusion

The next article will continue where this article left off. We will visualize z and deconstruct what it means. From there we will conduct further visualizations. I did not want to make this article too long and double or triple the length. Until then:

Be good to each other and take it easy…

-Will ☜(ﾟヮﾟ☜)

Will Fehlhaber is an Acoustics Engineer and Audio Programmer from the UK and Bay Area.

## Bibliography/Citations/Resources: 