I know that matlab hist "Input values that fall on the border between two bins are placed into the lower valued bin; that is, each bin includes its upper boundary."

http://www.mathworks.com/help/dsp/ref/histogram.html

Is it possible to change it so that input values that fall in the lower bound will be included in the bin? that is, that each bin will include its lower boundary?

有帮助吗?

解决方案

Your documentation refers to the function hist() which bins according to lb < x ≤ ub. Internally, this function calls histc() which however bins according to lb ≤ x < ub. In brief, hist() adds eps(ub), i.e. some margin, to the the upper bounds.

You can simply call histc() and then plot with bar(), follows an example:

c = histc(1:0.1:2,[1,2])
bar(c)

you can see that the 2 falls in the second bin, since the bins determined by the edges are [1,2) and [2,2).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top