help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: histc in Octave?


From: Francesco Potorti`
Subject: Re: histc in Octave?
Date: Thu, 18 May 2006 10:35:31 +0200

>However, hist (x, (e(1:len-1)+e(2:len))/2), gives different results, 
>because even though the hist documentation says that it takes the second 
>vector as the center points, but I the actual behaviour is that for the 
>first bin it counts values from -inf to e(1), so then it doesn't 
>actually count values around the center point.

Not only that.  If the bins are or unequal lenghts, the results will be
different in the middle too.

>The function didn't work, it gave me all zeros :)

I had made a trivial error.  I wrote this:
>>     freq(i,:) = sum (y <= x(i) && y < x(i+1));
but I should have written this:
>>     freq(i,:) = sum (x(i) <= y && y < x(i+1));

>I figured the solution though to serve my purpose:

Yes, this does the same thing, but without profiting from vector math.
For long vectors, it will be much slower.

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 313 8091
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key


reply via email to

[Prev in Thread] Current Thread [Next in Thread]