auto.m

来自「偏最小二乘算法在MATLAB中的实现」· M 代码 · 共 18 行

M
18
字号
function [ax,mx,stdx] = auto(x)
%AUTO Autoscales matrix to mean zero unit variance
%  Autoscales a matrix (x) and returns the resulting matrix (ax)
%  with mean-zero unit variance columns, a vector of means (mx) 
%  and a vector of standard deviations (stdx) used in the scaling.
%  I/O format is:  [ax,mx,stdx] = auto(x);

%  Copyright
%  Barry M. Wise
%  1991
%  Modified November 1993

[m,n] = size(x);
mx = mean(x);
stdx = std(x);
ax = (x-mx(ones(m,1),:))./stdx(ones(m,1),:);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?