<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://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="en" xml:id="fchamp">
    <refnamediv>
        <refname>fchamp</refname>
        <refpurpose>
            direction field of a 2D first order ODE
        </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
            fchamp(f, t, xr, yr, [arfact, rect, strf])
            fchamp(f, t, xr, yr, &lt;opt_args&gt;)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>f</term>
                <listitem>
                    <para>
                        an external (function or character string) or a list
                        which describes the ODE.
                    </para>
                    <variablelist>
                        <varlistentry>
                            <term>-</term>
                            <listitem>
                                <para>
                                    It can be a function name <varname>f</varname>,
                                    where <varname>f</varname> is supposed to be
                                    a function of type <literal>y=f(t, xy, [p1, ..., pn])</literal>.
                                    <varname>f</varname> returns a column vector
                                    of size 2, <varname>y</varname>, which gives
                                    the value of the direction field <varname>f</varname>
                                    at point <literal>xy=[x,y]</literal> and at
                                    time <varname>t</varname>.
                                </para>
                            </listitem>
                        </varlistentry>
                        <varlistentry>
                            <term>-</term>
                            <listitem>
                                <para>
                                    It can also be an object of type list,
                                    <literal>list(f,P1, ..., Pn)</literal> where
                                    <literal>f</literal> is a function of type
                                    <literal>y=f(t, xy, p1, ..., pn)</literal>
                                    and <literal>Pi</literal> gives the value of
                                    the parameter <literal>pi</literal>.
                                </para>
                            </listitem>
                        </varlistentry>
                    </variablelist>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>t</term>
                <listitem>
                    <para>the selected time.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>xr, yr</term>
                <listitem>
                    <para>
                        two row vectors of size <literal>n1</literal> and
                        <literal>n2</literal> which define the grid on
                        which the direction field is computed.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>&lt;opt_args&gt;</term>
                <listitem>
                    <para>
                        This represents a sequence of statements
                        <literal>key1=value1, key2=value2</literal>,...
                        where <literal>key1</literal>, <literal>key2</literal>,...
                        can be one of the following: <literal>arfact</literal>,
                        <literal>rect</literal>, <literal>strf</literal> (see
                        below).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>arfact, rect, strf</term>
                <listitem>
                    <para>
                        Optional arguments, see <function>champ</function>.
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <function>fchamp</function> is used to draw the direction field of a
            2D first order ODE defined by the external function
            <varname>f</varname>.
            <note>
                Note that if the ODE is autonomous, argument
                <varname>t</varname> is useless, but it must be given.
            </note>
        </para>
        <para>
            Enter the command <code>fchamp()</code> to see a demo.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
deff("[xdot] = derpol(t,x)",..
        ["xd1 = x(2)";..
         "xd2 = -x(1) + (1 - x(1)**2)*x(2)";..
         "xdot = [ xd1 ; xd2 ]"])
xf= -1:0.1:1;
yf= -1:0.1:1;
fchamp(derpol,0,xf,yf)
 ]]></programlisting>
        <scilab:image>
            deff("[xdot] = derpol(t,x)",..
            ["xd1 = x(2)";..
            "xd2 = -x(1) + (1 - x(1)**2)*x(2)";..
            "xdot = [ xd1 ; xd2 ]"])
            xf= -1:0.1:1;
            yf= -1:0.1:1;
            fchamp(derpol,0,xf,yf)
        </scilab:image>
        <programlisting role="example"><![CDATA[
deff("[xdot] = derpol(t,x)",..
        ["xd1 = x(2)";..
         "xd2 = -x(1) + (1 - x(1)**2)*x(2)";..
         "xdot = [ xd1 ; xd2 ]"])
xf= -1:0.1:1;
yf= -1:0.1:1;
clf()
fchamp(derpol,0,xf,yf,1,[-2,-2,2,2],"011")
 ]]></programlisting>
        <scilab:image>
            deff("[xdot] = derpol(t,x)",..
            ["xd1 = x(2)";..
            "xd2 = -x(1) + (1 - x(1)**2)*x(2)";..
            "xdot = [ xd1 ; xd2 ]"])
            xf= -1:0.1:1;
            yf= -1:0.1:1;
            clf()
            fchamp(derpol,0,xf,yf,1,[-2,-2,2,2],"011")
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="champ">champ</link>
            </member>
            <member>
                <link linkend="champ_properties">champ_properties</link>
            </member>
            <member>
                <link linkend="xarrows">xarrows</link>
            </member>
            <member>
                <link linkend="polyline_properties">Arrowed polyline</link>
            </member>
        </simplelist>
    </refsection>
</refentry>
