Filtering 2 (high-pass, band-pass and band-reject)

advertisement
SWRDC9008 — Medical Device Software (2016-S1)
Filtering 2 (high-pass, band-pass and band-reject)
Dr Peadar Grant <peadar.grant@dkit.ie>
Sometimes textbooks don’t do a good job of discussing
high-pass, band-pass and band-reject filters. A lot of internet sites do a better job. One to look at is:
https: // tomroelandts. com/
1
2. Add 1 to centre value.
Or mathematically:
hHP [k] = −hLP [k]
M
M
= −hLP
+1
hHP
2
2
High-pass filters
A high-pass filter simply does the opposite to a lowpass filter. Frequencies above the cutoff frequenct fc are
passed, those below are stopped.
Unlike a low-pass filter, which we design directly, a
high-pass filter is usually created from a low-pass filter
at the same fc and other parameters. One way is to apply the low pass-filter and subtract. The alternative is
to take the low-pass impulse response and modify it in a
process is called spectral inversion.
1.1
2
The idea here is that we use a low-pass filter h[k] to subtract the low-pass information from the signal, and then
subtract it from the original signal to get a high-pass filtered version of the same signal:
(1)
yHP [n] = x[n] − yLP [n]
(2)
= x[n] − (hLP [k] ∗ x[n])
3
(3)
We can generalise the above process a bit more by remembering that
(4)
We can then re-write Equation 3 using δ[n] to help us
isolate the high-pass filter kernel:
yHP [n] = x[n] ∗ δ[n] − (hLP [k] ∗ x[n])
= x[n] ∗ (δ[n] − hLP [k])
(5)
(6)
In other words, the spectral inversion is done by inverting
the sign of the low-pass filter kernel and adding it to the
delta function.
1.3
(9)
Band-reject
The band-reject filter is exactly the same as the band-pass
filter in its construction, except that the fL maps to the
low-pass filter’s cutoff and that fH maps to the high-pass
filter’s cutoff. Everything else stays the same, including
the convolution in Equation 9.
Spectral inversion
x[n] = x[n] ∗ δ[n]
Band-pass filters
hBP = hLP ∗ hHP
While this result “works”, it is nevertheless specific to
the particular inputs and filter kernel, and requires an
explicit subtraction to be done on each application of the
filter.
1.2
(8)
Band-pass filters simply involve a cascade of a low-pass
and high-pass filter, with cutoff frequencies chosen to give
a band-pass response. The notation can vary, but you will
often see fL and fH used, corresponding to the lower and
upper limit.
Confusingly this means that fc for the low-pass filter is
fH and that for the high-pass filter is fL . Note that the
transition bandwidth, B, may not be the same on both
sides, but it often is.
Once we have the filter kernels for the low-pass, hLP ,
and high-pass, hHP , responses we just convolve them to
get the band-pass response.
Subtraction
yLP [n] = hLP [k] ∗ x[n]
(7)
Applying spectral inversion
Given a low-pass filter designed for fc and a given length
M + 1 written as a filter kernel h[k], we can obtain the
corresponding high-pass filter by doing the following two
operations:
1. Change the sign of each value.
1
Download