Skip to Main Content Skip to Search
Product Documentation

histfit - Histogram with normal fit

Syntax

histfit(data)
histfit(data,nbins)
histfit(data,nbins,dist)
h = histfit(...)

Description

histfit(data) plots a histogram of the values in the vector data using the number of bins equal to the square root of the number of elements in data, then superimposes a fitted normal distribution.

histfit(data,nbins) uses nbins bins for the histogram.

histfit(data,nbins,dist) plots a histogram with a density from the distribution specified by dist, one of the following strings:

h = histfit(...) returns a vector of handles h, where h(1) is the handle to the histogram and h(2) is the handle to the normal curve.

Examples

r = normrnd(10,1,100,1);
histfit(r)
h = get(gca,'Children');
set(h(2),'FaceColor',[.8 .8 1])

See Also

hist | normfit

  


 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS