I have a 1x50000
size matrix v
and I want to convert it to zero mean and unit variance:
x = ((v-mean(v))/std2(v));
Bu
Check the data type for v
. I'm sure it's an integer type, using integer arithmetic, which is why the result is an integer. You need to convert it to a floating point type to perform floating point operations on it:
v = double(v); % Convert v to a double-precision float
x = ((v-mean(v))/std2(v)); % Result is now a double as well