输入5000张16X16的灰度图像。
function [S, mu, sigma2] = standardizeCols(M, mu, sigma2)
[nrows ncols] = size(M);
M = double(M);
if nargin < 2 %nargin函数输入参数数目
mu = mean(M); %方差
sigma2 = std(M); %标准差
ndx = find(sigma2 < eps);% 防止方差(分母)为0
sigma2(ndx) = 1;
end
S = M - repmat(mu, [nrows 1]);
if ncols > 0
S = S ./ repmat(sigma2, [nrows 1]);% 化为标准正态分布
end
M是5000X256的double型向量。