% generazione di variabili gaussiane
% applicazione del teorema del Limite Centrale

clear;
figure(1);
clf;
n=10000;
m=12;
a=rand(m,n);
yg=(sum(a)-m/2)./(sqrt(m/12));
nbin=50;
b=5;
dx=2*b/nbin;
xgr=-b-dx/2:dx:b+dx/2;
nc=histc(yg,xgr)/(n*dx);
bar(xgr,nc)
y=(1/sqrt(2*pi))*exp(-((xgr+dx/2).^2)/2);
hold on
plot(xgr,y,'-r')
hold off








