我怎样才能归一化矩阵?

时间:2014-04-13 10:27:54

标签: matlab matrix normalization

我使用下面的代码来规范化矩阵;我的数据幅度的原因在每列中与其他列非常不同,因此我的答案不在0和1之间。

A = rand(m,n)
normA = max(A) - min(A);               
normA = repmat(normA, [length(a) 1]);  

normalizedA = A./normA;

我原始数据的一部分是:

32512035.2100000    5401399.57000000    346.880000000000
32512044.0300000    5401399.54000000    346.850000000000
32512046.8900000    5401399.55000000    346.780000000000
32512049.7800000    5401399.53000000    346.860000000000
32512052.6900000    5401399.53000000    346.700000000000
32512054.0300000    5401399.53000000    346.780000000000
32512055.6900000    5401399.57000000    346.810000000000
32512063.1200000    5401399.54000000    347.800000000000
32512074.2300000    5401399.55000000    346.440000000000
32512093.1200000    5401399.54000000    346.660000000000

并且它们的标准化是:

341584.736395270    39652.0303186782    6.02013189864630
341584.829061797    39652.0300984462    6.01961124609511
341584.859110126    39652.0301718569    6.01839639014231
341584.889473648    39652.0300250355    6.01978479694551
341584.920047298    39652.0300250355    6.01700798333912
341584.934125886    39652.0300250355    6.01839639014231
341584.951566525    39652.0303186782    6.01891704269351
341585.029629143    39652.0300984462    6.03609857688303
341585.146355346    39652.0301718569    6.01249566122874
341585.344821410    39652.0300984462    6.01631377993752

我是否必须单独规范化任何列?

1 个答案:

答案 0 :(得分:1)

您应该使用:

max_value = max(A(:));
min_value = min(A(:));
normalizedA = (A - min_value)/(max_value - min_value);