In signal processing it is often that we need to compare two finite impulse responses (FIR). It is also often that we don’t care to know the difference between two FIRs outside a specific frequency band, and only care about the difference within that band. Given the difference FIR , given as
coefficients for a sample rate
, and the frequency band of interest being
, it is common to simply assume the sample rate is actually
and define:
where for we put
, and we have some coefficients
.
We want to preserve Parseval’s Theorem, namely we would like the following to hold:
A bit of algebra, that I’m not interested in showing here, gets us:
In order to compute we recognise that the numbers
are a subsequence of the discrete Fourier transform (DFT) of
. We compute the DFT of
, probably using an implementation of FFT, and sum as needed.
Let’s instead try compute the true power of in the band
. Instead of declaring the definition, I will first motivate it a bit. In the approximation above, we can double the sample rate we’ve assumed:
The sum is twice as large so we get “more” frequencies involved. On the other hand, if we use the same computation method as above then we pay twice as much for the larger FFT. Now, instead of doubling, we can multiply the sample rate by a number to get the sum:
The larger is, the more our sum should become independent of
– we’re taking more and more frequencies. But now to compute this the FFT needed is pretty large. So instead of simply taking a large
, let’s take it to be even larger, and define:
Wait what? The FFT is big, so make it bigger??? Hold on: we can now recognise the limit on the right to be a Riemann integral. In fact, we have:
This is the true power of in the band
. It is independent of the sample rate, so from now on we’ll simply write, for two real numbers
:
How do we compute this? Let’s apply some algebra.
We’ll perform some abuse of notation and use to also denote the polynomial
. Putting the definition of
into the definition of power we have:
where we have used that, since are real,
. We continue by setting:
so that
With more abuse of notation, set . Also, set
So we have:
where is the usual dot product. Note that the coefficients of
are also the coefficients of
, which is a multiplication of two degree
polynomials and hence can be computed using two FFTs. This shows that the power of a polynomial in a given band can be computed using two FFTs of size
(number of coefficients of
), some exponentiating, and a dot product. Even though we took our sample rate to infinity, the computation turned out pretty simple.
One more improvement before you go: instead of computing the coefficients of , we can use the identity
where is the unitary discrete Fourier transform operator. Since
is a multiplication of polynomials, so a convolution,
can be expressed in terms of
:
where the means component wise. If we already have
computed, this means that computing
takes only a single FFT of size
. Amazing!
Ok, that’s it.