Tuesday, July 14, 2009

I need c++ functions to calculate the mean and standard deviation of some numbers?

can anybody help me.

I need c++ functions to calculate the mean and standard deviation of some numbers?
void mean_stddeviation(float d[ ],float%26amp; mean, float%26amp; std_dev)


{


int l = length(d);


mean =0;


for (int i =0; i%26lt;l;i++)


mean +=d(i);


mean /= l;


for (i=0;i%26lt;l;i++)


std_dev += (d(i) - mean )*(d(i)-mean);


std_dev /= l;


std_dev = sqrt(std_dev);


}


No comments:

Post a Comment