I am using MATLAB and trying to find ztransform of heaviside(n) which is unit step sequence

I am studying book Signals and Systems Laboratory with MATLAB Book by Alex Palamides and Anastasia Veloni

I have attached snap of book but when i try to run this code in MATLAB , i am not getting same results as book

enter image description here

My MATLAB code

clc;clear;close all
syms z n


1 Answer 1


If you look up Matlab's Heaviside function, you'll see that it is not equal to the unit step sequence $u[n]$, because, unlike $u[n]$, it returns the value $1/2$ for $n=0$. Hence, it is given by


and, consequently, its $\mathcal{Z}$-transform is


as correctly claimed by ztrans.

  • $\begingroup$ Can you please explain, how you wrote H(z) = z/(z-1) -1/2 = 1/(z-1)+1/2 $\endgroup$
    – DSP_CS
    Commented May 12 at 13:17
  • 2
    $\begingroup$ @DSP_CS: Have you tried to prove it yourself? Please give it a go, it's really absolutely basic. $\endgroup$
    – Matt L.
    Commented May 12 at 13:47
  • 1
    $\begingroup$ Got it. Thanks alot $\endgroup$
    – DSP_CS
    Commented May 12 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.