• apply a window function to sharpen up
the filter's frequency response
• then calculate the Fourier transform of the
truncated set of coefficients to see if it
still matches our requirement
However, no matter how many filter
coefficients you throw at it, you cannot improve on
a fixed window's attenuation. This means that the
art of FIR filter design by the window method lies
in an appropriate choice of window function. For
example, if you need an attenuation of 20 dB or
less, then a rectangle window is acceptable. If you
need 43 dB you are forced to choose the Hamming
window, and so on. Sadly,
the better window
functions need more filter coefficients before their
shape can be adequately defined. So if you need
only 25 dB of attenuation you should choose a
triangle window function which will give you this
attenuation: the Hamming window, a form of
generalized cosine window, for example, would
give you more attenuation but require more filter
coefficients to be adequately defined - and so
would be wasteful of computer power.
The art of FIR filter design by the window method
lies in choosing the window function which meets
your requirement with the minimum number of
filter coefficients. You may notice that if you want
an attenuation of 30 dB you are in trouble: the
triangle window is not good enough but the
Hamming window is too good (and so uses more
coefficients than you need). The Kaiser window
function is unique in that its shape is variable. A
variable parameter defines the shape, so the Kaiser
window ,described mathematically below, is
unique in being able to match precisely the
attenuation you require without overperforming.
FIR filter coefficients can be calculated using
the window method. But the window method does
not correspond to any known form of optimization.
In fact it can be shown that the window method is
not optimal - by which we mean, it does not
produce the lowest possible number of filter
coefficients that just meets the requirement. The
art of FIR filter design by the window method lies
in choosing the window function which meets your
requirement with the minimum number of filter
coefficients. If the window method design is not
good enough we have two choices:
• use another window function and try
again
• do something clever
The Remez Exchange algorithm is something
clever. It uses a mathematical optimization
method. Thus, using the Remez Exchange
algorithm to design a filter we might proceed
manually as follows:
• choose a window function that we think
will do
• calculate the filter coefficients
• check the actual filter's frequency
response against the design goal
• if it overperforms, reduce the number of
filter coefficients or relax the window
function design
• try again until we find the filter with the
lowest number of filter coefficients
possible
In a way, this is what the Remez Exchange
algorithm does automatically. It iterates between
the filter coefficients and the actual frequency
response until it finds the filter that just meets the
specification with the lowest possible number of
filter coefficients. Actually, the Remez Exchange
algorithm never really calculates the frequency
response: but it does keep comparing the actual
with the design goal.
The Remez method produces a filter which
just meets the specification without
overperforming. Many of the window method
designs actually perform better as you move
further away from the passband: this is wasted
performance, and means they are using more filter
coefficients than they need. Similarly, many of the
window method designs actually perform better
than the specification within the passband: this is
also wasted performance, and means they are using
more filter coefficients than they need. The Remez
method performs just as well as the specification
but no better: one might say it produces the worst
possible design that just meets the specification at
the lowest possible cost (Proakis, 2003).
w
h
[i] = 0.54 – 0.46 cos(2∏i / M) (5)
The Hamming window. These windows run from i =
0 to M, for a total of M+1 points.
_________
I
0
(Πα√1 – (2k/n-1)
2
) if 0≤k≤n (6)
I
0
(Πα)
w
k
=
0 otherwise
APPLYING SIGNAL PROCESSING TECHNIQUES TO WATER LEVEL ANOMALY DETECTION
305