Code covered by the BSD License

### Highlights from errorfill

4.0
4.0 | 1 rating Rate this file 17 Downloads (last 30 days) File Size: 3.26 KB File ID: #10843 Version: 1.0

# errorfill

### Peder Axensten (view profile)

23 Apr 2006 (Updated )

Use this function to draw a curve and its areas of confidence.

File Information
Description

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.

Acknowledgements

Confplot and Jack Knife inspired this file.

This file inspired Boundedline.M and Errorshade.

MATLAB release MATLAB 7.0.1 (R14SP1)