Given a data matrix data of M dimensions and N samples, say,
data = randn(N, M);
I could compute the covariance matrix with
data_mu = data - ones(N, 1)*mean(data);
cov_matrix = (data_mu'*data_mu)./N
If I use the native MATLAB function
cov_matrix2 = cov(data)
this will always be equal to
cov_matrix = (data_mu'*data_mu)./(N-1)
That is, the denominator is (N - 1) is one less.
Why?? Can you reproduce it? Is this a bug??
I use MATLAB version 7.6.0.324 (2008).