<?xml version="1.0" encoding="UTF-8"?>

<!--

 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab

 * Copyright (C) ENPC - Jean-Philippe Chancelier

 *


 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.

 *

 -->

<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="ja" xml:id="errbar">

    <refnamediv>

        <refname>errbar</refname>

        <refpurpose>2次元プロットに垂直誤差バーを追加</refpurpose>

    </refnamediv>

    <refsynopsisdiv>

        <title>呼び出し手順</title>

        <synopsis>errbar(x,y,em,ep)</synopsis>

    </refsynopsisdiv>

    <refsection>

        <title>引数</title>

        <variablelist>

            <varlistentry>

                <term>x,y,em,ep</term>

                <listitem>

                    <para>同じ大きさの行列.</para>

                </listitem>

            </varlistentry>

        </variablelist>

    </refsection>

    <refsection>

        <title>説明</title>

        <para>

            <literal>errbar</literal> は二次元プロットに垂直誤差バーを追加します.

            <literal>x</literal>および <literal>y</literal> の意味は<literal>plot2d</literal>

            におけるものと同じです.

            <literal>em(i,j)</literal> と <literal>ep(i,j)</literal> は

            値<literal>y(i,j)</literal>の誤差間隔を意味します:

            <literal>[y(i,j)-em(i,j),y(i,j)+ep(i,j)]</literal>.

        </para>

        <para>

            デモを参照するには, コマンド <literal>errbar()</literal> を入力してください.

        </para>

    </refsection>

    <refsection>

        <title>例</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>参照</title>

        <simplelist type="inline">

            <member>

                <link linkend="plot2d">plot2d</link>

            </member>

        </simplelist>

    </refsection>

</refentry>
