<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) ENPC - JPC
 * 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="arsimul">
    <refnamediv>
        <refname>arsimul</refname>
        <refpurpose>armax simulation</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>
             z = arsimul(ar, u)
             z = arsimul(ar, u, up, yp, ep)
             z = arsimul(a, b, d, sig, u)
             z = arsimul(a, b, d, sig, u, up, yp, ep)
        </synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>ar</term>
                <listitem>
                    <para>an armax process. See armac.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>a</term>
                <listitem>
                    <para>
                        is the matrix  <literal>[Id,a1,...,a_r]</literal>     of dimension (n,(r+1)*n)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>b</term>
                <listitem>
                    <para>
                        is the matrix <literal>[b0,......,b_s]</literal>      of dimension (n,(s+1)*m)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>d</term>
                <listitem>
                    <para>
                        is the matrix <literal>[Id,d_1,......,d_t]</literal>  of dimension (n,(t+1)*n)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>u</term>
                <listitem>
                    <para>is a matrix  (m,N), which gives the entry u(:,j)=u_j</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>sig</term>
                <listitem>
                    <para>is a  (n,n) matrix  e_{k} is an n-dimensional Gaussian process with variance I</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>up, yp</term>
                <listitem>
                    <para>
                        optional parameter which describe the past.  <literal>up=[ u_0,u_{-1},...,u_{s-1}]</literal>;
                        <literal>yp=[ y_0,y_{-1},...,y_{r-1}];</literal>   <literal>ep=[ e_0,e_{-1},...,e_{r-1}]</literal>;
                        if they are omitted, the past value are supposed to be zero
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>z</term>
                <listitem>
                    <para>
                        <literal>z=[y(1),....,y(N)]</literal>
                    </para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            simulation of an n-dimensional armax process
            <literal>A(z^-1) z(k)= B(z^-1)u(k) + D(z^-1)*sig*e(k)</literal>
        </para>
        <programlisting role=""><![CDATA[
A(z)= Id+a1*z+...+a_r*z^r;  ( r=0  => A(z)=Id)
B(z)= b0+b1*z+...+b_s z^s;  ( s=-1 => B(z)=[])
D(z)= Id+d1*z+...+d_t z^t;  ( t=0  => D(z)=Id)
 ]]></programlisting>
        <para>
            z et e are in  <literal>R^n</literal> et u in <literal>R^m</literal>
        </para>
    </refsection>
    <refsection>
        <title>Method</title>
        <para>
            a state-space representation is constructed and an ode with the option
            <literal>"discrete"</literal> is used to compute <literal>z</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
a=[1,-2.851,2.717,-0.865].*.eye(2,2)
b=[0,1,1,1].*.[1;1];
d=[1,0.7,0.2].*.eye(2,2);
sig=eye(2,2);
ar=armac(a,b,d,2,1,sig)
u=rand(1,10,'normal');
y=arsimul(ar,u)
 ]]></programlisting>
    </refsection>
</refentry>
