| Statistics Toolbox™ | ![]() |
Z = zscore(X)
[Z,mu,sigma] = zscore(X)
[...] = zscore(X,1)
[...] = zscore(X,flag,dim)
Z = zscore(X) returns a centered, scaled version of X, the same size as X. For vector input x, output is the vector of z-scores z = (x–mean(x))./std(x). For matrix input X, z-scores are computed using the mean and standard deviation along each column of X. For higher-dimensional arrays, z-scores are computed using the mean and standard deviation along the first non-singleton dimension.
The columns of Z have mean zero and standard deviation one (unless a column of X is constant, in which case that column of Z is constant at 0). z-scores are used to put data on the same scale before further analysis.
[Z,mu,sigma] = zscore(X) also returns mean(X) in mu and std(X) in sigma.
[...] = zscore(X,1) normalizes X using std(X,1), that is, by computing the standard deviation(s) using n rather than n–1, where n is the length of the dimension along which zscore works. zscore(X,0) is the same as zscore(X).
[...] = zscore(X,flag,dim) standardizes X by working along the dimension dim of X. Set flag to 0 to use the default normalization by n–1; set flag to 1 to use n.
Compare the predictors in the Moore data on original and standardized scales:
load moore predictors = moore(:,1:5); subplot(2,1,1),plot(predictors) subplot(2,1,2),plot(zscore(predictors))

![]() | x2fx | ztest | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |