Technical Article

What Is the z-Transform?

June 15, 2020 by Robert Keim

This Frequent Engineering Question gives a quick overview of an important mathematical technique used in digital signal processing, calculating the z-transform.

If you’ve studied the Laplace transform, you’re familiar with the concept of transforming a function of time into a function of frequency. The variable used in the Laplace transform is s, which represents complex frequency, i.e., it is frequency with a real and imaginary part:

 

\[s=\sigma+j\omega\]
 

You can think of the z-transform as a discrete-time version of the Laplace transform. We use the variable z, which is complex, instead of s, and by applying the z-transform to a sequence of data points, we create an expression that allows us to perform frequency-domain analysis of discrete-time signals.

With the z-transform, we can create transfer functions for digital filters, and we can plot poles and zeros on a complex plane for stability analysis. The inverse z-transform allows us to convert a z-domain transfer function into a difference equation that can be implemented in code written for a microcontroller or digital signal processor.   

 

How to Calculate the z-Transform

The relationship between a discrete-time signal x[n] and its one-sided z-transform X(z) is expressed as follows:

 

\[X(z)=\sum_{n=0}^\infty x[n]z^{-n}\]

 

This summation begins as a sequence of individual values, and since we are summing from n = 0 to n = infinity, the sequence is of infinite length. What can we do with an infinite sequence of summed elements?

This is where convergence comes in.

 

Convergence with the z-Transform

Consider the unit step, which we define as follows:

 

\[u[n]=\begin{cases}0 & n < 0\\1 & n \geq 0\end{cases}\]

 

This results in the following summation:

 

\[X(z)=\sum_{n=0}^\infty u[n]z^{-n}=z^0+z^{-1}+z^{-2}+z^{-3}+\ …\]

 

An infinite sequence of summed numbers can converge to one number. For example:

 

\[1+\frac{1}{2}+\frac{1}{4}+\frac{1}{8}+\frac{1}{16}+\ …\ =2\]

 

If we continue the sequence according to the same pattern and sum all the elements, as the number of elements approaches infinity, the sum approaches the number 2. With the z-transform, the elements include a variable, but convergence can still occur—the sequence converges to a variable expression instead of a number.

The sequence shown above for the unit step converges as follows:

 

\[X(z)=\sum_{n=0}^\infty u[n]z^{-n}=z^0+z^{-1}+z^{-2}+z^{-3}+\ …=\frac{z}{z-1}\]

 

Not all z-transforms will converge. Here are examples of discrete-time signals that have “well-behaved” z-transforms; note that all of these x[n] functions are multiplied by the unit step, such that the z-transform operation is applied to a sequence that is zero for n < 0.

 

\[x[n]=nu[n]\ \ \ \ \ \ \ \ \ \ \ \ \ \ X(z)=\frac{z}{(z-1)^2}\]

\[x[n]=a^nu[n]\ \ \ \ \ \ \ \ \ \ \ \ \ \ X(z)=\frac{z}{z-a}\]

\[x[n]=\sin(\omega n)u[n]\ \ \ \ \ \ \ \ \ \ \ \ \ \ X(z)=\frac{z\sin(\omega)}{z^2-2z\cos(\omega)+1}\]

 


 

What additional questions do you have regarding the z-transform? Let us know in the comments below.

4 Comments
  • B
    Bernie Hutchins June 16, 2020

    Robert - you said:  “The inverse z-transform allows us to convert a z-domain transfer function into a difference equation.”  Don’t you mean the “unit-sample” response?  -Bernie

    Like. Reply
  • B
    Bernie Hutchins June 18, 2020

    EXPLANATION of Comment Above

    Suppose we have a transfer function:

        H(z) =Y(z)/X(z) = 1 / [1 - 0.5z^(-1) - 0.3z^(-2)]     

        If we want the corresponding difference equation (DE) we DO NOT take the Inverse z-Transform (IZT) of H(z) (which would be the “impulse response” (IR), h(n) – or technically, the “unit-sample response”). 

        Since z^(-1) is a delay in the z-domain we can just WRITE DOWN the DE from H(z) by simple INSPECTION:

        y(n) = x(n) + 0.5 y(n-1) + 0.3 y(n-2)                                {DE}

    That’s it!  Three terms.  No inverse z-transform.
     
        The IZT (thus the IR) is not an equation at all but rather a sequence (often infinite length) of numbers, which may or may not be represented by its own, assessable (by a variety of methods) closed-form expression.

        In our example, the IZT/IR is conveniently found by numerical iteration of the DE with x(n)=1 for n=0, and x(n) = 0 for all other n: e.g., for n=0,1,2,3 …. ,

    y =  0.50000, 0.55000, 0.42500, 0.37750, 0.31625, 0.27138, 0.23056, 0.19669, 0.16752, 0.14277, 0.12164, 0.10365…..

    Thus h(n) - Lots of numbers!

    -Bernie

    Like. Reply
  • E
    eemaestro June 19, 2020

    How do you code the sampled value of an output variable using a digital filter using z^-1, z^-2, z^-3, et cetera ?

    Like. Reply
    • B
      Bernie Hutchins June 19, 2020
      If I understand your question; you iterate the difference equation(s). In my example, the DE is: y(n) = x(n) + 0.5 y(n-1) + 0.3 y(n-2) It relates 4 locations each with corresponding numerical contents. The first step (FIRST, AND ALL AT ONCE) of each iteration is to MOVE the current numerical contents of each location to the location where it is delayed by one additional clocking. Begin with the most delayed. Here y(n-2) would be moved to y(n-3), EXCEPT y(n-3) is not available in the DE, so its content “walks off” (is discarded). The contents of y(n-1) moves to the thus vacated location y(n-2), and the contents of y(n) go to location y(n-1). The contents of x(n) is replaced by the next incoming input value. Following the data move, everyone is happily updated, EXCEPT for y(n), the new output value. Happily, this is exactly what the DE gives us. And more iterations. - Bernie
      Like. Reply