www.gusucode.com > stats 源码程序 matlab案例代码 > stats/HistogramforaGivenNumberofBinsExample.m

    %% Histogram for a Given Number of Bins  

% Copyright 2015 The MathWorks, Inc.


%% 
% Generate a sample of size 100 from a normal distribution with mean 10
% and variance 1. 
rng default; % For reproducibility
r = normrnd(10,1,100,1);  

%% 
% Construct a histogram using six bins with a normal distribution fit. 
histfit(r,6)