MATLAB: Subscript indices must either be real positive integers or logicals error,

errorsine

r=10;
z=0:0.1:4*pi;
x=r*(z-sin(z));
Subscript indices must either be real positive integers or logicals.
I keep getting this error whenever I use a function involving sine. Even if use examples from a book or matlab examples the error keeps popping up? Any one having the same problem. this is matlab R2015b

Best Answer

Try this
clear sin
r=10;
z=0:0.1:4*pi;
x=r*(z-sin(z))
Probably sin was used as a variable in a previous program