如何在matlab中画带有误差条的条形图

手把手教学。

工具/原料

  • matlab
  • 电脑

方式/步骤

  1. 1

    连系利用 bar 和 errorbar 函数建立带有误差条的条形图。

    号令行键入:

    x = 1:13;

    506d92f1d8a72633bb3c1051c02c56ee7a7f440f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  2. 2

    号令行键入:

    data = [37.6 24.5 14.6 18.1 19.5 8.1 28.5 7.9 3.3 4.1 7.9 1.9 4.3]';

    a48bc2e8904800fc514e45bcd42043715edb930f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  3. 3

    号令行键入:

    errhigh = [2.1 4.4 0.4 3.3 2.5 0.4 1.6 0.8 0.6 0.8 2.2 0.9 1.5];

    db196cdade49610feeef70b6a56817e950e1d20f.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  4. 4

    号令行键入:

    errlow = [4.4 2.4 2.3 0.5 1.6 1.5 4.5 1.5 0.4 1.2 1.3 0.8 1.9];

    023cff37c97622bcf27c12d5a05fd5460496280c.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  5. 5

    号令行键入:

    bar(x,data)

    75af02324b18512c7c480515ad334884cce3490c.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  6. 6

    号令行键入:

    hold on

  7. 7

    号令行键入:

    er = errorbar(x,data,errlow,errhigh);

    e57a258602214f5755ec8e09732064fb970b730d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  8. 8

    号令行键入:

    er.Color = [0 0 0];

    fdb4f00d3aceaad78dd1d150eee7340f6578b80d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  9. 9

    号令行键入:

    er.LineStyle = 'none';

    40d2d0e8b004541bc0b42f94869a310e1699a60d.jpg?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_500
  10. 10

    号令行键入:

    hold off

  • 发表于 2020-04-09 17:01
  • 阅读 ( 368 )
  • 分类:其他类型

相关问题

0 条评论

请先 登录 后评论