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

Home » Public Forums » archive » Re: HISTOGRAM, binsize, and max
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: HISTOGRAM, binsize, and max [message #76104 is a reply to message #76097] Wed, 18 May 2011 08:22 Go to previous messageGo to previous message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On May 18, 10:23 am, David Fanning <n...@idlcoyote.com> wrote:
> andry writes:
>> Can  somebody explain why the following gives different number of
>> elements with the HISTOGRAM function?
>
>> IDL> hist_spd= HISTOGRAM(velocity[indb],binsize= .20,min=0.,max=1.40)
>> IDL> print,hist_spd
>>            6          16          23           0           0
>> 0           0
>> IDL> hist_spd= HISTOGRAM(velocity[indb],binsize= 20.,min=0.,max=140.)
>> IDL> print,hist_spd
>>           45           0           0           0           0
>> 0           0           0
>
>> (whatever velocity content is)
>> My main concern is the number of elements returned by the function.
>> The only difference between the 2 command is that I multiplied the
>> binsize and max with 100. BUT they return 7 and 8 elements?
>
>> I would expect they both return the same number of elements.
>
> People expect a lot of things from computers, but the
> computers don't always oblige. I think this is just the normal
> weirdness with how computers represent numbers. It
> turns out this is different from how humans apparently
> do it. :-)
>
>   http://www.idlcoyote.com/math_tips/sky_is_falling.html
>   http://www.idlcoyote.com/math_tips/razoredge.html


When I try that I always get 8 bins no matter what.
I don't see how you could get 7 bins in that situation...

IDL> hist_spd= HISTOGRAM(randomn(seed,10)*200,binsize= .
20,min=0.,max=1.40) & help,hist_spd
HIST_SPD LONG = Array[8]

IDL> hist_spd= HISTOGRAM(randomn(seed,10)*200,binsize=
20.0,min=0.,max=140.0) & help,hist_spd
HIST_SPD LONG = Array[8]


Ciao,
Paolo






>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: histogram produces extra bin in 64-bit IDL 8.0
Next Topic: Reducing the number of vertices in an isosurface...

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

Current Time: Wed Oct 08 18:08:01 PDT 2025

Total time taken to generate the page: 0.00479 seconds