差异直方图 Excel/Matlab

发布于 2025-01-04 01:15:01 字数 865 浏览 1 评论 0原文

我试图找出在Matlab上制作的直方图(使用函数“hist”和“histc”)与在excel2007上制作的直方图之间的差异。

以下是我的数据:

92.75408677
94.30203471
39.29203084
39.69600648
169.599791
47.69892422
55.70547521
45.68462703
47.87167045
40.44786332
166.2861124
113.4816594
100.4448781
47.82555238

我使用以下箱

0
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180

以下是不同频率的结果使用不同的软件和不同的功能:

bins    Histc-Matlab    Excel   Hist-Matlab
    0   0   0   0
    10  0   0   0
    20  0   0   0
    30  2   0   0
    40  5   2   3
    50  1   5   4
    60  0   1   1
    70  0   0   0
    80  0   0   0
    90  2   0   2
    100 1   2   1
    110 1   1   1
    120 0   1   0
    130 0   0   0
    140 0   0   0
    150 0   0   0
    160 2   0   0
    170 0   2   2
    180 0   0   0

我很困惑为什么它们都不同?

干杯?

I'm trying to figure out the difference between histograms made on Matlab (using the function 'hist' and 'histc" and one made on excel2007.

The following is my data:

92.75408677
94.30203471
39.29203084
39.69600648
169.599791
47.69892422
55.70547521
45.68462703
47.87167045
40.44786332
166.2861124
113.4816594
100.4448781
47.82555238

I use the following bins

0
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180

Here are the results of the different frequencies using the different softwares and different functions:

bins    Histc-Matlab    Excel   Hist-Matlab
    0   0   0   0
    10  0   0   0
    20  0   0   0
    30  2   0   0
    40  5   2   3
    50  1   5   4
    60  0   1   1
    70  0   0   0
    80  0   0   0
    90  2   0   2
    100 1   2   1
    110 1   1   1
    120 0   1   0
    130 0   0   0
    140 0   0   0
    150 0   0   0
    160 2   0   0
    170 0   2   2
    180 0   0   0

I'm confused why are they all different? Can anyone explain me that?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愁以何悠 2025-01-11 01:15:01

仅来自手册的信息:

n = hist(Y,x),其中 x 是向量,返回 Y 在 length(x) 个 bin 中的分布,中心由 x 指定

n = histc(x,edges) 计算向量 x 中落在边向量中的元素之间的值的数量(必须包含单调非递减值)。 n 是包含这些计数的长度(边)向量。 如果edges(k) <= x(i) n(k)计算值x(i)边(k+1)。最后一个 bin 计算与边(结束)匹配的 x 的任何值。

Excel 计算每个数据箱中数据点的数量。如果数字大于数据箱的最低界限且等于或小于数据箱的较大界限,则数据点包含在特定数据箱中。

Just info from manuals:

n = hist(Y,x) where x is a vector, returns the distribution of Y among length(x) bins with centers specified by x.

n = histc(x,edges) counts the number of values in vector x that fall between the elements in the edges vector (which must contain monotonically non-decreasing values). n is a length(edges) vector containing these counts. n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1). The last bin counts any values of x that match edges(end).

Excel counts the number of data points in each data bin. A data point is included in a particular data bin if the number is greater than the lowest bound and equal to or less than the greater bound for the data bin.

海拔太高太耀眼 2025-01-11 01:15:01

看起来 hist 使 bin 集中在您制作的边缘的中心,例如:35-45,有以下数字:39.29、39.69 和 40.44,因此它标记为 (3),而 histc 使用您创建的确切边缘告诉函数要使用,所以 30-40 标记为 (2),最后,excel 使用与 histc 相同的值,但提前翻译了 1 个位置。

It seems that hist makes the bins centered on the center of the edges you make, like: 35-45, there are the following numbers: 39.29, 39.69 and 40.44, so it marks (3), while the histc uses the exact edges you tell the function to use, so 30-40 it marks (2), and, finally, excel uses same as histc, but translated 1 position ahead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文