Professional Documents
Culture Documents
SUBMITTED
TO
Prof. Rajesh
Neelakandan
BY
Adhiraj Saxena
20BEC0298
Aim:Gain response of a FIR Lowpass Filter with different windows .
Program:
clc;clear all; close all;
% Design of a FIR lowpass filter using hamming window
Fp=2000; Fs=2500; dp=0.005; ds=0.005; FT=10000;
% Estimate the Filter Order
N = kaiord(Fp, Fs, dp, ds, FT)
% Design the Filter
[num2,den2] = fir1(N,2250/10000,hamming(N+1));
% Display the transfer function
% disp('Numerator coefficients are ');disp(num);
% disp('Denominator coefficients are ');disp(den);
For Function N:
function N = kaiord(Fp, Fs, dp, ds, FT)
% Computation of the length of a linear-phase
% FIR multiband filter using Kaiser’s formula
% dp is the passband ripple
% ds is the stopband ripple
% Fp is the passband edge in Hz
% Fs is the stopband edge in Hz
% FT is the sampling frequency in Hz.
% If none specified default value is 2
% N is the estimated FIR filter order
if nargin == 4,
FT = 2;
end
if length(Fp) > 1,
TBW = min(abs(Fp(1) - Fs(1)), abs(Fp(2) - Fs(2)));
else
TBW = abs(Fp - Fs);
end
Adhiraj Saxena
20BEC0298
clc;clear all; close all;
% Design of a FIR lowpass filter using hamming window
Fp=2000; Fs=2500; dp=0.005; ds=0.005; FT=10000;
% Estimate the Filter Order
%N = kaiord(Fp, Fs, dp, ds, FT)
N=46;
% Design the Filter
[num2,den2] = fir1(N,2250/10000,hamming(N+1));
% Display the transfer function
% disp('Numerator coefficients are ');disp(num);
% disp('Denominator coefficients are ');disp(den);
Output:
Adhiraj Saxena
20BEC0298
Adhiraj Saxena
20BEC0298
Conclusion: We wrote the MATLAB code to show the gain response of a FIR
Lowpass filter with different windows.
END
Adhiraj Saxena
20BEC0298