13
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:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="m2sci_diff">
15
<refname>diff (Matlab function)</refname>
16
<refpurpose>Differences and approximate derivatives</refpurpose>
19
<title>Matlab/Scilab equivalent</title>
20
<informaltable border="1" width="100%">
23
<emphasis role="bold">Matlab</emphasis>
26
<emphasis role="bold">Scilab</emphasis>
31
<programlisting role="example"><![CDATA[
36
<programlisting role="example"><![CDATA[
44
<title>Particular cases</title>
47
<term>Y = diff(X[,n])</term>
49
<para>For this kind of use of <emphasis role="bold">diff</emphasis> (dim parameter not given), Matlab works on the first non-singleton dimension of <emphasis role="bold">X</emphasis> what Scilab does not. In this case, Scilab considers dim to be <emphasis role="bold">"*"</emphasis> so that diff threats all values of <emphasis role="bold">X</emphasis>, what Matlab does not.
54
<term>Y = diff(X,n,dim)</term>
56
<para>If dimension given by <emphasis role="bold">dim</emphasis> reaches 1 before <emphasis role="bold">n</emphasis> iterations have been done, Matlab switches to next non-singleton dimension, but Scilab does not, use <emphasis role="bold">mtlb_diff</emphasis> to get equivalent results.
62
When <emphasis role="bold">n</emphasis> is greater than all existing dimensions of <emphasis role="bold">X</emphasis>, Matlab returns <emphasis role="bold">[]</emphasis> what Scilab may not give for all inputs.
15
<refname>diff (Matlab function)</refname>
16
<refpurpose>Differences and approximate derivatives</refpurpose>
19
<title>Matlab/Scilab equivalent</title>
20
<informaltable border="1" width="100%">
23
<emphasis role="bold">Matlab</emphasis>
26
<emphasis role="bold">Scilab</emphasis>
31
<programlisting role="example"><![CDATA[
36
<programlisting role="example"><![CDATA[
44
<title>Particular cases</title>
47
<term>Y = diff(X[,n])</term>
50
For this kind of use of <emphasis role="bold">diff</emphasis> (dim parameter not given), Matlab works on the first non-singleton dimension of <emphasis role="bold">X</emphasis> what Scilab does not. In this case, Scilab considers dim to be <emphasis role="bold">"*"</emphasis> so that diff threats all values of <emphasis role="bold">X</emphasis>, what Matlab does not.
55
<term>Y = diff(X,n,dim)</term>
58
If dimension given by <emphasis role="bold">dim</emphasis> reaches 1 before <emphasis role="bold">n</emphasis> iterations have been done, Matlab switches to next non-singleton dimension, but Scilab does not, use <emphasis role="bold">mtlb_diff</emphasis> to get equivalent results.
64
When <emphasis role="bold">n</emphasis> is greater than all existing dimensions of <emphasis role="bold">X</emphasis>, Matlab returns <emphasis role="bold">[]</emphasis> what Scilab may not give for all inputs.