Why does numpy std() give a different result to matlab std()?
问题 I try to convert matlab code to numpy and figured out that numpy has a different result with the std function. in matlab std([1,3,4,6]) ans = 2.0817 in numpy np.std([1,3,4,6]) 1.8027756377319946 Is this normal? And how should I handle this? 回答1: The NumPy function np.std takes an optional parameter ddof : "Delta Degrees of Freedom". By default, this is 0 . Set it to 1 to get the MATLAB result: >>> np.std([1,3,4,6], ddof=1) 2.0816659994661326 To add a little more context, in the calculation of