100%
Delay Detection Accuracy
53.4 dB
Stopband Attenuation
99.8%
Tone Suppression
267
FIR Filter Taps
Overview
Project Summary
This project implements two fundamental digital signal processing tasks. Part A uses cross-correlation to accurately detect a time delay between an original signal and a degraded version corrupted by delay, exponential decay, and additive Gaussian noise. Part B designs a bandstop FIR filter using the window method to suppress an unwanted 1500 Hz tone from an audio recording without distorting the surrounding frequency content.
Both parts were implemented in MATLAB/Octave and demonstrate practical frequency-domain analysis and digital filtering techniques applicable to real-world engineering problems.
MATLAB
Octave
Cross-Correlation
FIR Filter Design
Window Method
FFT Analysis
DSP
Audio Processing
Signal Detection
Part A
Cross-Correlation Delay Detection
Objective: Detect the time delay between an original sinusoidal signal and a degraded copy that has been delayed, attenuated by exponential decay, and corrupted by additive Gaussian noise.
| Parameter |
Value |
| Signal Type | Truncated Sine Pulse |
| Period (N) | 20 samples |
| Window Length | 100 samples |
| Sampling Frequency (fs) | 1000 Hz |
| Applied Delay (D) | 30 samples |
| Exponential Decay Factor (α) | 0.98 |
| Noise Level (σ) | 0.1 (Gaussian) |
The degraded signal follows the model:
Signal Model
y(n) = α^n · x(n − D) + w(n)
Cross-Correlation
r_xy(m) = Σ x(n) · y(n + m)
Delay Estimate
D_estimated = argmax[ r_xy(m) ]
The cross-correlation function was computed between the original and modified signals. The lag at maximum correlation directly gives the delay estimate. Despite the presence of noise (σ = 0.1) and exponential decay (α = 0.98), the peak appeared precisely at lag = 30 samples — matching the applied delay with zero error.
| Result | Value |
| Expected Delay | 30 samples |
| Detected Delay | 30 samples |
| Detection Error | 0 samples (100% accurate) |
| Detection Method | xcorr() — cross-correlation |
Part B
Bandstop FIR Filter Design
Objective: Remove an unwanted 1500 Hz tone from an audio recording using a bandstop FIR filter designed via the window method, achieving at least 50 dB of stopband attenuation.
Detection: FFT analysis of the audio revealed a dominant spectral peak at f₀ = 1500 Hz with a magnitude of 1.4 × 10⁵. This became the suppression target.
| Specification | Value |
| Sampling Frequency (fs) | 44,100 Hz |
| Target Tone (f₀) | 1500 Hz |
| Stopband: ws1 – ws2 | 1475 – 1525 Hz (50 Hz bandwidth) |
| Passband edges: wp1, wp2 | 1455 Hz, 1545 Hz |
| Transition Width | ±20 Hz each side |
| Required Attenuation | ≥ 50 dB |
| Achieved Attenuation | 53.4 dB ✓ |
Normalized edge frequencies (rad/sample):
Normalized Frequencies
ωp1 = 2π(1455)/44100 = 0.207 | ωs1 = 2π(1475)/44100 = 0.210
ωs2 = 2π(1525)/44100 = 0.217 | ωp2 = 2π(1545)/44100 = 0.220
Cutoff Frequencies (Transition Midpoints)
ωc1 = (ωp1 + ωs1) / 2 = 0.2085 rad/sample
ωc2 = (ωs2 + ωp2) / 2 = 0.2185 rad/sample
Window Method
4-Step Design Process
01
Ideal Bandstop Filter Design
Derived from the difference of two ideal lowpass filters with cutoff frequencies ωc1 and ωc2. The ideal bandstop impulse response hd(n) is infinite in length — must be truncated.
02
Window Selection
Window type is chosen based on the minimum stopband attenuation requirement. For 50 dB, the Hamming window was selected (guarantees 53 dB). It is defined as w(n) = 0.54 − 0.46·cos(2πn/(M−1)).
03
Filter Length Calculation
M = ⌈3.3π / Δω⌉ = 267 samples (rounded up to nearest odd for Type I FIR symmetry). Odd length guarantees linear phase response — critical for audio quality.
04
Windowing — h(n) = hd(n) × w(n)
Element-wise multiplication truncates and tapers the ideal response, eliminating Gibbs phenomenon ripples while preserving the stopband notch and flat passband.
Design Decision
Window Comparison
The Hamming window was chosen as the most efficient option — it meets the 50 dB requirement without the longer filter length that Blackman would require. Using Blackman would increase filter length unnecessarily, adding computational cost with no functional benefit.
Ideal Bandstop Impulse Response
hd(0) = 1 − 2(ωc2 − ωc1) [at n = 0]
hd(n) = [sin(ωc1·n) − sin(ωc2·n)] / (π·n) [at n ≠ 0]
Filter Length Formula
M = ⌈3.3π / Δω⌉ = 267 taps (odd, ensures Type I linear phase)
Performance
Results & Outcomes
Part A — Cross-Correlation
Delay Detection
- 100% accurate delay detection (0 sample error)
- Detected 30-sample delay correctly despite σ = 0.1 noise
- Robust against exponential decay (α = 0.98)
- Periodic correlation peaks reflect sinusoidal signal period (N = 20)
Part B — FIR Filter
Tone Suppression
- Tone magnitude reduced from 140,000 → ~300 (99.8% suppression)
- 53.4 dB attenuation — exceeds the 50 dB requirement
- Linear phase preserved — no time-domain distortion
- Flat passband — surrounding frequencies unaffected
- Group delay τ_g = (M−1)/2 = 133 samples = 3.01 ms
Suppression Metric (Part B)
Suppression = |X(1500)| / |Y(1500)| = 140,000 / 300 ≈ 467×
Attenuation = 20·log₁₀(467) = 53.4 dB (target: ≥ 50 dB ✓)
Real-World Context
Applications
📡
Radar & Sonar
Cross-correlation for range and delay detection in ranging systems.
🔊
Audio Denoising
Bandstop filtering to remove mains hum (50/60 Hz) or interference tones.
📶
Communications
Timing recovery and synchronization using correlation-based delay estimation.
🩺
Biomedical Signals
FIR notch filters to remove powerline interference from ECG/EEG recordings.
🎙️
Echo Detection
Room impulse response estimation and acoustic echo cancellation.
🏭
Vibration Analysis
Suppressing specific frequency components in industrial sensor data.