14
14
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="ode_discrete" xml:lang="en">
16
<refname>ode_discrete</refname>
17
<refpurpose>ordinary differential equation solver, discrete time
22
<title>Calling Sequence</title>
23
<synopsis>y=ode("discrete",y0,k0,kvect,f)</synopsis>
26
<title>Arguments</title>
31
<para>a real vector or matrix (initial conditions).</para>
37
<para>a real scalar (initial time).</para>
43
<para>an external i.e. function or character string or list.</para>
49
<para>an integer (initial time).</para>
55
<para>an integer vector.</para>
61
<title>Description</title>
62
<para>With this syntax (first argument equal to
63
<literal>"discrete"</literal>) <literal>ode</literal> computes recursively
64
<literal>y(k+1)=f(k,y(k))</literal> from an initial state
65
<literal>y(k0)</literal> and returns <literal>y(k)</literal> for
66
<literal>k</literal> in <literal>kvect</literal>.
67
<literal>kvect(1)</literal> must be greater than or equal to
68
<literal>k0</literal>.
70
<para>Other arguments and other options are the same as for
71
<literal>ode</literal>, see the see <link linkend="ode">ode</link> help.
75
<title>Examples</title>
76
<programlisting role="example"><![CDATA[
16
<refname>ode_discrete</refname>
17
<refpurpose>ordinary differential equation solver, discrete time
22
<title>Calling Sequence</title>
23
<synopsis>y=ode("discrete",y0,k0,kvect,f)</synopsis>
26
<title>Arguments</title>
31
<para>a real vector or matrix (initial conditions).</para>
37
<para>a real scalar (initial time).</para>
43
<para>an external i.e. function or character string or list.</para>
49
<para>an integer (initial time).</para>
55
<para>an integer vector.</para>
61
<title>Description</title>
62
<para>With this syntax (first argument equal to
63
<literal>"discrete"</literal>) <literal>ode</literal> computes recursively
64
<literal>y(k+1)=f(k,y(k))</literal> from an initial state
65
<literal>y(k0)</literal> and returns <literal>y(k)</literal> for
66
<literal>k</literal> in <literal>kvect</literal>.
67
<literal>kvect(1)</literal> must be greater than or equal to
68
<literal>k0</literal>.
70
<para>Other arguments and other options are the same as for
71
<literal>ode</literal>, see the see <link linkend="ode">ode</link> help.
75
<title>Examples</title>
76
<programlisting role="example"><![CDATA[
77
77
y1=[1;2;3]; deff("yp=a_function(k,y)","yp=A*y+B*u(k)")
78
78
A=diag([0.2,0.5,0.9]); B=[1;1;1];u=1:10;n=5;
79
79
y=ode("discrete",y1,1,1:n,a_function);
82
82
// Now y evaluates at [y3,y5,y7,y9]
83
83
y=ode("discrete",y1,1,3:2:9,a_function)
84
84
]]></programlisting>
86
<refsection role="see also">
87
<title>See Also</title>
88
<simplelist type="inline">
90
<link linkend="ode">ode</link>
86
<refsection role="see also">
87
<title>See Also</title>
88
<simplelist type="inline">
90
<link linkend="ode">ode</link>