N = 1e4;  %number of  data points
M = 1000; % given mean value
data = M + randn(N,1, 'double');
% data = M+randn(N,1, 'single');

mean0 = mean(data)
mean1 = sum(data)/N
var0 = var(data,1)
var1 = mean(data.^2) - mean1.^2
var2 = sum((data-mean1).^2)/N
DifferenceVar = [var1-var0, var2-var0]
