%% Create Histogram Plot
% Initialize the random number generator to make the output of |randn|
% repeatable. 

% Copyright 2015 The MathWorks, Inc.

rng(0,'twister') 

%%
% Define |x| as 100 normally distributed random numbers. Define
% bin ranges between -4 and 4. Determine the number of
% values in |x| that are within each specified bin range. Return the number
% of elements in each bin in |bincounts|.
x = randn(100,1);
binranges = -4:4;
[bincounts] = histc(x,binranges)

%% 
% To plot the histogram, use the |bar| function.
figure
bar(binranges,bincounts,'histc')
