comparison toolboxes/FullBNT-1.0.7/netlab3.3/histp.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function h = histp(x, xmin, xmax, nbins)
2 %HISTP Histogram estimate of 1-dimensional probability distribution.
3 %
4 % Description
5 %
6 % HISTP(X, XMIN, XMAX, NBINS) takes a column vector X of data values
7 % and generates a normalized histogram plot of the distribution. The
8 % histogram has NBINS bins lying in the range XMIN to XMAX.
9 %
10 % H = HISTP(...) returns a vector of patch handles.
11 %
12 % See also
13 % DEMGAUSS
14 %
15
16 % Copyright (c) Ian T Nabney (1996-2001)
17
18 ndata = length(x);
19
20 bins = linspace(xmin, xmax, nbins);
21
22 binwidth = (xmax - xmin)/nbins;
23
24 num = hist(x, bins);
25
26 num = num/(ndata*binwidth);
27
28 h = bar(bins, num, 0.6);
29