help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vector approach to row margin frequencies


From: ws
Subject: Vector approach to row margin frequencies
Date: Tue, 23 Jun 2009 22:39:41 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

In an attempt to learn more about octave, I am trying to figure out how to 
calculate the row frequencies for the following matrix (call it X):

3,560   5,421   15,983
4,768   9,777   8,033
4,960   5,251   8,390
5,518   5,205   3,402
7,847   21,538  83,351
3,376   6,026   9,606
11,704  19,316  50,241
4,644   4,967   6,607
12,171  26,274  134,419
2,689   6,069   15,849
18,010  29,712  100,240
4,121   5,287   11,214
5,968   12,433  149,215
1,870   2,773   18,760
5,562   12,213  109,476
1,109   2,977   10,452

I am able to get the row totals with S=sum(X,2):

    24964
    22578
    18601
    14125
   112736
    19008
    81261
    16218
   172864
    24607
   147962
    20622
   167616
    23403
   127251
    14538

I would love to now get the row frequencies avoiding a while loop, something 
like F=X./S, but that doesn't work (though it seems somehow consistent -- I 
realize that we don't recycle vectors in Octave/ Mat* ) ....

Perhaps there is something like an "apply" command?

I can do this in a while loop if I have to, but I don't want to...

Tx!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]