Skip to main content

Matched Filter Explained


Matched Filter: Theory and MATLAB Example

A matched filter is a linear filter designed to maximize the signal-to-noise ratio (SNR) for detecting a known signal in the presence of additive noise. It is widely used in communications, radar, and sonar.

1. Definition

If the known signal is s(t) with duration T, the impulse response of the matched filter is:

h(t) = s*(T - t)

In discrete time, for a signal s[n] of length N:

h[n] = s*[N-1-n]

2. Example: Rectangular Pulse

Consider a simple rectangular pulse:

s(t) = {

  1, 0 ≤ t ≤ 2

  0, elsewhere

}

Matched filter:

h(t) = s(2 - t)
s(t):      ┌───────┐
           |       |
───────────┘       └────────
           0       2

h(t):              ┌───────┐
                   |       |
───────────--------        |
          0        2

3. MATLAB Simulation Example

We can implement a simple matched filter in MATLAB using a rectangular pulse:

% MATLAB Code: Matched Filter Example

% Parameters
T = 2;           
Fs = 100;        
t = 0:1/Fs:T-1/Fs;  

s = ones(1,length(t));

noise = 0.5*randn(size(s)); 
r = s + noise;

h = fliplr(s);

y = conv(r,h);

t_y = 0:1/Fs:(length(y)-1)/Fs;

figure;

subplot(3,1,1);
plot(t,s,'LineWidth',2);
title('Transmitted Signal s(t)');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(3,1,2);
plot(t,r,'LineWidth',1.5);
title('Received Signal r(t) = s(t) + Noise');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(3,1,3);
plot(t_y,y,'LineWidth',2);
title('Matched Filter Output y(t)');
xlabel('Time (s)');
ylabel('Amplitude');

Explanation:

  • s is the known transmitted pulse.
  • r is the received signal corrupted by Gaussian noise.
  • h is the matched filter (time-reversed pulse).
  • y is the convolution output showing a peak at the point of maximum alignment, which corresponds to the detection instant.
The peak of y(t) corresponds to the maximum correlation between the received signal and the known pulse, demonstrating the matched filter's ability to detect the signal in noise.

Peak Location of the Matched Filter Output

The peak of the matched filter output does not necessarily occur at the midpoint of the pulse. It occurs at the end of the pulse duration (t = T), which is the point where the entire pulse has “slid” across the filter.

1. Why the peak is at t = T

Matched filter:

h(t) = s(T - t)

Output:

y(t) = ∫₀แต€ r(ฯ„) · h(t - ฯ„) dฯ„
  • At t = 0 → small overlap → small output
  • As t increases → overlap increases → output grows
  • At t = T → full alignment → maximum output

2. Example with numbers

Pulse s[n] = [1, 2, 3], duration T = 3 samples
Matched filter h[n] = [3, 2, 1]

Convolution output y[n] = s[n] * h[n] = [3, 8, 14, 8, 3]

  • n = 0 → small
  • n = 1 → larger
  • n = 2 → peak
  • n > 2 → output decreases

Peak occurs where the full pulse aligns with the filter, not at the midpoint.

4. Summary

Matched filters leverage the known structure of a signal to produce a maximum output at the detection instant, allowing reliable detection even in the presence of noise. The impulse response is always the time-reversed and conjugated version of the transmitted signal. MATLAB simulation confirms that the filter output peaks exactly when the received pulse is aligned with the filter.

If you want, I can draw a tiny diagram showing the sliding pulse and peak at t = T — it really helps people see why it’s the end of the pulse, not the middle, that matters.

Further Reading

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

ASK, FSK, and PSK (with MATLAB + Online Simulator)

๐Ÿ“˜ Overview ๐Ÿ“˜ Amplitude Shift Keying (ASK) ๐Ÿ“˜ Frequency Shift Keying (FSK) ๐Ÿ“˜ Phase Shift Keying (PSK) ๐Ÿ“˜ Which of the modulation techniques—ASK, FSK, or PSK—can achieve higher bit rates? ๐Ÿงฎ MATLAB Codes ๐Ÿ“˜ Simulator for binary ASK, FSK, and PSK Modulation ๐Ÿ“š Further Reading ASK or OFF ON Keying ASK is a simple (less complex) Digital Modulation Scheme where we vary the modulation signal's amplitude or voltage by the message signal's amplitude or voltage. We select two levels (two different voltage levels) for transmitting modulated message signals. For example, "+5 Volt" (upper level) and "0 Volt" (lower level). To transmit binary bit "1", the transmitter sends "+5 Volts", and for bit "0", it sends no power. The receiver uses filters to detect whether a binary "1" or "0" was transmitted. ...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

๐Ÿ“˜ Overview of BER and SNR ๐Ÿงฎ Online Simulator for BER calculation ๐Ÿงฎ MATLAB Code for BER calculation ๐Ÿ“š Further Reading ๐Ÿ“‚ View Other Topics on M-ary QAM, M-ary PSK, QPSK ... ๐Ÿงฎ Online Simulator for Constellation Diagram of m-ary QAM ๐Ÿงฎ Online Simulator for Constellation Diagram of m-ary PSK ๐Ÿงฎ MATLAB Code for BER calculation of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Code for BER calculation of Alamouti Scheme ๐Ÿงฎ Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for Bit Error Rate, which indicates how many corrupted bits are received compared to the total number of bits sent. BER = (number of bits received in error) / (total number of transmitted bits) What is Signal-to-Noise Ratio (SNR)? SNR is the ratio of signal power to noise powe...

Calculation of SNR from FFT bins in MATLAB

๐Ÿ“˜ Overview ๐Ÿงฎ MATLAB Code for Estimation of SNR from FFT bins ๐Ÿงฎ MATLAB Code for SNR from PSD using Kaiser Window ๐Ÿ“š Further Reading Here, you can find the SNR of a received signal from periodogram / FFT bins using the Kaiser operator. The beta (ฮฒ) parameter characterizes the Kaiser window, which controls the trade-off between the main lobe width and the side lobe level. Steps Set up the sampling rate and time vector Compute the FFT and periodogram Calculate the frequency resolution and signal power Exclude the signal power from noise calculation Compute the noise power and SNR MATLAB Code for Estimation of SNR from FFT bins clc; clear; close all; % Parameters fs = 8000; f_tone = 1000; N = 8192; t = (0:N-1)/fs; % Generate signal + noise signal = sin(2*pi*f_tone*t); SNR_true_dB = 20; signal_power = mean(signal.^2); noise_power = signal_power / (10^(SNR_true_dB/10)); noisy_signal = signal + sqrt(noise_power) * randn(1, N); % Apply ...

MATLAB Code for ASK, FSK, and PSK (with Online Simulator)

๐Ÿ“˜ Overview & Theory ๐Ÿงฎ MATLAB Code for ASK ๐Ÿงฎ MATLAB Code for FSK ๐Ÿงฎ MATLAB Code for PSK ๐Ÿงฎ Simulator for binary ASK, FSK, and PSK Modulations ๐Ÿ“š Further Reading ASK, FSK & PSK HomePage MATLAB Code MATLAB Code for ASK Modulation and Demodulation % The code is written by SalimWireless.Com % Clear previous data and plots clc; clear all; close all; % Parameters Tb = 1; % Bit duration (s) fc = 10; % Carrier frequency (Hz) N_bits = 10; % Number of bits Fs = 100 * fc; % Sampling frequency (ensure at least 2*fc, more for better representation) Ts = 1/Fs; % Sampling interval samples_per_bit = Fs * Tb; % Number of samples per bit duration % Generate random binary data rng(10); % Set random seed for reproducibility binary_data = randi([0, 1], 1, N_bits); % Generate random binary data (0 or 1) % Initialize arrays for continuous signals t_overall = 0:Ts:(N_bits...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   Start Simulator for binary ASK Modulation Message Bits (e.g. 1,0,1,0) Carrier Frequency (Hz) Sampling Frequency (Hz) Run Simulation Simulator for binary FSK Modulation Input Bits (e.g. 1,0,1,0) Freq for '1' (Hz) Freq for '0' (Hz) Sampling Rate (Hz) Visualize FSK Signal Simulator for BPSK Modulation ...

Constellation Diagrams of ASK, PSK, and FSK with MATLAB Code + Simulator

๐Ÿ“˜ Overview of Energy per Bit (Eb / N0) ๐Ÿงฎ Online Simulator for constellation diagrams of ASK, FSK, and PSK ๐Ÿงฎ Theory behind Constellation Diagrams of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Codes for Constellation Diagrams of ASK, FSK, and PSK ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Constellation Diagrams of ASK, PSK, and FSK ... ๐Ÿงฎ Simulator for constellation diagrams of m-ary PSK ๐Ÿงฎ Simulator for constellation diagrams of m-ary QAM BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals...

Comparing Baseband and Passband Implementations of ASK, FSK, and PSK

๐Ÿ“˜ Overview ๐Ÿงฎ Baseband and Passband Implementations of ASK, FSK, and PSK ๐Ÿงฎ Difference betwen baseband and passband ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Baseband and Passband ... ๐Ÿงฎ Baseband modulation techniques ๐Ÿงฎ Passband modulation techniques   Baseband modulation techniques are methods used to encode information signals onto a baseband signal (a signal with frequencies close to zero). Passband techniques shift these signals to higher carrier frequencies for transmission. Here are the common implementations: Amplitude Shift Keying (ASK) [↗] : In ASK, the amplitude of the signal is varied to represent different symbols. Binary ASK (BASK) is a common implementation where two different amplitudes represent binary values (0 and 1). ASK is simple but susceptible to noise. ASK Baseband (Digital Bits) ASK Passband (Modulated Carrier)     Fig 1:  ASK Passband Modulation (...

LDPC Encoding and Decoding Techniques

๐Ÿ“˜ Overview & Theory ๐Ÿงฎ LDPC Encoding Techniques ๐Ÿงฎ LDPC Decoding Techniques ๐Ÿ“š Further Reading 'LDPC' is the abbreviation for 'low density parity check'. LDPC code H matrix contains very few amount of 1's and mostly zeroes. LDPC codes are error correcting code. Using LDPC codes, channel capacities that are close to the theoretical Shannon limit can be achieved.  Low density parity check (LDPC) codes are linear error-correcting block code suitable for error correction in a large block sizes transmitted via very noisy channel. Applications requiring highly reliable information transport over bandwidth restrictions in the presence of noise are increasingly using LDPC codes. 1. LDPC Encoding Technique The proper form of H matrix is derived from the given matrix by doing multiple row operations as shown above. In the above, H is parity check matrix and G is generator matrix. If you consider matrix H as [-P' | I] then matrix G will b...