Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.0.0 - English


errbar

add vertical error bars on a 2D plot

Syntax

errbar(x, y, em, ep)

Arguments

x, y, em, ep

four matrices of the same size.

Description

errbar adds vertical error bars on a 2D plot. x and y have the same meaning as in plot2d.

em(i,j) and ep(i,j) stands for the error interval on the value y(i,j): [y(i,j)-em(i,j),y(i,j)+ep(i,j)].

Enter the command errbar() to see a demo.

Examples

// low resolution sinus
x1 = linspace(0, 2*%pi, 10);
y1 = sin(x1);
plot(x1, y1, 'b');

// high resolution sinus
x2 = linspace(0, 2*%pi, 100);
y2 = sin(x2);
plot(x2, y2, 'g');

// display the error between a linear interpolation and x2
x_err = x1(2:$-1);
y_err = y1(2:$-1);
err = y2 - linear_interpn(x2, x1, y1, "periodic");
err_m = zeros(y_err);
err_p = zeros(y_err);
for i = 2:size(x1,'c')-1
    err_m(i-1) = sum(abs(err(x1(i-1) <= x2 & x2 < x1(i)  )));
    err_p(i-1) = sum(abs(err(x1(i)   <= x2 & x2 < x1(i+1))));
end
errbar(x_err, y_err, err_m, err_p);

See also

Report an issue
<< cutaxes 2d_plot fchamp >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Oct 24 14:30:04 CEST 2023