comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Problems with 'HISTOGRAM'
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Problems with 'HISTOGRAM' [message #15811] Fri, 11 June 1999 00:00
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Martin Vissers wrote:
>
> Dear newsreaders
>
> I have a problem with the IDL fuction histogram.
> I'm running IDL 5.0.3a on windows NT4.0 (sp5)
>
> If I make the following histogram:
>
> aa=histogram(dindgen(330)-180.0d,min=-180.0d,max=180.0d,bins ize=10.0d)
>
> the array aa has 37 elements:
> AA LONG = Array[37]
>
> but it should have 36 elements ??????
>

NO! 37 is correct. You get a bin left of your data and a bin to the
right of your data. Or, a little more formal: The online help gives the
formula of the histogram function, and the key statement is that v
(which is your bin number) is
v = 0,1,2, ... (MAX-MIN)/BINSIZE
Plug in your numbers and you get
v = 0,1,2, ... ,36
which makes 37 elements.

Regards,
Martin


--

|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
Re: Problems with 'HISTOGRAM' [message #15814 is a reply to message #15811] Fri, 11 June 1999 00:00 Go to previous message
mchinand is currently offline  mchinand
Messages: 66
Registered: September 1996
Member
In article <376107F3.DA94ABC5@users.whh.wau.nl>,
Martin Vissers <martin.vissers@users.whh.wau.nl> wrote:
> Dear newsreaders
>
> I have a problem with the IDL fuction histogram.
> I'm running IDL 5.0.3a on windows NT4.0 (sp5)
>
> If I make the following histogram:
>
> aa=histogram(dindgen(330)-180.0d,min=-180.0d,max=180.0d,bins ize=10.0d)
>
> the array aa has 37 elements:
> AA LONG = Array[37]
>
> but it should have 36 elements ??????
>

There are 361 numbers between -180 and 180, inclusive. So 361/binsize=
36.1 which gets rounded up to 37.

--Mike

--
--
Michael Chinander University of Chicago
m-chinander@uchicago.edu (773)702-1446 (Voice) (773)702-0371 (Fax)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Vertical surfaces
Next Topic: Re: Map Projections and Contour Plots.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 06:08:45 PDT 2025

Total time taken to generate the page: 0.56330 seconds