I have a matrix X
with 3 columns. For the porous of the question X=randn(5,3)
.
I want to normalize the columns of X
S.T. each column will have a 0
mean and a 1
std. I was using the following code:
X=(X-mean(X))./std(X);
I am getting an std of 1
. My mean, however, is a very small value close to 0
but not essential 0
. I tried playing a bit with the numbers to find an explanation:
X=1:15;
X=reshape(X,[5 3]);
mean(X-mean(X));
Which gives me 0
value for each column.
X=1:15;
X=reshape(X,[5 3]);
mean((X-mean(X))./std(X));
Which does not. But 0/anything is still 0. what am I missing?
- Why am I not getting
0
values? - Are the values I am getting good enough for a pre-clustering algorithm normalization?