Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Normalizing matrix (rows AND columns equal to 1)

$
0
0
On 11/21/2012 7:24 PM, dpb wrote:
...

> But if you mean just one row/column pair at a time,...

Actually, if you can stand it, you could get the sums to match by
choosing either column or row first, normalize it by the sum then omit
the intersecting element for the corresponding row/column and normalize
the remaining elements to 1-intersecting_value

That would end up w/ a sum for the row and column identically one and
avoid the simultaneous problem of weights to do so w/ too few constraints.

For the trivial case of the 2x2 example again

 >> x=rand(2)
x =
     0.5298 0.2091
     0.6405 0.3798
 >> y=x./repmat(sum(x),size(x,1),1)
y =
     0.4527 0.3550
     0.5473 0.6450
 >> sum(y)
ans =
      1 1
 >> y(:,2)=1-y(:,1)
y =
     0.4527 0.5473
     0.5473 0.4527
 >> sum(y)
ans =
     1.0000 1.0000
 >> sum(y,2)
ans =
      1
      1
 >>

Of course, depending on how large your array is and the size of values,
the two normalizations may not look very similar this way...

--

Viewing all articles
Browse latest Browse all 19628

Trending Articles