1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 <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" xmlns:scilab="http://www.scilab.org" xml:id="diff" xml:lang="en">
15 <refname>diff</refname>
16 <refpurpose>Difference and discrete derivative</refpurpose>
19 <title>Calling Sequence</title>
25 <title>Arguments</title>
30 <para>vector or matrix (real, complex, sparse or polynomial)</para>
36 <para>integer the order of differentiation</para>
42 <para>integer or character string with values "r","c" and "*"</para>
48 <para>scalar or vector/matrix</para>
54 <title>Description</title>
56 <literal>y=diff(x)</literal> compute the difference function
57 <literal>y=x(2:$)-x(1:$-1)</literal>
60 <literal>diff(x,n,dim)</literal> is the <literal>n</literal>th
61 difference function along dimension <literal>dim</literal>.
64 <literal>diff(x,n,"*")</literal> is equivalent to
65 <literal>diff(x(:),n)</literal>.
68 Default value for <literal>n</literal> is 1. Default value for
69 <literal>dim</literal> is <literal>"*"</literal>.
72 <literal>dim='r'</literal> is equivalent to <literal>dim=1</literal>
73 and <literal>dim='c'</literal> is equivalent to
74 <literal>dim=2</literal>.
78 <title>Examples</title>
79 <programlisting role="example"><![CDATA[
90 //approximate differentiation
94 dy=diff(sin(t))/step; //approximate differentiation of sine function
95 norm(dy-cos(t(1:$-1)),%inf)