EXPERIMENT 10
OBJECTIVE
❖ To generate and analyze a composite signal consisting of three sinusoidal
components with frequencies 100 Hz, 120 Hz, and 320 Hz using a sampling
frequency of 1000 Hz, and duration from 0 to 1 second.
❖ To design and apply four FIR filters — Low Pass (cutoff: 250 Hz), High Pass
(cutoff: 150 Hz), Band Pass (100–310 Hz), and Notch (50 Hz) — to observe and
analyze their effect on the composite signal in both time and frequency domains.
.
THEORY
Digital filters are used to manipulate signals by attenuating unwanted components and
preserving desired ones. FIR (Finite Impulse Response) filters are widely used due to
their linear phase characteristics and inherent stability. Below are brief descriptions of
the filter types used:
● Low-Pass Filter (LPF): Allows frequencies below a certain cutoff frequency to
pass and attenuates higher frequencies.
● High-Pass Filter (HPF): Allows frequencies above a cutoff to pass and
attenuates lower frequencies.
● Band-Pass Filter (BPF): Allows a range of frequencies between two cutoff
points to pass and attenuates frequencies outside this band.
● Notch Filter (Band-Stop): Attenuates a narrow band of frequencies (in this
case, centered at 50 Hz) while allowing others to pass.
The Fast Fourier Transform (FFT) is used to analyze the frequency spectrum of the
original and filtered signals.
MATLAB CODE
t = 0:1/1000:1;
f1 = 100; f2 = 120; f3 = 320;
x = sin(2*pi*f1*t) + sin(2*pi*f2*t) + sin(2*pi*f3*t);
fs = 1000;
lpFilt = designfilt('lowpassfir', 'FilterOrder', 50, 'CutoffFrequency', 250, 'SampleRate', fs);
hpFilt = designfilt('highpassfir', 'FilterOrder', 50, 'CutoffFrequency', 150, 'SampleRate', fs);
bpFilt = designfilt('bandpassfir', 'FilterOrder', 50, 'CutoffFrequency1', 100, 'CutoffFrequency2', 310,
'SampleRate', fs);
notchFilt = designfilt('bandstopfir', 'FilterOrder', 50, 'CutoffFrequency1', 49, 'CutoffFrequency2', 51,
'SampleRate', fs);
y_lp = filter(lpFilt, x);
y_hp = filter(hpFilt, x);
y_bp = filter(bpFilt, x);
y_notch = filter(notchFilt, x);
figure;
subplot(5,1,1);
plot(t, x); title('Original Signal'); xlabel('Time (s)'); ylabel('Amplitude');
subplot(5,1,2);
plot(t, y_lp); title('Low Pass Filtered'); xlabel('Time (s)'); ylabel('Amplitude');
subplot(5,1,3);
plot(t, y_hp); title('High Pass Filtered'); xlabel('Time (s)'); ylabel('Amplitude');
subplot(5,1,4);
plot(t, y_bp); title('Band Pass Filtered'); xlabel('Time (s)'); ylabel('Amplitude');
subplot(5,1,5);
plot(t, y_notch); title('Notch Filtered (50 Hz Removed)'); xlabel('Time (s)'); ylabel('Amplitude');
X = abs(fft(x));
Y_lp = abs(fft(y_lp));
Y_hp = abs(fft(y_hp));
Y_bp = abs(fft(y_bp));
Y_notch = abs(fft(y_notch));
f = linspace(0, fs/2, length(X)/2);
figure;
subplot(5,1,1);
plot(f, X(1:end/2)); title('Original Signal Spectrum'); xlabel('Frequency (Hz)'); ylabel('Magnitude');
subplot(5,1,2);
plot(f, Y_lp(1:end/2)); title('Low Pass Filtered Spectrum'); xlabel('Frequency (Hz)');
ylabel('Magnitude');
subplot(5,1,3);
plot(f, Y_hp(1:end/2)); title('High Pass Filtered Spectrum'); xlabel('Frequency (Hz)');
ylabel('Magnitude');
subplot(5,1,4);
plot(f, Y_bp(1:end/2)); title('Band Pass Filtered Spectrum'); xlabel('Frequency (Hz)');
ylabel('Magnitude');
subplot(5,1,5);
plot(f, Y_notch(1:end/2)); title('Notch Filtered Spectrum (50 Hz Removed)'); xlabel('Frequency (Hz)');
ylabel('Magnitude');
OUTPUT
1) Time domain Output
2) Frequency domain Output
DISCUSSION
A composite signal of 100 Hz, 120 Hz, and 320 Hz was filtered using low-pass, high-
pass, band-pass, and notch FIR filters. The low-pass filter removed the 320 Hz
component, the high-pass removed 100 Hz and 120 Hz, and the band-pass retained
100–120 Hz while attenuating 320 Hz. The notch filter, targeting 50 Hz, had no effect as
50 Hz was absent. Frequency spectra confirmed the expected filter responses,
validating their design and functionality.
CONCLUSION
The experiment demonstrates the application of FIR filters for selective frequency
attenuation in a composite signal. Each filter type serves a distinct purpose, and their
effects are clearly visible in both time and frequency domains. The notch filter technique
is especially useful in practical scenarios where specific frequency noise needs to be
suppressed (e.g., 50 Hz power line interference). This lab validates the theoretical
understanding of FIR filter behavior and underscores their importance in digital signal
processing applications.