diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolboxes/FullBNT-1.0.7/netlab3.3/histp.m	Fri Aug 19 13:07:06 2016 +0200
@@ -0,0 +1,29 @@
+function h = histp(x, xmin, xmax, nbins)
+%HISTP	Histogram estimate of 1-dimensional probability distribution.
+%
+%	Description
+%
+%	HISTP(X, XMIN, XMAX, NBINS) takes a column vector X  of data values
+%	and generates a normalized histogram plot of the  distribution. The
+%	histogram has NBINS bins lying in the range XMIN to XMAX.
+%
+%	H = HISTP(...) returns a vector of patch handles.
+%
+%	See also
+%	DEMGAUSS
+%
+
+%	Copyright (c) Ian T Nabney (1996-2001)
+
+ndata = length(x);
+
+bins = linspace(xmin, xmax, nbins);
+
+binwidth = (xmax - xmin)/nbins;
+
+num = hist(x, bins);
+
+num = num/(ndata*binwidth);
+
+h = bar(bins, num, 0.6);
+