Standardisation about zero mean

1 回表示 (過去 30 日間)
PARTHA HALDAR
PARTHA HALDAR 2016 年 7 月 25 日
コメント済み: PARTHA HALDAR 2016 年 7 月 25 日
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?

回答 (2 件)

Andrei Bobrov
Andrei Bobrov 2016 年 7 月 25 日
a = randi(20,8,6);
out = bsxfun(@minus,a,mean(a));
  1 件のコメント
PARTHA HALDAR
PARTHA HALDAR 2016 年 7 月 25 日
Thanks

サインインしてコメントする。


Vaclav Rimal
Vaclav Rimal 2016 年 7 月 25 日
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.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by