Normalizing data
古いコメントを表示
Hi there,
How would you normalize a column of data in matlab between 0 and 1 using the formula, z = (x-mean)/standard deviation. Is there a built in function to do this?
Many thanks
John
1 件のコメント
Merhan Ahmed
2017 年 1 月 25 日
zscore function could be used as Z = zscore(X)
採用された回答
その他の回答 (3 件)
Jurgen
2012 年 11 月 18 日
Dividing by the maximum does not correct for offset. So only ranges 0-X go to 0-1. If his column has a negative or nonzero minimum it won't normalize to 0-1.
While the formula for correcting this is simple, mat2gray will normalize to 0-1 for you:
for i = 1:ncol
D(:,i) = mat2gray(D(:,i))
end
You have to decide if you need to normalize before or after your calculation.
VoyageR
2016 年 11 月 3 日
Also don't forget to set your data as double otherwise you will only have 1 or 0 in your normalized vector ; )
double(vectorOfIntergers)
marwa el-hossary
2018 年 5 月 7 日
0 投票
plz, how can I normalize data of matrix 1x256000 between -0.5 and +0.5 by matlab code
2 件のコメント
Steven Lord
2018 年 5 月 7 日
Nikhil Jahagirdar
2019 年 4 月 10 日
Does it support MAtlab R2016b?
カテゴリ
ヘルプ センター および File Exchange で Descriptive Statistics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!