How to Draw ErrorBar

本文介绍如何在Matlab中使用errorbar函数绘制带有误差棒的图表,包括不同情况下的输入参数设置,例如对称误差棒和非对称误差棒的绘制方法,并通过两个实例展示了具体的用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Origin : http://jingyan.baidu.com/article/636f38bb7079f4d6b84610f0.html

Matlab: http://blog.sina.com.cn/s/blog_66d362d70102v4i5.html

 

 


errorbar


Plot error bars along curve

 


GUI Alternatives


To graph selected variables, use the Plot Selector in the Workspace Browser, or use the Figure Palette Plot Catalog. Manipulate graphs in plot edit mode with the Property Editor. For details, see "Plotting Tools — Interactive Plotting" in the MATLAB Graphics documentation and "Creating Graphics from the Workspace Browser" in the MATLAB Desktop Tools documentation.
Syntax


errorbar(Y,E)
errorbar(X,Y,E)
errorbar(X,Y,L,U)
errorbar(...,LineSpec)
h = errorbar(...)

Description


Error bars show the confidence intervals of data or the deviation along a curve.

errorbar(Y,E) plots Y and draws an error bar at each element of Y. The error bar is a distance of E(i) above and below the curve so that each bar is symmetric and 2*E(i) long.

errorbar(X,Y,E) plots Y versus X with symmetric error bars 2*E(i) long. X, Y, E must be the same size. When they are vectors, each error bar is a distance of E(i) above and below the point defined by (X(i),Y(i)). When they are matrices, each error bar is a distance of E(i,j) above and below the point defined by (X(i,j),Y(i,j)).

errorbar(X,Y,L,U) plots X versus Y with error bars L(i)+U(i) long specifying the lower and upper error bars. X, Y, L, and U must be the same size. When they are vectors, each error bar is a distance of L(i) below and U(i) above the point defined by (X(i),Y(i)). When they are matrices, each error bar is a distance of L(i,j) below and U(i,j) above the point defined by (X(i,j),Y(i,j)).

errorbar(...,LineSpec) uses the color and line style specified by the string 'LineSpec'. The color is applied to the data line and error bars. The linestyle and marker are applied to the data line only. See linespec for examples of styles.

h = errorbar(...) returns handles to the errorbarseries objects created. errorbar creates one object for vector input arguments and one object per column for matrix input arguments. See errorbarseries properties for more information.

When the arguments are all matrices, errorbar draws one line per matrix column. If X and Y are vectors, they specify one curve.
Examples


Draw symmetric error bars that are two standard deviation units in length:
X = 0:pi/10:pi;
Y = sin(X);
E = std(Y)*ones(size(X));
errorbar(X,Y,E)

 


Plot the computed average traffic volume and computed standard deviations for three street locations over the course of a day using red 'x' markers:
load count.dat;
y = mean(count,2);
e = std(count,1,2);
figure
errorbar(y,e,'xr')

 

See Also


corrcoef, linespec, plot, std

Basic Plots and Graphs and ConfidenceBounds for related functions

Errorbarseries Properties for property descriptions
Was this topic helpful?

 


© 1984-2010 The MathWorks, Inc. • Terms of Use • Patents • Trademarks • Acknowledgments

转载于:https://www.cnblogs.com/dyl-HelloWorld/p/6614122.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值