scale.m
来自「偏最小二乘算法在MATLAB中的实现」· M 代码 · 共 21 行
M
21 行
function sx = scale(x,means,stds)
%SCALE Scales matrix as specified
% Scales a matrix (x) using means (mx) and standard
% deviations (stds) specified.
% I/O format is: sx = scale(x,mx,stdx);
% If only two input arguments are supplied then the function
% will not do variance scaling, but only vector subtraction.
% I/O format is: sx = scale(x,mx);
% Copyright
% Barry M. Wise
% 1991
% Modified November 1993
[m,n] = size(x);
if nargin == 3
sx = (x-means(ones(m,1),:))./stds(ones(m,1),:);
else
sx = (x-means(ones(m,1),:));
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?