i
i
“knitrMainBook” — 2015/8/20 — 17:01 — page 6 — #22
i
i
i
i
i
i
6 CHAPTER 1. INTRODUCTION
the line) are being clearly attenuated by the linear filter, it is still responding
quite strongly to them. In particular, the largest excursions seen in the filtered
response correspond to these spikes: this is an inherent consequence of linearity,
a point discussed further in Sec. 1.2. Also, note that the extent to which this
filter recovers the non-spike portion of this data sequence varies strongly with
the sequence index k. For example, the filter response agrees closely with the
original data sequence for k greater than about 700, but not for k between
approximately 450 and 550: there, not only is the spike at k ∼ 550 suppressed,
but so is the substantial variation that preceeds this spike.
An alternative to the linear weighted moving average filter just described is
the nonlinear median filter, proposed in 1974 by J.W. Tukey [114] and described
in detail in Chapter 4. This filter is obtained by replacing the mean in Eq. (1.2)
with the median, defined as follows. As in the case of the moving average filter,
the median filter is based on the moving window {x
k−K
, . . . , x
k
, . . . , x
k+K
}, but
instead of averaging these values, they are first rank-ordered from smallest to
largest:
{x
k−K
, . . . , x
k
, . . . , x
k+K
} → {x
(−K)
≤ ··· ≤ x
(0)
≤ ··· ≤ x
(K)
}. (1.3)
That is, x
(−K)
corresponds to the smallest value in the original moving data
window, regardless of its index k, x
(−K+1)
corresponds to the second-smallest
value, and so forth, with x
(0)
representing the middle value in the sequence, and
x
(K)
representing the largest value in the sequence. The median is the middle
value in this sequence, x
(0)
, and this value defines the output of the median
filter, i.e.:
y
k
= median{x
k−K
, . . . , x
k
, . . . , x
k+K
} = x
(0)
. (1.4)
The properties of the median filter—including its primary similarities and dif-
ferences with the moving average filter just described—are discussed in detail
in Chapter 4, but here it is enough to note that one of the important differences
is that the median is much less sensitive to outliers or extreme values in the
original data sequence. This fact—together with the inherent nonlinearity of
the median, also discussed in Chapter 4—means that the median filter behaves
quite differently from the moving average filter just discussed.
Like the unweighted moving average filter, the only tuning parameter for the
median filter is the window half-width parameter K. Also as with the moving
average filter, the median filter reduces to the identity filter when K = 0 and
has correspondingly greater effects on the input signal with increasing K. This
behavior is illustrated in Fig. 1.4, which shows the results of applying the median
filter to the same 512-point data subsequence considered before, with the same
values of K. Specifically, the upper left plot in Fig. 1.4 shows the original signal
(i.e., the result for K = 0) from k = 256 to k = 767, while the upper right
plot shows the results obtained with the median filter with K = 5. The lower
plots show the corresponding results for K = 10 (lower left) and K = 25 (lower
right). Careful comparison of Figs. 1.2 and 1.4 shows that these two filters
exhibit different responses, but the plots are too small to reveal the nature of
these differences.
© 2016 by Taylor & Francis Group, LLC