MATLAB Program for FIR(Finite Impulse Response) filter using Kaiser Window | IT1254 - DSP and Communications Systems Lab



AIM:
        To write a program for FIR filter like Low pass FIR filter, High pass FIR filter, Band pass FIR filter and Band stop FIR filter using Kaiser window using MATLAB in IT1254 - DSP and Communications Systems Lab.

ALGORITHM:

LOW PASS FILTER:
Step 1: Read the input sequence
Step 2: Perform low pass filter calculations
Step 3: Plot the output sequences

HIGH PASS FILTER:
Step 1: Read the input sequence
Step 2: Perform high pass filter calculations
Step 3: Plot the output sequences 

BAND PASS FILTER:
Step 1: Read the input sequence
Step 2: Perform band pass filter calculations
Step 3: Plot the output sequences 

BAND STOP FILTER:
Step 1: Read the input sequence
Step 2: Perform band stop filter calculations
Step 3: Plot the output sequences 

PROGRAM:
clc;
clear all;
format long;
rp=input('Enter the passband ripple(rp):');
rs=input('Enter the stopband ripple(rs):');
fp=input('Enter the passband
frequency(fp):');
fs=input('Enter the stopband frequency(fs):');
f=input('Enter the sampling frequency(f):');
beta=input('Enter the beta value:');
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=kaiser(n1,beta);
%Low pass filter
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
ylabel('Gain(db)->');
xlabel('(a)Normalised frequency->');
%High pass filter
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('Gain(db)->');
xlabel('(b)Normalised frequency->');
%Band pass filter
wn=[wp*ws];
b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('Gain(db)->');
xlabel('(c)Normalised frequency->');
%Band stop filter
wn=[wp*ws];
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('Gain(db)->');
xlabel('(d)Normalised frequency->');
OUTPUT:
Click to view full size image!

RESULT:
Thus the program for FIR Filter using Kaiser window was performed using MATLAB and the output sequences were drawn.

Previous
Next Post »

1 comments:

Write comments

Still not found what you are looking for? Try again here.