Re: Problems with 'HISTOGRAM' [message #15811] |
Fri, 11 June 1999 00:00 |
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  |
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)
|
|
|