Assignment 1.
In practical communication and signal processing systems, useful signals are often
corrupted by broadband noise. The objective is to extract a narrowband signal of interest (50
Hz) from a noisy environment using digital bandpass filters.
This experiment compares the performance of FIR and IIR bandpass filters using:
1. MATLAB’s designfilt() (algorithmic design)
2. MATLAB Filter Designer exported filters (tool-based design)
A cosine signal of frequency 50 Hz is generated and corrupted by additive white Gaussian
noise.
• 𝑓𝑠 = 1000Hz
• 𝑡 = 0 → 1s
• 𝑛(𝑡)is Gaussian noise
FIR Bandpass Filter Design (designfilt):
Parameter Value
Stopband 1 < 40 Hz
Passband 45–55 Hz
Stopband 2 > 60 Hz
Ripple 1 dB
Type Linear-phase FIR
IIR Bandpass Filter Design (designfilt):
Parameter Value
Half power points 40 Hz & 60 Hz
Filter type Butterworth
Order 6
Phase Non-linear
designfilt() is used when filters need to be created directly inside MATLAB programs
for simulation, automation, or real-time signal processing, because it allows filter specifications
to be defined numerically and modified easily through code. It is ideal for script-based and
repeatable designs where parameters may change dynamically.
On the other hand, Filter Designer (filterDesigner) is a graphical tool used when
visual inspection and interactive tuning of filter characteristics such as magnitude response,
phase, and group delay are required. It is especially useful for understanding filter behavior,
experimenting with different specifications, and validating designs before exporting them to
MATLAB code. In practice, designfilt() is preferred for implementation and automation, while
Filter Designer is preferred for analysis, visualization, and verification.
Observation:
Digital filters, particularly IIR filters, contain internal memory elements whose initial
states are set to zero. When a sinusoidal signal is applied, the filter requires a short settling
period before reaching its steady-state response. During this transient phase, the output may
appear distorted or nearly flat before it gradually matches the expected waveform.
In addition, linear-phase FIR filters introduce a fixed group delay of approximately
(N−1)/2(N-1)/2(N−1)/2 samples. At the beginning of processing, the filter does not yet have
enough past input samples to compute a full output, so the initial outputs are close to zero.
This causes the filtered sine wave to appear delayed relative to the original signal.
The FFT comparison is used to evaluate how effectively the FIR and IIR filters remove noise
while preserving the desired signal frequency. By computing the FFT of the original signal, the noisy
signal, and the filtered outputs, all spectra are normalized and plotted on the same frequency axis.
This makes it easy to observe the reduction of unwanted frequency components outside the passband.
In the comparison plot, the noisy signal shows a raised noise floor across a wide range of frequencies,
whereas both FIR and IIR filtered signals exhibit a strong peak at the desired frequency and significant
attenuation elsewhere. The FIR filter generally shows a smoother and more uniform passband
response, while the IIR filter provides a sharper cutoff with lower filter order. Thus, FFT comparison
visually confirms the noise suppression capability and frequency selectivity of both filters.