Highlights from 2D Histogram

4.38462
4.4 | 13 ratings Rate this file 21 Downloads (last 30 days) File Size: 1.4 KB File ID: #14205 Version: 1.0

2D Histogram

Murphy O'Brien (view profile)

09 Mar 2007 (Updated )

Calculates and draws the 3D histogram of 2 Dimensional input data

File Information
Description

function H = hist2d(D,Xn,Yn,[Xlo Xhi],[Ylo Yhi])

Calculates and draws the 3D histogram of 2 Dimensional input data D.

Counts number of points in the bins defined by
X = linspace(Xlo,Xhi,Xn) and
Y = linspace(Ylo,Yhi,Yn)

D must be a 2 column or 2 row matrix or an array of complex numbers

[Xlo Xhi],[Ylo Yhi] are optional and default to the min and max of
the input data
Xn and Yn are optional and default to 20

Example:
hist2d([randn(1,10000); randn(1,10000)])

Really just a copy of 2D Histogram, by Rey Patlolla, but with default arguments, optionally complex input and draws a 3D histogram.

Acknowledgements

2 Dimensional Histogram inspired this file.

This file inspired Create Contour and Fast 2 D Histogram Calculation.

MATLAB release MATLAB 7.2 (R2006a)
12 May 2015 Weijia Yang

Weijia Yang (view profile)

Really useful. Thank you!

07 Nov 2012 Liang

Liang (view profile)

31 May 2011 Jochem

Jochem (view profile)

03 Sep 2010 Juan Dominguez

Juan Dominguez (view profile)

Great function. Used it before discovering hist3.

28 Jun 2010 Thomas

Thomas (view profile)

This function works, but it is much slower than hist3 on large data sets. For instance, on two arrays of ~500,000 length, this function took ~30 s while hist3 took ~0.1 s.

15 Apr 2009 David

David (view profile)

A nice, easy-to-use function; though I've just discovered that the statistics toolbox has a function hist3 with this functionality.

Comment only
15 Apr 2009 David

David (view profile)

Simple and useful!

05 Sep 2008 Kamrul Hakim
01 Aug 2008 Reda Boufatah

very good demonstration using hist

18 Jul 2008 umair qureshi

fairly easy to understand and use !! hats off to u!!

07 Mar 2008 Brian Liswell

Easy to implement. Grinds out fairly quickly on my PC.
The responses for the 2D Histogram entry say stuff about bugs - any clue what those are?

Know of any way to make a rectangular topped surface instead of angular surf?