annotate toolboxes/FullBNT-1.0.7/netlab3.3/histp.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function h = histp(x, xmin, xmax, nbins)
Daniel@0 2 %HISTP Histogram estimate of 1-dimensional probability distribution.
Daniel@0 3 %
Daniel@0 4 % Description
Daniel@0 5 %
Daniel@0 6 % HISTP(X, XMIN, XMAX, NBINS) takes a column vector X of data values
Daniel@0 7 % and generates a normalized histogram plot of the distribution. The
Daniel@0 8 % histogram has NBINS bins lying in the range XMIN to XMAX.
Daniel@0 9 %
Daniel@0 10 % H = HISTP(...) returns a vector of patch handles.
Daniel@0 11 %
Daniel@0 12 % See also
Daniel@0 13 % DEMGAUSS
Daniel@0 14 %
Daniel@0 15
Daniel@0 16 % Copyright (c) Ian T Nabney (1996-2001)
Daniel@0 17
Daniel@0 18 ndata = length(x);
Daniel@0 19
Daniel@0 20 bins = linspace(xmin, xmax, nbins);
Daniel@0 21
Daniel@0 22 binwidth = (xmax - xmin)/nbins;
Daniel@0 23
Daniel@0 24 num = hist(x, bins);
Daniel@0 25
Daniel@0 26 num = num/(ndata*binwidth);
Daniel@0 27
Daniel@0 28 h = bar(bins, num, 0.6);
Daniel@0 29