MATLAB: Error: Unexpected MATLAB expression.

errorsigma

I simply do not understand how there is an error here,
>> f = symsum((1/(2*n-1))*sin((2*n-1)2*x), n, 1, 5)
Error: Unexpected MATLAB expression.
To clarify the arrow is pointing at the "2" next to "x".
Edit: I have defined x and n as symbolic, but the error still occurs.

Best Answer

You have not defined n and x as symbolic.
syms n x
f = symsum((1/(2*n-1))*sin((2*n-1)*2*x), n, 1, 5)