I am defining a symbolic function
syms x(n);
x(n) = (n==0);
n=-1:1;
When I try x(n)+x(n-1)
I get
[ -1 == 0, 0 == 0, 1 == 0]
+[ -2 == 0, -1 == 0, 0 == 0]
=[ -3 == 0, -1 == 0, 1 == 0]
I want to force the symbolic function to substitute the values so I get the following results instead.
[ 0, 1, 0]
+[ 0, 0, 1]
=[ 0, 1, 1]
I tried something like x(n) = logical(n==0); and x(n) = double(n==0); but I got the same result.
I know that double(x(n))+double(x(n-1)) works, but I want to use x(n) directly and do the substitution in the definition of the symbolic function.
Can this be done?
evalin(symengine,'TRUE+TRUE')throws Error. - drhagen