Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I could not figure out why I get the wrong mean and how I can get the std.
标准差是方差的平方根。首先,您需要样本集 X 的平均值(平均值),
mean = u = sum( X[0] .. x[n-1] ) / n
方差是每个样本 X(i) 与均值 u 之间差异平方的平均值,
variance = sum( (x[0]-u)^2 .. (x[n-1]-u)^2 ) / n
标准差(std)是方差的平方根,
std = sqrt( variance );
但是你最后计算了标准偏差。除非您的意思是“bins”与计算每个 counts[] 存储桶的 stddev 有关吗?