How to normalize 60x3 vector to zero mean and unit variance

1 回表示 (過去 30 日間)
krishnasri
krishnasri 2015 年 6 月 16 日
コメント済み: Luis 2016 年 8 月 15 日
I have vector size of 60x3 in an excel sheet, I need to find the zero mean and unit variance of all the values in that sheet and write back the result into another excel sheet. Can u please help me in writing the code.

採用された回答

Walter Roberson
Walter Roberson 2015 年 6 月 16 日
New_Array = (The_Array - mean(The_Array(:))) . / var(The_Array(:));
This assumes that the array as a whole is to have zero mean and unit variance, rather than each row or column to independently have zero mean and unit variance. If you want the columns done independently:
(The_Array - repmat(mean(The_Array), size(The_Array,1), 1)) ./ repmat(var(The_array), size(The_Array,1), 1);
  7 件のコメント
krishnasri
krishnasri 2015 年 6 月 17 日
Okay got it.. Thanq...
Luis
Luis 2016 年 8 月 15 日
Actually you should divide by the standard deviation (std), not the variance (var)
(The_Array - repmat(mean(The_Array), size(The_Array,1), 1)) ./ repmat(std(The_array), size(The_Array,1), 1);

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by