Wrong mean calculation

Hello
I notice that when Matlab calculates the Standard deviation of a vector with the exact same values it doesn't returns 0! For example: Vector=ones(100,1)./3; Average=mean(Vector); STDEV=std(Vector);
Moreover if you divide the Vector by say 3456 The average is also wrong (i.e different than any value in the vector)
Thanks in advance itay

답변 (2개)

David Young
David Young 2011년 11월 21일

0 개 추천

It's a rounding error. See this FAQ.
Jan
Jan 2011년 11월 21일

0 개 추천

No, the calculated values are not wrong.
Calculations with doubles are performed with a limited number of digits. Therefore some rounding effects will occur. See FAQ 6.1

카테고리

도움말 센터File Exchange에서 Analysis of Variance and Covariance에 대해 자세히 알아보기

질문:

2011년 11월 21일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by