% m-file: demo_2.m
%
% (C) PK, 08/11/2018;

clc; clear; close all;

N=2^14;
x=randn(N,1);
K=30;
[h,b]=hist(x,K); db=b(2)-b(1); P=sum(h)*db;
s=std(x); m=mean(x);
xx=m-3*s:6*s/100:m+3*s;
yy=normpdf(xx,0,1);
    figure(1);
        bar(b,h/P,1); grid on; hold on;
        plot(xx,yy,'r.-');

% EOF;