MATLAB: How can I write a function y(n) in terms of function x(n)

function

I run this code and I get error. (the error is for function y which contains function x in its defenition). how can i fix this error? (The functions x and y are discrete signals)
syms n y x
n=-10:1:10;
x=dirac(n+1)+dirac(-n+4)-2*heaviside(n+3);
y(n)=x(n)-x(2*n+3);
plot(x,'o');
plot(y,'o');

Best Answer

syms n y x
x(n) = dirac(n+1)+dirac(-n+4)-2*heaviside(n+3);
y(n) = x(n)-x(2*n+3);
N=-10:1:10;
plot(N, subs(x,n,N), 'ko', N, subs(y,n,N), 'bo')
It will not look like much, since dirac() is only ever 0 or infinity.