annotate 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
rev   line source
wolffd@0 1 function h = histp(x, xmin, xmax, nbins)
wolffd@0 2 %HISTP Histogram estimate of 1-dimensional probability distribution.
wolffd@0 3 %
wolffd@0 4 % Description
wolffd@0 5 %
wolffd@0 6 % HISTP(X, XMIN, XMAX, NBINS) takes a column vector X of data values
wolffd@0 7 % and generates a normalized histogram plot of the distribution. The
wolffd@0 8 % histogram has NBINS bins lying in the range XMIN to XMAX.
wolffd@0 9 %
wolffd@0 10 % H = HISTP(...) returns a vector of patch handles.
wolffd@0 11 %
wolffd@0 12 % See also
wolffd@0 13 % DEMGAUSS
wolffd@0 14 %
wolffd@0 15
wolffd@0 16 % Copyright (c) Ian T Nabney (1996-2001)
wolffd@0 17
wolffd@0 18 ndata = length(x);
wolffd@0 19
wolffd@0 20 bins = linspace(xmin, xmax, nbins);
wolffd@0 21
wolffd@0 22 binwidth = (xmax - xmin)/nbins;
wolffd@0 23
wolffd@0 24 num = hist(x, bins);
wolffd@0 25
wolffd@0 26 num = num/(ndata*binwidth);
wolffd@0 27
wolffd@0 28 h = bar(bins, num, 0.6);
wolffd@0 29