function [x,ps] = creategauss(n)

% creategauss.m Sampling of a a standard normal distribution
%   [x,ps] = creategauss(n);
%   plot(x,ps,x, 1/sqrt(2*pi)*exp(-x.^2/2))

x = [-10:0.1:10]; % create x range
dx = x(2)-x(1);   % here 0.1, of course

r = randn(1,n);   % draw n random numbers
ps = hist(r,x);   % create histogram, centers given by x
ps = ps/sum(ps)*1/dx; % normalize

end

