* Bug #8667 fixed - Handling of %nan in functions min,max,median is not correctly...
[scilab.git] / scilab / modules / statistics / help / en_US / descriptive_statistics / median.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2000 - INRIA - Carlos Klimann
5  * 
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
11  *
12  -->
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" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="median">
14     <refnamediv>
15         <refname>median</refname>
16         <refpurpose>median (row median, column median,...) of
17             vector/matrix/array entries
18         </refpurpose>
19     </refnamediv>
20     <refsynopsisdiv>
21         <title>Calling Sequence</title>
22         <synopsis>y=median(x)
23             y=median(x,'r')
24             y=median(x,'c')
25             y=median(x,'m')
26             y=median(x,dim)
27         </synopsis>
28     </refsynopsisdiv>
29     <refsection>
30         <title>Arguments</title>
31         <variablelist>
32             <varlistentry>
33                 <term>x</term>
34                 <listitem>
35                     <para>real vector, matrix or an array</para>
36                 </listitem>
37             </varlistentry>
38             <varlistentry>
39                 <term>y</term>
40                 <listitem>
41                     <para>scalar,vector, matrix or an array</para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>dim</term>
46                 <listitem>
47                     <para>positive integer</para>
48                 </listitem>
49             </varlistentry>
50         </variablelist>
51     </refsection>
52     <refsection>
53         <title>Description</title>
54         <para>
55             For a vector or a matrix <literal>x</literal>, <literal>y=median(x)</literal>
56             returns in the scalar <literal>y</literal> the median of all the entries of
57             <literal>x</literal>.
58         </para>
59         <para>
60             <literal>y=median(x,'r')</literal> (or, equivalently,
61             <literal>y=median(x,1)</literal>) is the median along the row index. It returns
62             in each entry of the column vector <literal>y</literal> the median of each
63             column of <literal>x</literal>.
64         </para>
65         <para>
66             <literal>y=median(x,'c')</literal> (or, equivalently,
67             <literal>y=median(x,2)</literal>) is the median along the column index. It
68             returns in each entry of the row vector <literal>y</literal> the median of each
69             row of <literal>x</literal>.
70         </para>
71         <para>
72             <literal>y=median(x,'m')</literal> is the median along the first non
73             singleton dimension of <literal>x</literal> (for compatibility with matlab).
74         </para>
75         <para>
76             <literal>y=median(x,dim)</literal> is the median along the dimension
77             <literal>dim</literal> of <literal>x</literal> (for compatibility with matlab).
78         </para>
79     </refsection>
80     <refsection>
81         <title>Remark</title>
82         <para>
83             <note>
84                 If <varname>x</varname> has some NANs terms, the result will be the same if these terms were Inf.
85             </note>
86         </para>
87     </refsection>
88     <refsection>
89         <title>Examples</title>
90         <programlisting role="example"><![CDATA[ 
91 A=[1,2,10;7,7.1,7.01];
92 median(A)
93 median(A,'r')
94 median(A,'c')
95 A=matrix([-9 3 -8 6 74 39 12 -6 -89 23 65 34],[2,3,2]);
96 median(A,3)
97 median(A,'m')
98  ]]></programlisting>
99     </refsection>
100     <refsection role="see also">
101         <title>See Also</title>
102         <simplelist type="inline">
103             <member>
104                 <link linkend="sum">sum</link>
105             </member>
106             <member>
107                 <link linkend="mean">mean</link>
108             </member>
109         </simplelist>
110     </refsection>
111 </refentry>