Here is the code I am using -
mu = mean(X);
sigma = std(X);
for iter = 1:size(X, 1)
X_norm(iter,:)=((X(iter,:)-mu)./sigma)
end
I was wondering if there was a way to do this without using a loop and using only the basic operators, something by which I could add each row in X by mu and divide each by sigma.
X and X_norm are matrices. One way I found out is - (Although it uses the function ones )
one= ones(size(X, 1), 1);
X_norm = (X - one*(mean(X)))./(one*std(X));
Please note that I want to know more about using the basic operators so don't suggest any libraries or toolkits .
If you are going to post a function, post its implementation as well