Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
Z Transform in MATLAB

Hey learners! Welcome to another exciting lecture in this series of signals and systems. We are learning about the transform in signals and systems, and in the previous lectures, we have seen a bulk of information about the Laplace transform. If you know the previous concepts of signal and system, then this lecture will be super easy for you to learn, but if your concepts are not clear, do not worry because we will revise all the basic information from scratch for our new readers. So, without wasting time, have a look at the topics of today.

  1. What is z transform? 

  2. What is the region of convergence of z transform?

  3. What are some of the important properties of the region of convergence?

  4. How to solve the z transform?

  5. What is an example of the z transform in MATLAB?

  6. What are the methods for the inverse z transform?

What is z transform?

You must have an idea that the Laplace transform is a general case transform and converts the signal from a time domain into a frequency domain. The same is the case with the z transform, it changes the domain of the signal but in another way. The Laplace transform is associated with the power signal and the z transform has some other characteristics. Usually, the z transform is used to understand the stability of the system. Z transforms are used in

  • Energy signals

  • Power signals

  • Neither power nor energy signals

Yet it is applicable to a certain level, and after that level, it is not that much more effective. The Z transform is a powerful mathematical tool and is widely used in mathematical courses and applications including signals and systems. We introduce the z transform as:

"The Z transform is a mathematical tool that, after different procedures, converts the differential equation (with time domain) into the algebraic equation of the z domain."

Mathematically, we show it as:

Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

As you can see clearly, the summation sign contains the limits from negative infinity to positive infinity which means it is a bilateral function of the z transform that we have shared with you. 

By the same token, you can also predict that the z transform also has another region that lies between the zero to positive infinity. It is called the unilateral z transform and it works a little bit differently than the first case discussed here. We describe it as:

Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

Let’s discuss the whole statement in detail but prior to starting, recall in your mind the definition of discrete-time signals. We know that:

“A discrete-time signal is one whose value can be measured at discrete intervals." When working with a discrete-time signal, there will be time intervals of n during which you will not have a value. In the representation of DT signals, the form x[n] is used. Discrete signals approximate continuous-time (CT) signals."

Therefore, when talking about the z transform, keep the definition of z transform in your mind to understand what exactly is going on. 

Now, look at the statement given above.

  • We have the discrete-time signal in the time domain represented by x[t]. 

  • We applied the z transform to it. 

  • Now, we got the same signal that lies in the z domain and is multiplied with a complex number z having the exponential of the n with a negative sign. 

  • Do not worry about the value of n all the time. The summation sign indicates that the value of n starts from negative infinity (or zero in unilateral z transform) to positive infinity, and in this way, we found the values of the series. (This will be much clearer when we discuss the procedure).

    Here z is a complex number that is described with the help of this equation:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    At this level, there is no need to describe the basic concepts of complex numbers. In general, we can summarize the above discussion through the statement given next:

    x(n)⟷X(Z)

    The whole discrete time signal is converted into another format with the z transform as a base,

    Region of Convergence of z Transform

    The region of convergence, or simply ROC, is an important term that is used to describe the range of z in the z transform. As we have said, z is a complex number and its range, therefore, has different types of properties. 

    Properties of the Region of Convergence

    • No. of poles: In z transform, where x[z] is always finite, there are no poles. (We’ll define them in a later section). The ROC of the z transform does not contain any poles. 

    • When talking about a right-sided signal, the region of convergence is always outside the z-plane circle.

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    Where the shaded area is ROC.


    • When talking about a left-sided signal, the region of convergence is always inside the z-plane circle.

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    Where the shaded area is ROC.

    • If we have the signal on both sides, then the region of ROC is in the form of a ring inside the circle. 

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

    • To have a stable form, the region of convergence has a unit value.

    Procedure to Solve z Transform

    There are different cases in the z transform that if we start to describe, will be more confusing and time taking than other transforms. So, we’ll discuss a general format of z transform, and after practice, you will learn the procedure effectively. 

    Thoroughly examine the question. 

    Use the formula of the z transform given above.

    • Put z into the denominator as it has negative power. Doing so will convert the negative power into a positive. 

    • Make sure you take the common values out of the sequence. 

    • Put the value of n as 0, 1, 2, 3, 4, and so on to get the series. 

    • Solve the equation.

    It is the most basic and simple description, but the z transform is not that simple. Instead of solving the long calculations, why not use MATLAB for practical implementation? If you have your own course instructor at university, you must have the idea of solving the procedure by hand. 

    Z transform in MATLAB

    In MATLAB, the z transform is as simple as the previous transform was. Therefore, we are emphasizing the usage of MATLAB at every step. Note that if you want to have a detailed procedure to perform the functions theoretically, you can find your instructors. But from the performance point of view, you should go to MATLAB to confirm your answers all the time. Here is a simple example of an equation that also shows some little details. 

    Code:

    syms n;

    f=(2*n+5)/3

    disp('x[n]=')

    disp(f)

    ans=ztrans(f)

    disp('z[n]')

    disp(F)


    Output:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    Z Transform in MATLAB

    Here, you can see we have used the pre-defined function of z transform given as:

    ztrans(x)

    With the help of the z transform, you can solve any equation or expression that you want. 

    Notice that we have used a display function in the code. You must know that z transform can also be done in MATLAB without using the function. 

    Display function in MATLAB

    The display function is used to label the numerical output. It does the same work as the xlabel and ylabel in the graphical window of MATLAB. Moreover, this function is also used to call the value that we have specified before using it and to display the results directly. The syntax of the display function is

    1. disp(x)

    2. disp(‘x’)

    Where,

    • To display the string value, we use inverted commas around the value. 

    • To call the value of x, we simply use it as it is. 

    • Never use this function with a capital D or any other change in the spelling, otherwise, you will get the error. 

    Have a look at another example of the z transform in which we added two trigonometric functions and found their z transform.

    Code:

    syms n;

    f=sin(2*n)

    ans=ztrans(f)

    g=cos(3*3.14*n)

    ans=ztrans(g)

    Output:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    Display Function in MATLAB

    Zaros and poles of z transform

    When you study this particular topic of z transform, you will hear some terms named as zeros and poles. These are the simple topics while learning z transform and usually, are used in the numerical problem. Consider the following equation:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

    Zeros: while solving the equation with the fraction, the numerator contains the M roots corresponding to the zeros. In the equation given above, q represents the zeros.

    Poles: When you are solving the fractional equation by z transform, the N roots in the denominator are called the poles. Here, these are represented with the letter p.

    While solving the z transform, we make a circular representation to solve the equation, just like we did while we were learning ROC. Poles are represented at the y-axis, and zeros are represented at the x-axis.

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

    Inverse z Transform

    As you can guess from the name, the inverse z transform is used to convert the results of the z transform into the form before the z transform. There are different methods through which the calculations of the z transform are inverted from an equation. 

    1. Long division 

    2. The partial fraction method of inverse z transforms

    3. Residue method

    4. Power series of inverse z transform

    Long Division Method 

    This method is applicable when:

    • There is a ratio of two polynomials

    • The polynomials can not be factorized

    To apply inverse z transform with this method, the division process of numerator with denominator is carried out. The resultant equation is then passed through the procedure of inverse z transform and we get the results. It is a complex method. 

    Partial Fraction Method of Inverse z Transform

    This is the method that involves the rules and procedure of partial fraction (we have received it in the previous lecture) and after that, the inverse z transform is applied. 

    Residue Method

    There are different names for this method including the inversion integration method and contour integral method. For this method, we have to follow the equation given below:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems

    The inverse z transform is obtained by summing up all the residues of this equation from the poles point of view.

    Power Series of Inverse z Transform

    In the end, this is the simplest and easiest way to find the z transform. In this method, the equation is expanded and we get the series of ascending powers. After that, the coefficient of z^-n is the required result. 

    Inverse z transform in MATLAB 

    To apply the inverse z transform in MATLAB, we use the following formula:

    iztrans(x)

    For convenience, we have put the process of z transform and the inverse in the same code. 

    Code:

    syms n;

    f=sin(2*n)

    F=ztrans(f)

    G=iztrans(F)

    Output:

    Basics of Z Transform in Signal and Systems with MATLAB, z transfrom in matlab, matlab z transform, z transform matlab, z transform in signal and systems
    Inverse Z transform in MATLAB
    You can clearly see that we got our required result easily. This type of transforms is used when the data is being transferred to different networks. There are many applications of this transform and you will learn about them in the next section. 

    We have started the discussion of another transform named the z transform that is somehow similar to the Laplace transform that we have learned in the previous sessions. Z transform is a useful mathematical tool and we studied the ROC, procedure, and the inverse method of z transform. We also saw some examples in MATLAB. In the next lecture, we are going to learn some other basic information on the same topic.