Sunday, 17 September 2017

MATLAB Program for FIR Bandpass Filter

function fir1() is used for the design of FIR filter.You can refer the MATLAB product help for the syntax of these functions. The program for an FIR bandpass filter is given below.

% Program to design FIR bandpass filter .

close all;
clear all;

fp=input('Enter the start and stop frequency of the pass band');
f=input(' Enter the sampling frequency');
n=input(' Enter the order of the filter');

% Normalizing the frequencies

wp=(2/f).*fp;

%Calculation of filter coefficients

b=fir1(n,wp);

%Plotting the filter response

freqz(b,1,500,f);
TITLE('Magnitude and Phase response');


%output
%Enter the start and stop frequency of the pass band[1000 2000]
%Enter the sampling frequency 5000
%Enter the order of the filter 50

No comments:

Post a Comment