如何在matlab中将 bin 中心转换为 bin 边?

 时间:2026-02-15 19:41:41

1、例如,指定 bin 中心以用于 hist。这些 bin 具有均匀的宽度。

命令行键入:

A = [-9 -6 -5 -2 0 1 3 3 4 7];

如何在matlab中将 bin 中心转换为 bin 边?

2、命令行键入:

centers = [-7.5 -2.5 2.5 7.5];

如何在matlab中将 bin 中心转换为 bin 边?

3、命令行键入:

hist(A,centers)

如何在matlab中将 bin 中心转换为 bin 边?

4、要将 bin 中心转换为 bin 边界,请计算 centers 中各连续值之间的中点。此方法会重现均匀和非均匀 bin宽度对应的 hist 结果。

命令行键入:

d = diff(centers)/2;

如何在matlab中将 bin 中心转换为 bin 边?

5、命令行键入:

edges = [centers(1)-d(1), centers(1:end-1)+d, centers(end)+d(end)];

如何在matlab中将 bin 中心转换为 bin 边?

6、hist 函数包括落入每个 bin 右边界上的值(第一个 bin 包含两个边界),而 histogram 包括落入每个bin 左边界上的值(最后一个 bin 包含两个边界)。稍微移动 bin 边界以获得与 hist 相同的 bin 计数。

命令行键入:

edges(2:end) = edges(2:end)+eps(edges(2:end))

如何在matlab中将 bin 中心转换为 bin 边?

7、现在,将 histogram 与 bin 边界结合使用。

命令行键入:

histogram(A,edges)

如何在matlab中将 bin 中心转换为 bin 边?

  • uki的默契pk在哪里
  • Keil uVision4 51单片机按键关灯效果编程
  • c语言32.switch(2)
  • 预防冠心病从青少年做起!
  • 数制转换的数学实验
  • 热门搜索
    蒸蛋怎么做好吃又嫩 北京物资学院怎么样 怎么去除狐臭 网络电视怎么安装 重庆大学城市科技学院怎么样 末影龙怎么打 莫比乌斯带怎么做 葫芦侠怎么用 打印机怎么换墨盒 怎么读英语单词