Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

centrallimittheorem.octave

View Central Limit Theorem Demo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
%Uniform distribution
x1 = randi(10,1000,1);
[n1 xout1] = hist(x1);
 
%Sum of uniform distribution
x2 = sum(randi(10,1000,12),2);
m = mean(x2);
s = std(x2);
[n2 xout2] = hist(x2);
 
%Plot figures
figure
bar(xout1,n1/1000)
export_fig('H:/matlab/histuniform.png')
 
figure
hold on
bar(xout2,n2/1000)
xs = 30:100
plot(xs,6*normpdf(xs,m,s),'r','LineWidth',2)
export_fig('H:/matlab/histnormal.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.