1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
<?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>
<para> </para>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>
y = medfilt1(x)
y = medfilt1(x, n)
y = medfilt1(x, n, dim)
y = medfitl1(__, nanflag, padding)
</synopsis>
<para> </para>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<para>
y = medfilt1(x)
</para>
<para>Applies a 3rd order 1-dimensional median filter to input x along the
first non-zero dimension.</para>
<para>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.</para>
<para> </para>
<para>y = medfilt1(x,n)</para>
<para>Applies a nth order 1-dimensional median filter.</para>
<para> </para>
<para>y = medfilt1(x,n,dim)</para>
<para>Applies the median filter along the n-th dimension</para>
<para> </para>
<para>y = medfilt1(__, nanflag, padding)</para>
<para>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> <para>Input signal.</para></listitem></varlistentry>
<varlistentry><term>n:</term>
<listitem><para> positive integer, scalar</para><para>
Filter order. </para>
<para> Defaults to 3.The order of the median filter. Must be less than
(length of the signal) where signals are 1D vectors along the
dimension of x to be filtered </para></listitem></varlistentry>
<varlistentry><term>dim:</term>
<listitem><para> positive integer scalar</para><para>
Dimension to filter along. </para>
<para> Defaults to first non-singleton dimension of x</para></listitem></varlistentry>
<varlistentry><term>nanflag:</term>
<listitem><para> 'includenan' (default) | 'omitnan'</para> <para>
NaN condition.</para>
<para> * includenan: Filtering such that the median of any segment containing a NaN is also a NaN. </para>
<para>* omitnan: Filtering with NaNs omitted in each segment. If a segment contains all NaNs, the result is NaN</para>
</listitem></varlistentry>
<varlistentry><term>y:</term>
<listitem><para> int | double</para><para>
The filtered signal.</para>
<para>y has the same size as x</para></listitem></varlistentry>
</variablelist>
<para> </para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
//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');
y = round(y*10000)/10000;
y = y'
]]></programlisting>
<scilab:image>
//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');
y = round(y*10000)/10000;
y = y'
</scilab:image>
</refsection>
<refsection>
<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>
|