public static float StDev(float[] arrData) //计算标准偏差
{
float xSum = 0F;
float xAvg = 0F;
float sSum = 0F;
float tmpStDev = 0F;
int arrNum = arrData.Length;
for (int i = 0; i < arrNum; i++)
{
xSum += arrData[i];
}
xAvg = xSum / arrNum;
for (int j = 0; j < arrNum; j++)
{
sSum += ((arrData[j] - xAvg) * (arrData[j] - xAvg));
}
tmpStDev = Convert.ToSingle(Math.Sqrt((sSum / (arrNum - 1))).ToString());
return tmpStDev;
}