Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views3 pages

Lab 6

Uploaded by

2008038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Lab 6

Uploaded by

2008038
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment No : 06

Design of FIR Filters Using Window Functions and Frequency Sampling

Objectives:
• Understand the design process of FIR filters including low-pass, high-pass, band-pass,
and band-stop filters.

• Explore the influence of window functions on FIR filter characteristics.

• Implement FIR filters using both windowing methods and frequency sampling
technique in Python.

• Analyze and compare filter responses to select the most appropriate method for a given
application.

Theory:
Finite Impulse Response (FIR) filters are essential tools in digital signal processing for
shaping signals by attenuating or passing specific frequency components. Unlike IIR
filters, FIR filters are inherently stable and often designed to have linear phase. Their
impulse response settles to zero in finite time, hence the name.

The windowing method involves truncating the ideal filter’s infinite impulse response
using a window function such as Hamming, Hanning, or Blackman. This makes the filter
realizable while shaping its frequency response. The choice of window affects the
sharpness of the filter and how well it suppresses unwanted frequencies.

Alternatively, the frequency sampling technique directly samples the desired frequency
response and uses inverse DFT to calculate time-domain coefficients. This gives more
design flexibility but may introduce distortion between frequency points.

Matlab code:

clc;

clear;

N = 51;

Fc = 0.3;
% Design FIR filters using different window methods

h_hamming = fir1(N-1, Fc, hamming(N));

h_hanning = fir1(N-1, Fc, hann(N));

h_blackman = fir1(N-1, Fc, blackman(N));

% Frequency response

[H1, w] = freqz(h_hamming, 1, 1024);

[H2, ~] = freqz(h_hanning, 1, 1024);

[H3, ~] = freqz(h_blackman, 1, 1024);

% Plotting

figure;

plot(w/pi, 20*log10(abs(H1)), 'b', 'LineWidth', 1.5); hold on;

plot(w/pi, 20*log10(abs(H2)), 'r', 'LineWidth', 1.5);

plot(w/pi, 20*log10(abs(H3)), 'g', 'LineWidth', 1.5);

grid on;

legend('Hamming', 'Hanning', 'Blackman');

xlabel('Normalized Frequency (\times\pi rad/sample)');

ylabel('Magnitude (dB)');

title('Frequency Response of FIR Filters Using Window Functions');

ylim([-100 10]);
Figure:

Fig 6.1:Frequency response of FIR low-pass


filters designed using Hamming, Hanning, and
Blackman windows.

Discussion:
Both windowing and frequency sampling techniques were applied to FIR filter design.
The windowing method was straightforward and produced filters with predictable
behavior. Among the windows used, the Blackman window delivered excellent stopband
attenuation but had a wider transition band, which can reduce precision. In contrast, the
frequency sampling method gave finer control over the passband and stopband edges,
although it showed some distortion between sampling points.

Choosing between the two methods depends on the application: where simplicity and
standard performance are enough, windowing is suitable. If customized frequency
shaping is needed, frequency sampling is more effective despite its complexity.

Conclusion
FIR filters were successfully designed using multiple techniques. The experiment
demonstrated that each method—windowing or frequency sampling has unique
advantages. Window-based filters are easier to design and implement, while frequency
sampling allows for detailed shaping of the frequency response. Understanding the
strengths and limitations of both methods helps in selecting the most appropriate filter
design strategy for real-world signal processing applications.

You might also like