I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index »

How to call Stdev for buckets within a long array

Peter10003\′s Photo
17 Nov 11, 6:48PM
(1 reply)
How to call Stdev for buckets within a long array
I have an array of (say) 2,000 numbers,

double x[2000]={0.123, 0.2144,-9.11, ... , -0.163];

and I want to break them into buckets of 100 numbers, thus 20 buckets.

How can I invoke the Stdev routine in Objective C, so I get 20 standard deviations.

Let's also say I have a startIndex[20] that has the beginnings of each bucket, e.g. 0, 100, 200, etc. I have this, since my bucket size changes, but in this simple case: startIndex[0] = 0, startIndex[1] =100, ...,startIndex[99]=1900

Is it this?:

double stdevBucket[20];

for (int i; i<20;i++)

stdevBucket[i]=[stdev Stdev : 100 dataX:x[startIndex[i]];
CodeCogs\′s Photo
18 Nov 11, 5:04PM
You're almost right (unless Objective C has a notation I'm not used to), so try
double stdevBucket[20];
  for(int i=0; i<20; i++)
    stdevBucket[i]= stdev(100, &dataX[i*20]);
Currently you need to be logged in to leave a message.