errorfill

版本 1.0.0.0 (3.3 KB) 作者: Peder Axensten
Use this function to draw a curve and its areas of confidence.
3.9K 次下载
更新时间 2006/4/26

查看许可证

Usage: figurehandle= errorfill(x, y, E1, E2, ..., LineSpec)

Use this function to draw a curve and its areas of confidence. Draws the line y(x), then draws the areas E1(x), E2(x), ... (Well actually it's done in the opposite order, to minimize overlap.)

x:
The x values for y, E1, E2, ...
If x is a scalar, then (x, x+1, x+2, ...) is used.
If x is empty, then (1, 2, ...) is used.
Values must be finite and not NaN.

y:
Defines the curve, y(x).
Values must be finite and not NaN.

E:
The 'error' of y. Defines the area.
If E is a scalar, the shade will be between y(n)*(1+E) and y(n)*(1-E).
If E is of size (1,2) or (2,1), it will be between y(n)*(1+E(1)) and y(n)*(1-E(2)).
If E is a vector, the shade will be between y(n)+E(n) and y(n)-E(n).
If E is a double vector, the shade will be between y(n)+E(1,n) and y(n)-E(2,n).
Inf is marked by a jump up to a '^' symbol.
-Inf is marked by a jump down to a 'v' symbol.
NaN is marked by a jump up or down to a '*' symbol.

LineSpec:
(Default: 'k') Line specification for y(x), e.g. 'b+'.

NOTE:
The E:s must be given in increasing size, or an area will be covered by a previous and larger area.

COMPATIBILITY:
errorbar(x, y, E, LineSpec) corresponds to errorfill(x, y, E, LineSpec).
errorbar(x, y, L, U, LineSpec) corresponds to errorfill(x, y, [U; L], LineSpec).

EXAMPLE:
x= (1:0.25:10);
y= x.^2;
E3= [ones(1, length(x))*30; 0.7*y]; % 30 above and 0.3*y below
E3(1,7)= Inf;
E3(2,10)= Inf;
E3(2,25)= NaN;
errorfill(x, y, [0.1 0.02], 0.3, E3, 'b-+');
legend('E3', 'E2', 'E1', 'x^2','Inf','-Inf','NaN');

TO DO:
Make it work for y-values of Inf, -Inf, and NaN.

引用格式

Peder Axensten (2024). errorfill (https://www.mathworks.com/matlabcentral/fileexchange/10843-errorfill), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R14SP1
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Line Plots 的更多信息
致谢

参考作品: confplot, JackKnife

启发作品: errorshade, boundedline.m

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0