MATLAB: Z-Transform of difference Equation

difference equationsz transfoırm

I must find Z-Transform of this equation but either i get wrong answer or errors

Best Answer

Use the subs (link) function:
X = subs(X, {ztrans(y(n), n, z), y(-1), y(-2)}, {Y(z), 4, 10})
producing:
X =
Y(z) - (3*Y(z))/(2*z) + Y(z)/(2*z^2) - 1/(4*z - 1) + 2/z - 3/2