Frequency Response of FIR Filter
Frequency response of the FIR filter refers to the DTFT of the impulse response or otherwise we need to find the impulse response of the FIR system. Since there is no command available to find DTFT directly, in MATLAB we can make use of "fft" command. As we know DFT of a sequence is the described form of DTFE, by taking the length of the DFT more and more (Eg: N=512 or 1024 etc) we can resembles the response to the DTFT.
DTFT of x(n) is defined as x(ejw)= summation from n=-infinity to infinity of x(n)e-jwn
1. Input the impulse response h(n).
2. Input the length of the DFT.
3. Find the DFT of the sequence h(n) using "fft" and "angle" commands.
x=input('Enter the impulse function');
N=input('Enter the length of the DFT');
XK=fft(x,N); %find DFT using fft algorithm
magnitude=abs(XK); %find magnitude response
stem(n,magnitude); %plot magnitude response
phaseplot=angle(XK); %find phase angle response
stem(n,phaseplot); %plot phase plot