Remember that in the article on correlation, we discussed that correlation of a signal with proper normalization is maximum with itself and lesser for all other signals. Since the number of possible signals is limited in a digital communication system, we can use the correlation between incoming signal and possible choices and in a digital receiver. Consequently, a decision can be made in favor of the one with higher correlation. It turns out that the theory of maximum likelihood detection formalizes this conclusion that it is the optimum receiver in terms of minimizing the probability of error.

Before correlating the received signal with possible choices, it is helpful to see the correlation of a rectangular pulse shape with itself — called the auto-correlation as defined in correlation. Figure below illustrates the auto-correlation of the rectangular pulse shape whose time support is equal to a symbol duration, i.e., from to samples. As a consequence, its auto-correlation is a triangular pulse shape with duration clearly from to . From the definition of correlation in Correlation Eq,

Since correlation is similar to convolution with one signal flipped, and flipping does not alter the length of a signal, the length of the correlation output is the same as convolution output, i.e., .

Eq (1) is extremely important in the design of communication systems and this term, , will appear over and over again in any communications text. I will highly recommend writing it down on a piece of paper and sticking it to your laptop or book.

Notice that our focus is on linear modulation, i.e., the signal is generated by linear scaling of a basic pulse shape to vary its amplitude as , etc. as expressed in the article on modulation – from numbers to signals. Therefore, the effect of scaling the pulse at the Tx will appear as the same scaling at the Rx without affecting the pulse shape or its auto-correlation. This leads to the conclusion that instead of correlating the incoming signal with all possible transmitted signals ( and here) which are just the scaled versions of the same basic pulse shape, we can correlate it with that pulse shape.

Using this strategy, the peak of the auto-correlation will bear that amplitude scaling done at the Tx. If you have some confusion regarding this point, don’t worry. We will shortly see it graphically in a later article on PAM detection.

Now, let us compute the correlation between the received signal and the pulse shape as

(2)

for all possible lags . The question then is to find the optimum sampling instant: the value of that gives the best result through maximizing the correlation output. For both and with zero noise, Figure below draws the correlations for many different lags .

As the signal sliding occurs, the correlation outputs vary as

It is evident that at time instant , the output for is and the output for is . This time instant is the point of maximum overlap where the received signal is completely aligned with the pulse shape. For symbol detection, only this particular sample of correlation output is needed and the rest of the samples can be discarded. This is the process of demodulation that maps a signal back to a number.

## Matched Filter in Time Domain

In the above discussion, since the maximum overlap is the only sample within a symbol time that is required out of samples, let us substitute in Eq (2) as

(3)

We conclude that the process of correlation can be implemented as convolution with a filter whose impulse response is a flipped version of the actual pulse shape. Most texts say that this is true only as far as the point of maximum overlap is concerned. We discuss this difference of opinion in the article on convoluted correlation between matched filter and correlator.

It is tempting to write , but observe from Figure on correlator outputs that the time base of our demodulator starts at samples or seconds, although a real receiver should begin processing the received signal at time . From , the peak or maximum overlap shifted by the same amount occurs at or seconds.

Also remember that flipping the pulse shape implies that the impulse response of this filter starts at seconds. Standing at seconds, our filter would need future samples due to arrive at . Since accessing future samples is not possible, the impulse response must be delayed by an amount seconds to yield . Remember from transforming a signal that for negative time axis as in the case here, a delay means shifting the signal to the right, which means not only that now starts at but also the filter output reaches its maximum at time seconds.

In summary, this flipped and delayed version of the template pulse shape is called the matched filter given by

Above statement is true because the pulse has real coefficients. For complex signals, complex conjugation is also required for which an intuitive explanation will be shortly described.

(4)

Figure above draws a matched filter for an example pulse shape. To find the matched filter output, consider that in the absence of noise, the received signal is

From Eq (3),

where we utilized the fact that convolution of a signal with its flipped version is its auto-correlation which is unity at the middle point ( sample). Thus, the output reflects the information embedded in the amplitude of the signal.

A question that immediately arises from the above derivation — but mostly not asked in communications texts — is the following: how do we know for sure that the remaining samples are of little use, as far as the process of demodulation is concerned? We answer this question in the next subsection during the matched filter viewpoint in frequency domain.

For an intuitive understanding of matched filtering approach, consider the following argument: In the post on correlation, where we learned the relation between convolution and correlation, we found that correlation can be implemented through convolution if one of the signals is flipped beforehand. During convolution with the received signal, this flipped version is folded again, hence bringing the original expected signal back.

By definition, a matched filter is a linear filter that maximizes the output signal-to-noise ratio (SNR) if the signal is buried in AWGN. Since the incoming signal structure is already known, the matched filter can be easily constructed through time-reversing and delaying this known signal for maximizing the output correlation.

As an example in everyday life, carefully watch out for the opinions you hold. In general, we are always defending the viewpoints we already have and rejecting (filtering out) either the unknown or what we decided to oppose in the past. That is matched filtering!

Expanding to a more general inference, implementing a matched filter to an incoming signal requires the following three steps:

- Flip a true copy of the template signal.
- Delay it by an amount that yields maximum correlation.
- Take the complex conjugate, in case of complex signals.

## Matched Filter in Frequency Domain

In frequency domain, matched filter has an interesting view as well. In some DFT properties, we learned that the DFT of a time-reversed and complex conjugated signal is given by the complex conjugate of its DFT, i.e.,

(5)

Furthermore, as explained in the article on the concept of phase, we saw that the time shift of an input signal results in a corresponding phase shift at each frequency of its DFT with no change in magnitude.

Since , and sample coincides with , the DFT of the matched filter can be deduced by combining the above two facts as

where is the DFT size and ranges from to . So the DFT of the matched filter has a magnitude that is the same as the magnitude of the underlying pulse while a phase shift that is negative of the phase of the pulse DFT (which arises from taking the complex conjugate), plus an additional factor proportional to the symbol time .

What happens when the received signal is passed through the matched filter? First, note that in presence of no noise, the received signal is expressed as

whose spectrum can be written as

where is if is positive and if is negative. At the output of the matched filter, the convolution in time domain is multiplication in frequency domain leading to the following results.

[Magnitude] Utilizing Eq (6), the magnitude of the matched filter output can be written as

Consider that for a number ,

Therefore, the matched filter has high gain at frequencies where is large and low gain at frequencies where is small. It can deduced that the matched filter enhances the strong spectral components and reduces the weak spectral components in .

[Phase] On the other hand, the phase of takes the form

where we can notice the phase of the incoming signal being canceled by the matched filter. This phase adjustment enables all spectral components to align at sampling time instant. Figure below illustrates an example signal template and a corresponding matched filter where the blue lines represent the signal template while the red show the matched filter. Notice the same magnitude on each spectral line but exactly opposite phase. This is the reason complex conjugation is required for designing a matched filter for complex signals.

In terms of , incorporating in form, is

where the difference of and is due to the identities and .

To find the output in time domain , iDFT of needs to be taken through definition of IDFT in Discrete Fourier Transform (DFT),

Plugging and in iDFT above and using identities and , we get

(7)

Sampling this matched filter output at the instant yields

Figure below verifies the above finding for an all 1s sequence (no in the received sequence). Notice that there is no component and all frequency domain samples are perfectly aligned to contribute towards term.

Using Parseval’s relation in DFT examples that relates the signal energy in time domain to that in frequency domain,

the matched filter output in time domain can be written as

Owing to the unit energy pulse ,

and hence the modulated information is retrieved through the amplitude of the matched filter output.

In the meantime, if you found this article useful, you might want to subscribe to my email list below to receive new articles.

## Optimality of Peak Sample

From this derivation in frequency domain, although we obtained the same result as in time domain, we get an additional insight into the operation of a digital receiver. That insight arises from answering the question asked in time domain viewpoint of the matched filter: as far as the process of demodulation is concerned, why do we discard the remaining samples? Why can’t we process them in a manner that improves the symbol estimate?

For the case where an all 1s sequence is transmitted (no in the received sequence) and signal in Eq (7) is sampled at a different time instant instead of , say at , we can trace the following sequence of steps.

- From Eq (7),
which is nothing but a linear phase shift arising in all frequency bins due to sampling the output one unit of time earlier.

Now, the component of the output is not zero. We can say that a part of the actual signal energy — that should have appeared in branch — has leaked into the arm. The arm with reduced energy is not optimal anymore for symbol detection. This is drawn in Figure below. Notice that the spectral components have been rotated by symmetrical phase due to a time difference of sample.

This non-zero sample also reveals an interesting point. In time domain, all the samples of the correlation result are less in magnitude than the peak due to partial overlap instead of the maximum. Going into frequency domain, this disappeared energy can be found in arm associated with phase rotations. The same frequency response is very similar for all time shifts — the only difference being the scattered phases for resulting in misaligned summation.

- One can argue that given the above information, we can still theoretically recover the modulated information from Eq (7). Since , the expression + would still have resulted in the same energy and correct sign can be estimated from the phase.
However, not only that this extra processing is unnecessary when pure samples are available at , but also remember that in an actual receiver, noise is also added to the transmitted signal and has to pass through the same filter (not matched for noise). For noise , the filtered noise samples are given by

Therefore, this filtering on the noise generates correlation in noise samples at its output that is directly proportional to the auto-correlation of the pulse shape.

For this reason, this correlation among noise samples is zero only when the underlying pulse auto-correlation is zero, which occurs at a spacing of samples either side of the peak. Moreover, no kind of processing on other samples can result in a better performance. For example, summing two samples doubles their noise power as well. That is how the SNR is maximized by the matched filter output sampled at .

Here, we concentrated on the matched filter in relation to the underlying pulse shape due to modulation being linear. In the field of signal processing, the matched filter has a much broader meaning that works well for non-linear modulations, distinct communication/radar waveforms and every specialized area of digital signal processing, where the matched filter is designed in relation to the transmitted signal itself. The fundamental concept is still the same: utilize the knowledge of what is expected and suitably invert, delay and take its complex conjugate.

So far, we have learned how to map a symbol to a signal and then a signal back to a symbol. All of this was focused within each symbol duration . Later, we discuss the practical case of a bit stream and corresponding processes of modulation, waveform generation and detection.