FIR Filter

Frequency Response of FIR Filter



Logic:

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.

Algorithm:

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.

Program:

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

subplot(2,2,1);

n=0:N-1;

stem(n,magnitude); %plot magnitude response

phaseplot=angle(XK); %find phase angle response

subplot(2,1,2)

stem(n,phaseplot); %plot phase plot

No comments:

Post a Comment

Your Comments... (comments are moderated)