Rev | Line | |
---|
[37] | 1 | function y = manyrands_dev(m,k) |
---|
| 2 | % Given a matrix, take all k-tuples of the columns. Then for each row, |
---|
| 3 | % take the min value. Then take the average of all these. |
---|
| 4 | tot = 0.0; |
---|
| 5 | n = 0; |
---|
| 6 | for tup = (all_ntuples(k,size(m,2)))' |
---|
| 7 | m1 = m(:,tup'); |
---|
| 8 | if k == 1 |
---|
| 9 | tot = tot + sum(m1); |
---|
| 10 | else |
---|
| 11 | tot = tot + sum(min(m1')); |
---|
| 12 | end |
---|
| 13 | n = n + size(m,1); |
---|
| 14 | end |
---|
| 15 | ave = tot/n; |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | tot = 0.0; |
---|
| 19 | n = 0; |
---|
| 20 | for tup = (all_ntuples(k,size(m,2)))' |
---|
| 21 | m1 = m(:,tup'); |
---|
| 22 | if k == 1 |
---|
| 23 | tot = tot + sum((m1-ave).^2); |
---|
| 24 | else |
---|
| 25 | tot = tot + sum((min(m1')-ave).^2); |
---|
| 26 | end |
---|
| 27 | n = n + size(m,1); |
---|
| 28 | end |
---|
| 29 | y = sqrt(tot/(n-1)); |
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.