[Math] Standard deviation for Gaussian distribution in Matlab

MATLABstatistics

I have a number of test data (400 samples) that are distributed according to the Gaussian distribution, N(0,sigma). Is there a simple way of calculating the sample standard deviation sigma for these in Matlab? I have used the std function but I'm not sure whether it's correct, since I cannot see any assumptions on distribution in the matlab help except that it's identical.

Best Answer

The std command in Matlab does not assume uniformly distributed samples. The command std(x) is simply calculating the quantity $$ \hat{\sigma}=\sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar{x})^2} $$ with $\bar{x}=\sum\limits_{i=1}^nx_i$ for a vector x of length $n$. You can easily calculate this quantity by hand and compare with the std command.