octave-maintainers
[Top][All Lists]
Advanced

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

Re: hist.m differences from Matlab


From: Rik
Subject: Re: hist.m differences from Matlab
Date: Wed, 01 Dec 2010 10:02:15 -0800

>> So for non uniform bin spacing
>> - find max and min
>> - find point half way between each given point
>> - construct a group of ranges from the above
>> - count how many are in each of these non uniform ranges.
>> Does this look like something we should implement?
>> If yes I will work on it latter.
>> Doug
>  
> Yes, I think this should behave as ML does.
I believe Octave already does all of this correctly.  If I run
[a,b] = hist(y,x)

a =

   562    78    91    55   214

b =

   0.10000   0.20000   0.50000   0.70000   0.90000

which shows that it has the bin centers correct and the counts are mostly
correct as well.  Since randn is normally distributed I would expect about
half the results to be less than zero or about 500.  Because the first bin
center is at 0.1 rather than zero the count is slightly larger than 500.

It seems rather that the bar plot does not reproduce the Matlab plot
because Octave uses fixed width bars for the bins while Matlab uses bars
that correspond to the non-uniform bin width.

--Rik


reply via email to

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