数据标准化程序

时间:2017-06-23 04:20:49
【文件属性】:

文件名称:数据标准化程序

文件大小:625B

文件格式:M

更新时间:2017-06-23 04:20:49

标准化

function normal = normalization(x,kind) % by Li Yang BNU MATH Email:farutoliyang@gmail.com % last modified 2009.2.24 % if nargin < 2 kind = 2;%kind = 1 or 2 表示第一类或第二类规范化 end [m,n] = size(x); normal = zeros(m,n); %% normalize the data x to [0,1] if kind == 1 for i = 1:m ma = max( x(i,:) ); mi = min( x(i,:) ); normal(i,:) = ( x(i,:)-mi )./( ma-mi ); end end %% normalize the data x to [-1,1] if kind == 2 for i = 1:m mea = mean( x(i,:) ); va = var( x(i,:) ); normal(i,:) = ( x(i,:)-mea )/va; end end


网友评论