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.