# How to interpret output of matched filter with complex input?

I have implemented a matched filter based on the Fourier Transform approach. In the real numbers domain that means that I use as the coefficients of my filter (B) the inverted time-samples of the signal that I'm trying to find and I compute:

real_output = IFFT(FFT(A).*FFT(B))


Where, if we assume the moment of exact match, A is an input signal of real value samples and B is the signal made from inverted time-samples of A (or I can also conjugate the spectrum of B and I get the required time inversion because the signal is real). In order to avoid aliasing I perform both FFT with length(A)+length(B)-1 samples. The output of this filter is always real and its maximum, points at the moment in which a match has occurred.

Now assume that instead of a real valued A we have a complex valued A. My questions are:

1. Is it possible to apply a matched filter for complex domain signals?
2. Would I have to invert the complex valued A to get the coefficients of my filter or should I do something else like conjugating them?
3. How do I interpret the output of the filter, should I say a match happens if the absolute value of the output is maximum or just when the real part is maximized?
4. In some experiments I have noticed that at the moment of a match the output of the filter is real if spectrum(B) is the complex conjugate of spectrum(A), is this correct?

Yes, it is possible (at least on paper or code, since complex signal don't exist physically) to apply a matched filter to complex signals.

This is one way to look at it that I think is illustrative. Assume that a pulse $p(t)$ is real and has energy 1, that is, $$\int_{-\infty}^\infty p^2(t) \, dt=1.$$ The filter matched to $p(t)$ has impulse response $p(-t)$. Then, if the filter's input is $ap(t)$ for real $a$, the matched filter's output (sampled at the appropriate time) is equal to $$ap(t)\star p(-t)=a.$$

If the pulse amplitude is complex, say $a+jb$ for real $a$ and $b$, then we can use the linearity of the convolution operation to calculate \begin{align} (a+jb)p(t) \star p(-t) &= \left(ap(t)+jbp(t)\right) \star p(-t) \\ &=ap(t)\star p(-t) + jbp(t)\star p(-t) \\ &= a+jb. \end{align}

One way to interpret the result is that the filter is matching the real part and the imaginary part independently (but "at the same time"). Recall that $j=\sqrt{-1}$ is orthogonal to the real line; this means that $a$ and $b$ don't "interfere" with each other during the convolution.

1. Yes.
2. If you can define the system as using a real pulse $p(t)$, then the matched filter is $p(-t)$. If you must use a complex pulse, then the matched filter is $p^\star(-t)$.
3. A "match" can be declared when the filter's ouput is close enough (in Euclidean distance sense) to the matched signal (see https://en.wikipedia.org/wiki/Maximum_a_posteriori_estimation for more details).
4. The output of the filter should be real only when $b$ is zero.
• Thanks for your answer, could you please answer the remaining enumerated questions? What do you mean by at least on paper or code? – VMMF Apr 7 '16 at 15:59
• I've edited my answer; hopefully this answers your question better. – MBaz Apr 14 '16 at 16:59
• @MBaz just for the "philosophical" argument: some say that "the changing magnetic field which is the source of the signal measured in MRI is a vector which we represent using complex notation". Could they be actually complex signals, that we cannot measure as complex? If not, should we really talk about "real" digital signals? – Laurent Duval Apr 14 '16 at 19:02
• @LaurentDuval I don't know, but if you could create higher-dimensional signals (beyond in-phase and quadrature) without time or frequency expansion, you'd revolutionize the field of communications. – MBaz Apr 14 '16 at 23:06

The answer by @MBaz is very complete. I am adding a shameless plug to the debate.

In a past work, I have been involved in the design of an algorithm aimed at finding, locally, the "best" matched filtering involving one signal $d$, and one template $x$ (and later several ones). Due to the noisiness and the non-stationnarity of the (seismic) data, we wanted to perform the matched filtering in a transformed domain. Skipping failures and other details, we ended up with a complex wavelet transform (you can think of windowed Fourier transforms).

And after some trials, we found that a "single" or unary coefficient matched filter was quite efficient. As weird it may seem (single-coefficient real filters are not so interesting), it worked because this coefficient was complex. The amplitude was interpreted as the amplitude correction, and the phase as (somehow) a sub-sample time shift. You can find the whole story in Adaptive multiple subtraction with wavelet-based complex unary Wiener filters, 2012. We later added a lag parameter to account for super-sample shifts. So you can check the derivations with a single complex coefficient quite easily, with the complex conjugation and stuff. So:

1. Yes it does
2. You should place yourself in the most general context of complex data for Fourier, correlation, etc. to avoid mistakes
3. You have an amplitude and a shift term, but it is somehow tricky (sub-sample)
4. Appparently so, but I am not as sure as @MBaz
• Interesting! From what I see in the paper, the signal model is quite different from that used in communications, but it reminded me of the frequency-selective wireless channel, which has multiple reflections. – MBaz Apr 14 '16 at 23:03
• @MBaz I appreciate you point to such topics in coommunications, a domain I have almost no idea about. I am sure there exist works which already have performed such short adaptive filtering in a local frequency domain. What I am still looking at is the deep interplay, at equivalent performance, between the transform redundancy and the adaptive filter length – Laurent Duval Apr 15 '16 at 5:05
• @LaurentDuval thank you very much for answering with an example of your professional experience – VMMF Mar 14 '18 at 14:24