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 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
<HTML>
<HEAD>
<TITLE>Nonrecursive filters</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<P><font size="+2" color="green">Nonrecursive filters</font></P>
<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>
FILTER\-RECURSIVE x f c</CODE>
</TD></TR>
</table>
<P>
If the <CODE>\-RECURSIVE</CODE> qualifier is used, the third parameter, <CODE>c</CODE>, must be
a vector. The data array, <CODE>x</CODE>, is processed through a nonrecursive filter using the values of
<CODE>c</CODE> as the data coefficients:</P>
<P>
<center><IMG SRC="img19.gif"></center></P>
<P>
where <IMG SRC="N.gif"> is the length of vector
<CODE>c</CODE>. Note that when <CODE>c</CODE> has an even number of elements, the
filter will be applied to the <IMG SRC="nth.gif"> point by application to
points from <IMG SRC="n-N2.gif"> to <IMG SRC="n-1N2.gif"> . For example, when
<IMG SRC="N.gif"> is two, the weightings will be applied to the previous point and
to the current point.</P>
<P>
<font size="+1" color="green">Differentiating nonrecursive filters</font></P>
<P>
Remember, that the <CODE>x</CODE>'s must be equally spaced, and are actually assumed by the
<CODE>FILTER</CODE> command to have unit spacing. Thus, to obtain the correct output scaling, multiply
<CODE>f</CODE> by <IMG SRC="kfact.gif">, where <IMG SRC="k.gif"> is the order of the
derivative, <IMG SRC="N.gif"> is the length of vector <CODE>c</CODE>, and
<IMG SRC="h.gif"> is the spacing of <CODE>x</CODE>, that is, <IMG SRC="heq.gif">. For example:</P>
<P>
<font color="blue"><pre>
FILTER\-RECURSIVE X XOUT [2;-16;0;16;-2] ! 1st deriv. nonrecursive filter
XOUT=XOUT/(24*(X[2]-X[1])) ! use scale factor 1/(h*4!)
</pre></font></P>
<P>
See Table 1 for various first derivative nonrecursive
filter data coefficients. See Table 2 for various second
derivative nonrecursive filter data coefficients. See
Table 3 for various third derivative nonrecursive filter data coefficients.</P>
<P>
<b>Table 1: Various <i>1<sup>st</sup></i> derivative nonrecursive filters</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>3 point </td><td> [ 1; 0; -1 ] </td><td> 1/2h </td>
</tr><tr>
<td>4 point </td><td> [ 1; -6; 3; 2 ] </td><td> 1/6h </td>
</tr><tr>
<td>5 point </td><td> [ 2; -16; 0; 16; -2 ] </td><td> 1/24h </td>
</tr><tr>
<td>6 point </td><td> [ -4; 30; -120; 40; 60; -6 ] </td><td> 1/120h </td>
</tr>
</table></P>
<P>
<b>Table 2: Various <i>2<sup>nd</sup></i> derivative nonrecursive filters</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>3 point </td><td> [ 1; -2; 1 ] </td><td> 1/h<sup>2</sup> </td>
</tr><tr>
<td>4 point </td><td> [ 0; 3; -6; 3 ] </td><td> 1/3h<sup>2</sup> </td>
</tr><tr>
<td>5 point </td><td> [ -1; 16; -30; 16; -1 ] </td><td> 1/12h<sup>2</sup> </td>
</tr><tr>
<td>6 point </td><td> [ 0; 5; 80; -150; 80; -5 ] </td><td> 1/60h<sup>2</sup> </td>
</tr>
</table></P>
<P>
<b>Table 3: Various <i>3<sup>rd</sup></i> derivative nonrecursive filters</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>4 point </td><td> [ -1; 3; -3; 1 ] </td><td> 1/h<sup>3</sup> </td>
</tr><tr>
<td>5 point </td><td> [ -2; 4; 0; -4; 2 ] </td><td> 1/4h<sup>3 </sup></td>
</tr><tr>
<td>6 point </td><td> [ 5; -35; 70; -50; 5; 5 ] </td><td> 1/20h<sup>3</sup> </td>
</tr>
</table></P>
<P><font size="+1" color="green">Smoothing nonrecursive filters</font></P>
<P>
See Table 4 for various quadratic smoothing nonrecursive
filter data coefficients. See Table 5 for various
quartic smoothing nonrecursive filter data coefficients. See
Table 6 for Spencer's formulae smoothing nonrecursive filter data coefficients.</P>
<P>
<b>Table 4: Smoothing nonrecursive filters (quadratic)</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>5 point </td><td> [ -3; 12; 17; 12; -3 ] </td><td> 1/35 </td>
</tr><tr>
<td>7 point </td><td> [ -2; 3; 6; 7; 6; 3; -2 ] </td><td> 1/21 </td>
</tr><tr>
<td>9 point </td><td> [ -21; 14; 39; 54; 59; 54; 39; 14; -21 ] </td><td> 1/231 </td>
</tr><tr>
<td>11 point </td><td> [ -36; 9; 44; 69; 84; 89; 84; 69; 44; 9; -36 ] </td><td> 1/429 </td>
</tr>
</table></P>
<P>
<b>Table 5: Smoothing nonrecursive filters (quartic)</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>7 point </td><td> [ 5; -30; 75; 131; 75; -30; 5 ] </td><td> 1/231 </td>
</tr><tr>
<td>9 point </td><td> [ 15; -55; 30; 135; 179; 135; 30; -55; 15 ] </td><td> 1/429 </td>
</tr><tr>
<td>11 point </td><td> [ 18; -45; -10; 60; 120; 143; 120; 60; -10; -45; 18 ] </td><td> 1/429 </td>
</tr><tr>
<td>13 point </td><td> [ 110; -198; -135; 110; 390; 600; 677; 600; 390; 110; -135; -198; 110 ] </td><td> 1/2431 </td>
</tr>
</table></P>
<P>
<b>Table 6: Smoothing nonrecursive filters (Spencer's formulae)</b>
<table border="1">
<tr>
<td align="center"><em>type</em></td>
<td align="center"><em>data coefficients</em></td>
<td align="center"><em>scale factor</em></td>
</tr><tr>
<td>15 point </td><td> [ -3; -6; -5; 3; 21; 46; 67; 74; 67; 46; 21; 3; -5; -6; -3 ] </td><td> 1/320 </td>
</tr><tr>
<td>21 point </td><td> [ -1; -3; -5; -5; -2; 6; 18; 33; 47; 57; 60; 57; 47; 33; 18; 6; -2; -5; -5; -3; -1 ] </td><td> 1/350 </td>
</tr>
</table></P>
<P>
<font size="+1" color="green">Interpolating nonrecursive filters</font></P>
<P>
Suppose we have points in a vector which are "bad" and need to be replaced.
Assuming one can fit the data with an odd degree polynomial. The next
higher order difference equation, when set to zero, can be used to give the
desired filter coefficients. For example, if the data can be fit with a
<CODE>5<sup><i>th</i></sup></CODE> order polynomial, the fourth difference set
to zero gives:</P>
<P>
<center><IMG SRC="yn-2.gif"></center></P>
<P>
and solving for <IMG SRC="yn.gif"> gives:</P>
<P>
<center><IMG SRC="yneq.gif"></center></P>
<P>
so the data filter coefficients are <CODE>[ -1/6; 2/3; 0; 2/3; -1/6 ]</CODE>.
</P>
<P>
<a href="mean.htm"><img src="../shadow_left.gif">
<font size="+1" color="olive">Mean filters</font></a><br />
<a href="recursive.htm"><img src="../shadow_right.gif">
<font size="+1" color="olive">Recursive filters</font></a>
</P>
</BODY>
</HTML>
|