math question
Jul. 14th, 2005 10:03 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
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).
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).