Experiment 8
Experiment 8
Experiment 8
AIM:
Develop a MATLAB program to create a digital FIR filter using windowing techniques.
Window techniques
1) Hamming Window
2) Kaiser Window
Specifications
passband edge frequency: 1800 Hz,
stopband edge frequency: 2600 Hz
maximum passband ripple: 0.5 dB,
minimum stopband damping: 40 dB,
sampling rate: 8 kHz.
sample sinusoids at frequencies: a. f1=500 Hz b. f2=1800 Hz c. f3=2000 Hz d. f4=3200 H
THEORY:
The FIR filter design consists of two steps;
IN LAB EXERCISE:
Q1) Design following filters using rectangular window and black man window with given
specifications
a) Low pass (Wp=0.5, ws=0.6, delp=0.1,dels=0.1,Fs=8KHz)
SOLUTION:
%Self Made Function
wp = 0.5;
ws = 0.6;
Wp = (wp+ws)/2;
delp = 0.1;
dels = 0.1;
Fs = 8000;
N = ceil((-20*log10(min(delp,dels)) - 7.95) / (14.36 * (ws- wp) /
(2*pi)));
% Design FIR filters using
custom and built-in window
functions
[b_blackman, a_blackman] =my_fir1(N, Wp, 'blackman');
[b_rect, a_rect] = my_fir1(N,Wp, 'rectangular');
% Plot frequency response
freqz(b_blackman,a_blackman);
hold on;
freqz(b_rect, a_rect);
legend('Blackman Window', 'Rectangular Window');
function [b, a] = my_fir1(N, Wn, window)
% FIR filter design using the window method with custom window
formula
if nargin < 3
window = 'rectangular'; % Default to rectangular window if not
specified
end