In ithis lab, you will use different methods to desig a inoar phase FIR filter t
ID: 2267473 • Letter: I
Question
In ithis lab, you will use different methods to desig a inoar phase FIR filter that satisfies the following gain specifications (note chat guins are specified in dB) ws 025 For each of the following design methods, find the mninum length flter that ments the specei cations. Demonstrate graphically that your fler satisies the given specifications (ic, show plots that zoom in on the various transition regions with a grid L. Hanning windowing methol (i.e., directly create the truncated ideal filter and then multiply by the window funetion) 2. Matilabss fi- algorithm. 3. Parks MeClellan algorithm (firpm)Explanation / Answer
MATLAB Commands for Hamming Window
coding:
m=80; % The length of the Karnel%
n=0:1:m-1; %Defines Range of position value%
p=n-(m-1)/2; %Angle%
fc=0.1; %Define Cutoff frequency%
Z=sin(2*pi*fc*p)./(pi*p); %Define truncated Sinc function%
stem(n,Z);grid %To represent the discrete signal value & draw the grid lines%
title('Unit Sample Response of the sin function') %Define the title of the figure%
xlabel('n') %Define the label of on x axis%
ylabel('Z') %Define the label of on y axis%
figure; %To draw a figure%
[h,w]=freqz(Z); %get Frequency Response%
plot(w/pi,abs(h));grid
title('Frequency response of the sin function')
xlabel('Frequency')
ylabel('Amplitude')
figure;
s=2*pi*(n/(m-1)); %Angle%
w=0.54-0.46*cos(s); %Define Hamming window function%
stem(n,w);grid
title('Hamming Window')
xlabel('n')
ylabel('w')
figure;
t=Z.*w; %Multiplication of Hamming Window and sin function%
stem(n,t);grid
title('Multiplication of Hamming Window and sin function')
xlabel('n')
ylabel('t')
figure;
[h,w]=freqz(t);
plot(w/pi,abs(h));grid
xlabel('Frequency')
ylabel('Magnitude')
title('Frequency response of the windowed sin function')
figure;grid
freqz(t)
title('Frequency Response of the windowed sin function in dB')