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