errorfill

Use this function to draw a curve and its areas of confidence.
3,9K téléchargements
Mise à jour 26 avr. 2006

Afficher la licence

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.

Citation pour cette source

Peder Axensten (2024). errorfill (https://www.mathworks.com/matlabcentral/fileexchange/10843-errorfill), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R14SP1
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Line Plots dans Help Center et MATLAB Answers
Remerciements

Inspiré par : confplot, JackKnife

A inspiré : errorshade, boundedline.m

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0