Daniel@0: function h = histp(x, xmin, xmax, nbins) Daniel@0: %HISTP Histogram estimate of 1-dimensional probability distribution. Daniel@0: % Daniel@0: % Description Daniel@0: % Daniel@0: % HISTP(X, XMIN, XMAX, NBINS) takes a column vector X of data values Daniel@0: % and generates a normalized histogram plot of the distribution. The Daniel@0: % histogram has NBINS bins lying in the range XMIN to XMAX. Daniel@0: % Daniel@0: % H = HISTP(...) returns a vector of patch handles. Daniel@0: % Daniel@0: % See also Daniel@0: % DEMGAUSS Daniel@0: % Daniel@0: Daniel@0: % Copyright (c) Ian T Nabney (1996-2001) Daniel@0: Daniel@0: ndata = length(x); Daniel@0: Daniel@0: bins = linspace(xmin, xmax, nbins); Daniel@0: Daniel@0: binwidth = (xmax - xmin)/nbins; Daniel@0: Daniel@0: num = hist(x, bins); Daniel@0: Daniel@0: num = num/(ndata*binwidth); Daniel@0: Daniel@0: h = bar(bins, num, 0.6); Daniel@0: