Application notes

Implementing a matched filter for radar and waveform triggering using the Moku:Pro FIR Filter Builder

Learn how to implement a matched filter using the Moku:Pro FIR Filter Builder

Accurate detection of signal presence in noisy channels is critical for many applications, from time-of-flight ranging methods like radar and LiDAR to security engineering and hardware penetration tests. The matched filter is the optimal filter design for presence and time-of-arrival detection of a known signal. This application note presents a demonstration of the effectiveness of the matched filter using the Moku:Pro FIR Filter builder with the Arbitrary Waveform Generator. Through this demonstration, we showcase the effectiveness of Moku:Pro in rapid signal detection applications.

Introduction to the matched filter

Improving the signal-to-noise ratio (SNR) in communication and radar systems is a critical requirement for enhancing detection accuracy. The matched filter is a widely employed technique to improve SNR performance when the shape of the waveform of interest is known. This contrasts with conventional filters with passbands and/or stopbands defined in the frequency domain, or the boxcar averager, which aims to eliminate time-domain elements. 

This application note provides a detailed exposition on the theory behind the matched filter. Additionally, we demonstrate two applications of the matched filter on Moku:Pro. 


Matched filtering provides high output power when the input signal “matches” a known template. A simple example is to design a matched filter that matches a cycle of a sine wave of known frequency. This filter provides a high-power output whenever a sine wave of that frequency is present in the input signal and as a result forms a simple on-off keying (OOK) digital communications receiver.

To demonstrate the efficacy of matched filtering in this configuration, we conducted a simulation, presented in Figure 1. The system’s native SNR was -3.01 dB, but implementing a matched filter improved this significantly to 18.74 dB. This result highlights the effectiveness of matched filtering to enhance the SNR performance without increasing the transmitted power.

Figure 1: Demonstration of efficacy of a matched filter. (a): Transmitted noiseless signal with data of 010110, (b): Received signal with large additive white noise, no bit can be decoded with a regular decoding algorithm, (c): The matched filter output of the noiseless transmitted signal, (d): The matched filter output of the noisy received signal. In both the ideal and noisy channel, all the modulated bits are decoded correctly.

Derivation of the matched filter 

Derivation based on continuous signals

The conventional signal model for a filtered receiving signal is expressed by Equation 2.1.1, where y(t) denotes the received signal, p(t) represents the transmitted signal, and h(t) signifies the receiving filter designed to optimize the signal-to-noise ratio of the received signal. The presence of additive noise in the channel is expressed as n(t). Furthermore, the processed signal and noise are respectively represented by p_{\text{o}}(t) and n_{\text{o}}(t): 

where y(t) denotes the received signal, p(t) represents the transmitted signal, and h(t) signifies the receiving filter designed to optimize the signal-to-noise ratio of the received signal.

Parseval’s Law[1] states that the total signal power and noise power in the time domain are equivalent to their corresponding powers in the frequency domain. Moreover, n(t) is typically assumed to be additive white noise, with its power spectral density (PSD) S_{n}(f) = S_{n} being independent of frequency. Following this fundamental principle, the expected power of n(t) is constant in time, with an expected power of is constant in time, with an expected power of \sigma_{n}^2 resulting from the multiplication of the PSD of the noise signal S_{n} and the PSD of the receiving filter |H(f)|^2.

The power of the received signal p_{o}(t_{m})^2 at time t_{m} varies with the sampling time t_{m} due to the non-time-invariant nature of the PSD of the transmitted signal. The PSD is given by |P(f)e^{j2\pi ftm}|^2. such that:

Therefore, the SNR at t_{m}, denoted p^2(t_{m}), can be expressed as:

To solve Equation 2.1.3 and find the condition for optimized SNR, we apply the Cauchy-Schwarz inequality. The condition for maximized SNR performance for a known transmitted signal is shown in Equation 2.1.4.

And the derived optimal filter, i.e., matched filter is given in Equation 2.1.5.

Where S_{n} = \frac{N}{2},  k' = \frac{2k}{N} and T_{o} is the length of the signal. The choice of t_{m} = T_{o} leads to a filter with the shortest delay while still being casual. Additionally, the constant multiplier k' scales the noise and single equally and can therefore be omitted from the analysis.

Extension to a digital system

The expression in Equation 2.1.5 is the optimal filter in continuous time. To give a quantitative comparison, we will now analyze the SNR performance of the discrete time digital system.

In Equation 2.2.1, the length of the matched filter is {N} and the expected noise power is E(|n_{o}[\tau ]|^2). The formula considers the the digitized channel noise n[\tau ], matched filtered noise n_{o}[\tau ], and matched filter’s impulse response h[\tau ]:

The rightmost part of E(n[\tau  - l_{1}]n[\tau - l_{2}]) in Equation 2.2.1 is the correlation of the white noise. Equation 2.2.2 indicates that the noise power has non-zero value only if l_{1} = l_{2}. The digitized matched filter h[l] is derived from Equation 2.1.5, h[l] = p[N - 1 - l] and the noise after the matched filtering is shown in Equation 2.2.3:

The peak power of the matched filter output is given by Equation 2.2.4. The matched filter output peak power is the square of the energy of the transmitted pulse because the matched filter impulse response h[l] is the time-reverse transmitted pulse p[N - 1 - l]:

Therefore, the SNR at the peak of the output signal becomes the formula in Equation 2.2.5. Note that the power of the transmitted signal is given by \frac{1}{N} \sum_{\tau = 0}^{N - 1}  |p[\tau ]|^2 and the noise power is given by \sigma_{n}^2:

The SNR improvement rate accords with the SNR increase in the simulation in the Introduction section. That simulation showed a 21.75 dB SNR improvement with a 150-sample filter, and the quantitative analysis gives 10 \; {log}(150) = 21.76 \; dB enhancement.

Applications of the matched filter 

In this section, we introduce and explain two applications of the matched filter: radar distance sensing (pulse compression) and waveform triggering. 

Radar pulse compression 

In the first example, we will examine radar pulse compression. In a radar system, a transmitter emits a burst of radio waves toward a target. The radar receiver then listens for the return echoes reflected by the target. The time of flight, or range delay, allows us to calculate the distance to the target. 

This application bears resemblance to the communication example shown in Figure 1, as both radar and communication systems are designed to detect signals in noisy receiving environments. A conventional radar lacking a matched filter requires a high transmitting power to be effectively implemented, and its range resolution is significantly restricted by the length of the transmitting pulse. 

To address this issue, a matched filter can be used to compress the received pulse in time. A narrow pulse output from the filter gives the best spatial resolution, while the actual transmitted signal can remain broad to increase transmitted energy and therefore boost SNR without requiring high power. Specifically, a chirp (sine wave of linearly increasing frequency) is often used as the transmitted signal due to its narrow autocorrelation and relative simplicity of generation. 

Theory and derivation

Richards [2] derived Equation 3.1.1, which specifies the ambiguity function of the complex envelope of chirp waves, with \beta representing the banduitch of the chirp and τ denoting the time width of the chirp wave: 

The range resolution of the radar is determined by the Rayleigh resolution, which is the distance between the peak and the first null point. The peak of A(t, 0) is observed at t = 0, and the first null occurs when the argument of the numerator equals \pi , i.e., when \beta t(1 - \frac{|\tau |}{\tau \pm }) = 1. For 1 > 0, this equation can be expressed as Equation 3.1.2:

The roots can be expressed as t = \frac {1}{2}(\tau \pm \sqrt {t^2 - \frac {4\tau }{\beta })}= \frac {1}{2} \tau (1 \pm \sqrt {1 - \frac {4 }{\beta \tau })}. Choosing the negative sign yields the positive root that is closest to the center point (t = 0), thereby determining the Rayleigh resolution in time domain. This result can be simplified with the Taylor series expansion of the square root in Equation 3.1.3:

Thus, the Rayleigh resolution in time \Delta t is approximately \frac {1}{\beta } seconds. The corresponding Rayleigh range resolution is \Delta R meters in Equation 3.1.4, with the factor of two due to the round trip of the transmitted signal.



An important point to note is that an Arbitrary Waveform Generator (AWG) like the one in Moku:Pro generates just the real component of the chirp wave instead of its complex envelope. This leads to a divergence in the ambiguity functions of the complex envelope and sinusoid function.

The ambiguity function outlined earlier was based on the complex envelope of the received signal, however, for the sake of simplicity, the Hilbert transform was not included. For a detailed explanation of the complex envelope and related discussions, please refer to Mahafza[3].

The derivation of the ambiguity function of the real-valued sinusoidal chirp wave is challenging as it involves the Fresnel integral and manipulation of the trigonometric identities. Instead, we’ll illustrate the effect of using only the real component by examining the simple, non-modulated complex exponential wave case.

The matched filtering equation for the complex envelope of a simple non-modulated complex exponential function can be expressed as:





Equation 3.1.5 indicates that the nulls of complex exponential ambiguity function are the combined nulls of the real part and imaginary part. The magnitudes of {a} and {b} are the largest when the time offset τ is zero, whereas the magnitudes of {c} and {d} are largest at a time offset τ of after period (i.e., \frac {\pi }{2} radians), which corresponds to the nulls of the real parts ({a} + {b}). As a result, half the nulls of the ambiguity function are cancelled due to misalignment of real and imaginary nulls and peaks. Removing the imaginary component removes these cancellations and doubles the number of nulls.

Counterintuitively, the Rayleigh resolution is improved by approximately a factor of two for the real function compared to the full complex envelope.This illustration using the complex exponential is a general result that we can apply to our original chirp wave, as verified by simulation (Figure 2). The updated Rayleigh time resolution and range resolution values using a purely real waveform are then:

Figure 2: Comparison of the ambiguity functions of a received real-valued chirp (\beta = 1000) (red) and the complex envelope of the received signal (blue). 

The Rayleigh resolution \Delta \tau determines the minimum resolution for radar in time. Figure 3 (a) shows the matched filter output of two chirps separated by exactly \Delta \tau overlapping constructively, resulting in a flat top, which. the peak detector identifies as a single peak. In theory, when the targets are separated by any more than this, a small dip will be expected, allowing for successful separation. However, in practical applications, a small dip can be obscured by noise and it’s common to require that the filter output nominally drop to zero between pulses before two pulses can confidently be distinguished from each other. As such, this application note will focus on the demonstrations with a null-to-null width of 2\Delta \tau .

Figure 3: (a): Constructively overlapped matched filter output with a distance of \Delta \tau , (b): matched filter output with 2\delta \ tau separation nominally drops to zero between pulses. improving the chances of them being clearly distinguished in a noisy environment. 

Pulse compression with Moku:Pro

In contrast to the simulation described in the introduction which used a simple on/off keyed sine wave, the simulation in this section uses a sinusoidal chirp with a large bandwidth to achieve a better Rayleigh range resolution. Figure 4 illustrates that the main lobe width of the chirp pulse is narrower compared to the sine pulse. 

Figure 4: (a-c) The same simulation as the OOK sine wave from the introduction, run with a chirp instead. (d) The matched filter output from chirp (orange) has a much smaller main lobe width than the sine wave (blue), even in the presence of overwhelming channel noise. 

The Moku:Pro Multi-instrument Mode configuration used for validation in the following sections is depicted in Figure 5. In this setup, the Arbitrary Waveform Generator (AWG) is responsible for generating two different chirp waves, with Channel B having half the bandwidth of Channel A. We use the FIR Filter Builder (FIR) to implement matched filters for the chirp waves generated by the AWG. As a result, we expect the Rayleigh resolution for Channel B output to be half that of Channel A.

Figure 5: Moku:Pro Multi-instrument Mode configuration used for testing and validation. 

Using the AWG, we define the chirp wave using the Equation waveform type. The defining equations are shown in Equation 3.1.7: 

Figure 6: AWG generated chirp wave, Channel A (red) is twice of the bandwidth of Channel B (blue). 

The AWG generated a chirp waveform with a 200 Hz repetition rate and pulse modulation to generate chirp pulses. The equivalent bandwidth of Channel A chirp waveform is 40,000 Hz. Therefore, we expect the smallest null-to-null width 2Δ𝑡 of the combined Channel A and B waveform to be: 

The FIR filter was configured as a matched filter by loading a kernel whose values were the chirp wave values, reversed in time, as per equation (3.1.10). The setup of the FIR filter is shown in Figure 7. The width of the input chirp wave and the sampling period determine the number of filter coefficients. 

The length of the AWG waveform and the FIR filter kernel is the same, and the kernel shares the same shape as the generated wave. Therefore, the equation of the FIR filter for Channel A can be written as Equation 3.1.10: 

Figure 7: FIR Filter Builder Channel A configuration. 

We have now set up the transmit waveform generation and matched filtering in the AWG and FIR respectively and can examine the effects of the pulse compression. The red curve shows the output of the Channel A matched filter, the blue curve shows the output of Channel B. The blue curve has a width that is twice that of the red curve, which confirms the earlier result, proving that the time resolution of the filter output is inversely proportional to the bandwidth. The distances between the first two nulls agree with the theorem in Equation 3.1.8. 

Figure 8: Pulse compression experiment based on Moku:Pro. Red curve has a bandwidth two times larger than that of the blue curve and the range resolution of the red curve is 1/2 of the blue curve. 

Figure 8: Pulse compression experiment based on Moku:Pro. Red curve has a bandwidth two times larger than that of the blue curve and the range resolution of the red curve is 1/2 of the blue curve. 

At this point, we have completed the theory and simulation. The next step is to apply matched filtering on the chirp pulse with real noise included. The results shown in Figure 10 indicate that the matched filter performs well for large noise power (-73.98 dBm) and small signal power (-93.46 dBm). 

Figure 9: Experimental setup of the chirp matched filter in noisy environments. 

Figure 10: Power of the received signal input to the matched filter (blue) and matched filter output (red). The spike in matched filter output power clearly indicates the time of arrival of the chirp despite it being invisible to the naked eye in the received signal. 

An interesting property of pulse compression is revealed by the analysis of Figure 8. The output of the matched filter for the chirp wave with a larger bandwidth has a minimum null-to-null width of 25 us and a pulse width of 5 ms. Thus, the matched filter can distinguish two overlapping reflecting chirp waves with a time distance larger than 25 us. Figures 11 and 12 display the result of the Moku:Pro experiment. Figure 11 shows the noise-free validation run, with the two overlapping chirps shown in blue and the matched filter output in red. Figure 12 shows the same experiment but with the chirps having been received on a noisy channel. In both cases, the arrival times of the two chirps are clearly distinguished from each other, and correctly found to be separated by 25 us. It is worth noting that the detected time interval may exhibit a minor variation from the transmitted time separation due to the presence of non-zero side lobes in the ambiguity function. 

Figure 11: Two overlapping chirp pulses with same bandwidth and time width, but a 25 us time offset (blue). The matched filter output correctly recovers the 25 us time between chirps (red). 

Figure 11: Two overlapping chirp pulses with same bandwidth and time width, but a 25 us time offset (blue). The matched filter output correctly recovers the 25 us time between chirps (red). 

Figure 12: Matched filter output of two overlapping chirp waves (red), compared to the received signal before filtering (blue). 


Waveform triggering

Digital pattern triggering, a common oscilloscope feature, involves performing logical operations on received digital signals and triggering the oscilloscope based on specific patterns. For instance, a user can set an oscilloscope to trigger only when the least significant eight bits of a digital signal are high. This feature is critical for analyzing the behavior of digital systems in various scenarios. 

However, in applications like chip fault injection and side-channel analysis, the signal is usually collected from a radio frequency receiver which may result in a high level of noise and low signal amplitude. In such cases, digital pattern triggering can result in numerous false alarms, giving incorrect information about the chip behavior.  

One solution to address the issues with digital pattern triggering is to use waveform triggering. Waveform triggering uses a matched filter to continuously compare an incoming analog signal to an expected waveform and generate a trigger event when the expected waveform is seen. 

Traditional oscilloscopes do not provide enough flexibility for such waveform triggering, requiring instead a dedicated “trigger box” [4]. Moku:Pro with Multi-instrument Mode, on the other hand, allows users to deploy the FIR Filter Builder and Oscilloscope instruments simultaneously for waveform triggering and oscilloscope measurements. The waveform in Figure 13 is recreated from Beckers et al. [4] and shows power rail anomalies captured while a microprocessor encodes a data packet using Advanced Encryption Standard (AES). The detection of such an operation can then be used to launch fault injection attacks or to sample auxiliary data for later analysis. 

It should be noted that Beckers et al. [4] improved their results by using an envelope detector in front of the triggering algorithm. Such an operation can be completed on Moku:Pro by building a simple piece of custom logic using Moku Cloud Compile (MCC) and deploying it before the FIR instrument. 

Figure 13: AES single execution pattern

If the waveform trigger will initiate sampling and recording auxiliary data, users may prefer that the trigger event as seen by the Oscilloscope occurs at the start of the matched waveform, rather than its end. In this case, extra FIR filter channels can be set up in an “all-pass” configuration, introducing a pure time delay equal to the length of the matched filter. 

Figure 14 demonstrates the successful generation of the trigger signal by the FIR Filter Builder, as seen on the Oscilloscope (blue). Additionally, the FIR Filter Builder has accurately delayed the unfiltered input signal, allowing users to capture the triggering waveform in its entirety for later examination. The simulation results presented in Figure 14 (a) were obtained using low-speed embedded processor waveforms with a slow sampling rate of 610 kSa/s, whereas Figure 14 (b) depicts results obtained using modern ARM processor waveforms with a sampling rate of 10 MSa/s. Despite the lower input signal SNR observed in Figure 14 (a), it is notable that the matched filter output SNR surpasses that of Figure 14 (b) due to the increased number of FIR taps and smaller noise bandwidth. To ensure accurate triggering during high-speed waveform capturing, the inclusion of pre-amplifiers is essential [4]. Moreover, the utilization of the matched output’s power (orange) to achieve improved detection accuracy can be implemented effortlessly using MCC. 

Figure 14: Oscilloscope triggered by the matched filter output (blue). FIRdelayed input signal (red). Power of the matched filter output (orange). 


This application note provides theoretical and empirical evidence to support the use of the matched filter as the optimal receiving filter for detection of the time of arrival of a known waveform. To verify the introduced concepts, we conducted a series of experiments using Moku:Pro Multi-instrument Mode, the Arbitrary Waveform Generator, and the FIR Filter Builder to transmit and detect signals. Furthermore, the study explores the use of the matched filter in communication, radar pulse compression, and waveform triggering domains to highlight its efficacy in signal processing. The obtained results demonstrate the ability of Moku:Pro to reliably detect receive events in real-time, even in the presence of large noise power.


[1] B. P. Lathi and Z. Ding, Modern digital and analog communication systems, International 4th ed. in The Oxford series in electrical and computer engineering. New York Oxford: Oxford University Press, 2010.

[2] M. A. Richards, Fundamentals of radar signal processing, Third edition. New York: McGraw Hill, 2022.

[3]B. R. Mahafza, Radar Systems Analysis And Design Using Matlab®, Third Edition.

[4] A. Beckers, J. Balasch, B. Gierlichs, and I. Verbauwhede, “Design and Implementation of a Waveform-Matching Based Triggering System,” in Constructive Side-Channel Analysis and Secure Design, F.-X. Standaert and E. Oswald, Eds., in Lecture Notes in Computer Science, vol. 9689. Cham: Springer International Publishing, 2016, pp. 184–198. doi: 10.1007/978-3-319-43283-0_11.

Questions or want a printable version? 

Contact Liquid Instruments Support