<?xml version="1.0" encoding="UTF-8"?>
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="errbar">
    <refnamediv>
        <refname>errbar</refname>
        <refpurpose>ajoute des barres d'erreur sur un dessin 2D  </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Séquence d'appel</title>
        <synopsis>errbar(x,y,em,ep)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Paramètres</title>
        <variablelist>
            <varlistentry>
                <term>x,y,em,ep  </term>
                <listitem>
                    <para>4 matrices de même taille.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>errbar</literal> ajoute des barres d'erreur sur un dessin 2D.
            <literal>x</literal> et <literal>y</literal> ont la même signification que dans <literal>plot2d</literal>.
            <literal>em(i,j)</literal> et <literal>ep(i,j)</literal> représentent l'intervalle d'erreur autour de la valeur
            <literal>y(i,j)</literal> : <literal>[y(i,j)-em(i,j),y(i,j)+ep(i,j)]</literal>.
        </para>
        <para>
            Taper <literal>errbar()</literal> pour voir une démonstration de la fonction.
        </para>
    </refsection>
    <refsection>
        <title>Exemples</title>
        <programlisting role="example"><![CDATA[
        // 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);
        ]]></programlisting>
        <scilab:image><![CDATA[
        // 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);
        ]]></scilab:image>
    </refsection>
    <refsection role="see also">
        <title>Voir aussi</title>
        <simplelist type="inline">
            <member>
                <link linkend="plot2d">plot2d</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
