20bec0298 Labda6

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

LAB ASSIGNMENT 6

SUBMITTED
TO

Prof. Rajesh
Neelakandan
BY

Name: Adhiraj Saxena


Registration Number: 20BEC0298
Course Code: ECE2006
Slot: L29+L30

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


TBW = abs(Fp - Fs);
num = -20*log10(sqrt(dp*ds)) - 13;
den = 14.6*TBW/FT;
N = ceil(num/den);

% Design the Filter

[num2,den2] = fir1(N,2250/10000,hanning(N+1));
% Display the transfer function
% disp('Numerator coefficients are ');disp(num);
% disp('Denominator coefficients are ');disp(den);

% Compute the gain response


w = 0:pi/511:pi;
h2 = freqz(num2,den2,w);
g2 = 20*log10(abs(h2));

% Plot the gain response


plot(w/pi,g2,'linewidth',2);
grid
legend('hamming');
xlabel('\omega /\pi');
ylabel('Gain, dB');
title('Gain Response of a FIR lowpass filter with different windows');

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

You might also like