Standardisation about zero mean

I have a matrix of order say m*n. Now each column will have some mean. I want to know how can I subtract that mean value from the elements of that particular column so that I can obtain a new standardised matrix of same order?

Antworten (2)

Andrei Bobrov
Andrei Bobrov am 25 Jul. 2016

1 Stimme

a = randi(20,8,6);
out = bsxfun(@minus,a,mean(a));
Vaclav Rimal
Vaclav Rimal am 25 Jul. 2016

0 Stimmen

Given that your original matrix is Aorig, do the following:
Anew = Aorig - ones(size(Aorig,1),1)*mean(Aorig);
Note that you need the multiplication by vector of ones to obtain the correct size of the subtracted matrix. You could also use repmat but it is not that fast.

Kategorien

Gefragt:

am 25 Jul. 2016

Kommentiert:

am 25 Jul. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by