1. 转自百度经验,原地址:https://jingyan.baidu.com/article/4f7d5712dd9e101a201927ec.html


  2. 这里介绍使用Matlab来对一系列数据进行直方图统计和展示。

    首先生成一列数据:

    aa = randn(1000,1);

    h = histogram(aa);

    对h进行统计,matlab自动给h进行分列。

    【转载】matlab histogram直方图设置
    【转载】matlab histogram直方图设置









    1. 可以指定柱状的数量:

    2. hh = histogram(aa,10);


  3. 【转载】matlab histogram直方图设置

  4. 【转载】matlab histogram直方图设置
  5. 还可以将几列数据同时画在一张图上:

    histogram(aa,30);

    aaa = 1+aa;

    hold on;

    histogram(aaa,30);

    【转载】matlab histogram直方图设置


  6. 还可以对横坐标的范围进行控制:

  7. hhh = histogram(aa,[-10:0.5:10]);







  8. 该绘图如要加入其他要素,与plot命令相同:

    title('直方图','fontsize',16);

    xlabel('数值');ylabel('number');

    legend('aa','aaa');

    【转载】matlab histogram直方图设置

相关文章:

  • 2021-11-01
  • 2021-06-11
  • 2022-01-15
  • 2021-11-26
  • 2021-04-15
  • 2022-01-18
  • 2021-08-03
猜你喜欢
  • 2022-02-19
  • 2022-12-23
  • 2022-01-09
  • 2021-12-27
  • 2021-04-05
  • 2021-08-14
  • 2022-12-23
相关资源
相似解决方案