My MATLAB code
<code>clc;clear;close all
syms n z
x=n^2*heaviside(n);
X1=ztrans(x,z)
x1=iztrans(X1,n)
X2=ztrans(x1,z)
X2=simplify(X2)
</code>
<code>clc;clear;close all
syms n z
x=n^2*heaviside(n);
X1=ztrans(x,z)
x1=iztrans(X1,n)
X2=ztrans(x1,z)
X2=simplify(X2)
</code>
clc;clear;close all
syms n z
x=n^2*heaviside(n);
X1=ztrans(x,z)
x1=iztrans(X1,n)
X2=ztrans(x1,z)
X2=simplify(X2)
When i use simplify command i get X1=X2
otherwise X1=(z*(z + 1))/(z – 1)^3 and X2= (3z)/(z – 1)^2 – (2z)/(z – 1) + 2/(z – 1)^3 + 2
I have tried to solve and simplify on my copy but i am not getting (3z)/(z – 1)^2 – (2z)/(z – 1) + 2/(z – 1)^3 + 2 equal to (z*(z + 1))/(z – 1)^3
When i solved on copy as shown in attached snap, i got numerator simplified to -3z^2+5z but i was expecting it to be z(z+1) just like MATLAB
Where i am wrong , please advise