[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hist.m differences from Matlab
From: |
Doug Stewart |
Subject: |
Re: hist.m differences from Matlab |
Date: |
Wed, 1 Dec 2010 17:08:09 -0500 |
On Wed, Dec 1, 2010 at 1:02 PM, Rik <address@hidden> wrote:
>>> 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
>
Good point Rik
I was out all afternoon so haven't looked at it yet.
Doug