フィルターのクリア

Column and Row factors

5 ビュー (過去 30 日間)
Fayyaz
Fayyaz 2015 年 4 月 14 日
回答済み: Titus Edelhofer 2015 年 4 月 14 日
Hi,
I have a 12*12 matrix, whose row sum in Not equal to the respective column sum (overall sum in equal), i.e. sum of the entries of the 1st column is different from the sum of the entries of the 1st row and so on. I need to equalize these sum using row and column factors.
Column factor is equal to sum of entries of row divide by sum of entries of column and vice versa for the Row factor (so I will have 12 factors). Firstly, when I get column factors I will multiply this to that 12*12 matrix. Then I have to multiply it with row factors, this will be iterative process until these sums are close to each other (i.e. within 5%).
Any help in this regard would be greatly appreciated.

採用された回答

Titus Edelhofer
Titus Edelhofer 2015 年 4 月 14 日
Hi,
something like this?
A = rand(12);
err = 1;
it = 1;
while err > 0.05 && it<10
colFactor = sum(A,2) ./ sum(A,1)';
A = A * diag(colFactor);
rowFactor = sum(A,1) ./ sum(A,2)';
A = diag(rowFactor) * A;
err = max(abs(rowFactor-1));
it = it + 1;
end
Titus

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by