MATLAB: Simple multiplication / summation using matlab

multiplicationsummation

i want to do some complicate calculations by matlab of following
n=0:65119;
x = cos(3.6*n)*sin(3.6*n);
y = x*x
it shows errors however, saying
Error in ==> ex3_1_2 at 3 x = cos(3.6*n)*sin(3.6*n);
what's happening?

Best Answer

The MATLAB operator "*" is matrix multiplication. Element-by-element multiplication is ".*"
cos(3.6*n) .* sin(3.6*n)