<?xml version="1.0" encoding="UTF-8"?>

<!--
 *
 * This help file was generated from medfilt1.sci using help_from_sci().
 *
 -->

<refentry version="5.0-subset Scilab" xml:id="medfilt1" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns3="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:scilab="http://www.scilab.org"
          xmlns:db="http://docbook.org/ns/docbook">

  <refnamediv>
    <refname>medfilt1</refname>
    <refpurpose>1D median filtering</refpurpose>
  </refnamediv>


<refsynopsisdiv>
   <title>Syntax</title>
   <synopsis>
   y = medfilt1(x)
   y = medfilt1(x, n)
   y = medfilt1(x, n, dim)
   y = medfitl1(__, nanflag, padding)
   
   </synopsis>
</refsynopsisdiv>

<refsection>
   <title>Description</title>
   <para>
y = medfilt1(x)
Applies a 3rd order 1-dimensional median filter to input x along the
first non-zero dimension. The function appropriately pads the signal
with zeros at the endings. For a segment, a median is calculated as
the middle value (average of two middle values) for odd number
number (even number) of data points.
y = medfilt1(x,n)
Applies a nth order 1-dimensional median filter.
y = medfilt1(x,n,dim)
Applies the median filter along the n-th dimension
y = medfilt1(__, nanflag, padding)
nanflag specifies how NaN values are treated. padding specifies the
type of filtering to be performed at the signal edges.
   </para>
   <para>
</para>
</refsection>

<refsection>
   <title>Parameters</title>
   <variablelist>
        <varlistentry>
            <term>x:</term>
            <listitem><para> int | double</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>n:</term>
            <listitem><para> positive integer scalar</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>dim:</term>
            <listitem><para> positive integer scalar</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>nanflag:</term>
            <listitem><para> 'includenan' (default) | 'omitnan'</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>* includenan:</term>
            <listitem><para> Filtering such that the median of any segment</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>* omitnan:</term>
            <listitem><para> Filtering with NaNs omitted in each segment. If a segment</para></listitem>
        </varlistentry>
        <varlistentry>
            <term>y:</term>
            <listitem><para> int | double</para></listitem>
        </varlistentry>
   </variablelist>
</refsection>

<refsection>
   <title>Examples</title>
   <programlisting role="example"><![CDATA[
// Noise supression using 10th order (n =10) median filtering
//Generate a sinusoidal signal sampled for 1 second at 100 Hz. Add a higher-frequency sinusoid to simulate noise.
fs = 100
t = 0:1/fs:1;
x = sin(2*%pi*t*3)+0.25*sin(2*%pi*t*40);

//Use a 10th-order median filter to smooth the signal. Plot the result.
y = medfilt1(x,10);
plot(t,x,t,y)
legend('Original','Filtered');

   ]]></programlisting>
</refsection>

<refsection role="see also">
   <title>See also</title>
   <simplelist type="inline">
   <member><link linkend="filter">| hampel | median | sgolayfilt</link></member>
   </simplelist>
</refsection>

<refsection>
   <title>Authors</title>
   <simplelist type="vert">
   <member>Ayush Baid</member>
   </simplelist>
</refsection>
</refentry>
