Introduction
In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time. For a causal discrete-time FIR filter of order N, each value of the output sequence is a weighted sum of the most recent input values:
FIR Filter Specifications
Following points are usually considered to design FIR filter other the window type.
INPUT:
• Window Type
• Passband and stopband ripples
• passband and stopband edge frequencies
• sampling frequency
• order of the filter
• window coefficients
OUTPUT:
• magnitude and phase responses
Entering Input Paramters
clc;clear all;close all; rp=input('enter the passband ripple(Example:0.02):');
rs=input('enter the stopband ripple(Example:0.01):');
fp=input('enter the passband freq(Example:1500):');
fs=input('enter the stopband freq(Example:2000):');
f=input('enter the sampling freq(Example:6000):');
Matlab Function – FIR1
wp=2*fp/f;ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem);
n1=n+1;
if (rem(n,2)~=0)
n1=n;
n=n-1;
end
y=hamming(n1);
% low-pass filter
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
figure,plot(o/pi,m);title('FIR Filter Response');ylabel('Gain in dB');xlabel('Normalised frequency');
Input – Low Pass Filter