MATLAB: Design FIR filter using cot off frequency

fir filter

Design a low pass digital FIR filter using Hamming window with length of the filter, N = 9 and a cut off frequency of 1.2 rad/sec. Further plot the magnitude and phase response of the designed filter

Best Answer

Clc;
Clear all;
Close all;
N=9; %number of samples
wc=1.2; %cut of frequncy wc=(2*fc/fs); f=corner freq., fs=sampling freq.
b=fir1(N,wc/pi,hamming(N+1));
w=0:0.01:1.2*pi;
h=freqz(b,1,w);
subplot(211);
plot(w/pi,20*log(abs(h)));
title('Magnitude response(dB)');
xlabel('Frequency(*pi rad/sample)');
ylabel('magnitude in dB');
subplot(212);
plot(w/pi,phase(h));
title('Phase response');
xlabel('Frequency(*pi rad/sec)');
ylabel('Phase in radians');
Related Question