MATLAB: How can i set a contition in a symbolic function (use only even numbers)

syms symbolic signal analysis ztrans condition

Hello, I'd like to create the symbolic function x[n]=2^n*u[n] if n is even, and x[n] = 0 if n is odd. I created a vector which works with
n=0:20;
x=2.^(n).*abs(mod(n,2)-1);
However, i'd like to perform ztrans on this signal, so i need it in a symbolic function. The mod functions does not seem to work the same way with symbolic functions. How do i create the function i need?

Best Answer

I fixed the problem using the geometrical series convergence for specified Z values.
syms n
a=2;
z1=5;
z2=10;
antwoord4_1=double(symsum(a^(2*n)/z1^(2*n),0,Inf))
antwoord4_1=double(symsum(a^(2*n)/z2^(2*n),0,Inf))