paperclippy: (huh?)
paperclippy ([personal profile] paperclippy) wrote2005-07-14 10:03 am
Entry tags:

math question

I think there is a stupid obvious answer to this question, but I am at a total loss.

I have an array of length N. I want to divide it into D bins. N/D is not an integer. How do I do it without just taking the floor of N/D and then having a huge bin at the end?

Is the following a valid option? Let T = floor(N/D). First bin is length T. Then let T = floor((N-T)/(D-1)), etc? Does that work?

I really think this is something stupid that I used to know how to do but I have forgotton. If any of you know a matlab function that does exactly what I want, even better (I ultimately want a new array, length D, which has the average of each of those bins as its values).

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting