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/
|
|
|