DSP EXP 6


EXP NO 6 TITLE:  TO STUDY THE EFFECTS OF DIFFERENT WINDOWS ON FIR FILTER RESPONSE




clc
clear all
close all
N = input('Enter the order ');
fs = input('Enter the sampling freq ');
fc = input('Enter the cutoff freq ');
wc = fc/(fs/2);
wc1 = (fc/2)/(fs/2);
%lowpass
figure(1)
h1 = fir1(N,wc,'low',rectwin(N+1));
freqz(h1,1,1024,fs);
title('Low pass rectangular');
figure(2)
h2 = fir1(N,wc,'low',hamming(N+1));
freqz(h2,1,1024,fs);
title('Low pass Hamming');
figure(3)
h3 = fir1(N,wc,'low',hanning(N+1));
freqz(h3,1,1024,fs);
title('Low pass hanning');
figure(4)
h4 = fir1(N,wc,'low',blackman(N+1));
freqz(h4,1,1024,fs);
title('Low pass blackman');
%highpass
figure(5)
h1 = fir1(N,wc,'high',rectwin(N+1));
freqz(h1,1,1024,fs);
title('High pass rectangular');
figure(6)
h2 = fir1(N,wc,'high',hamming(N+1));
freqz(h2,1,1024,fs);
title('High pass Hamming');
figure(7)
h3 = fir1(N,wc,'high',hanning(N+1));
freqz(h3,1,1024,fs);
title('High pass hanning');
figure(8)
h4 = fir1(N,wc,'high',blackman(N+1));
freqz(h4,1,1024,fs);
title('High pass blackman');

%bandpass
figure(9)
h1 = fir1(N,[wc1 wc],'bandpass',rectwin(N+1));
freqz(h1,1,1024,fs);
title('Band pass rectangular');
figure(10)
h2 = fir1(N,[wc1 wc],'bandpass',hamming(N+1));
freqz(h2,1,1024,fs);
title('Band pass Hamming');
figure(11)
h3 = fir1(N,[wc1 wc],'bandpass',hanning(N+1));
freqz(h3,1,1024,fs);
title('Band pass hanning');
figure(12)
h4 = fir1(N,[wc1 wc],'bandpass',blackman(N+1));
freqz(h4,1,1024,fs);
title('Band pass blackman');
%band stop
figure(13)
h1 = fir1(N,[wc1 wc],'stop',rectwin(N+1));
freqz(h1,1,1024,fs);
title('Band stop rectangular');
figure(14)
h2 = fir1(N,[wc1 wc],'stop',hamming(N+1));
freqz(h2,1,1024,fs);
title('Band stop Hamming');
figure(15)
h3 = fir1(N,[wc1 wc],'stop',hanning(N+1));
freqz(h3,1,1024,fs);
title('Band stop hanning');
figure(16)
h4 = fir1(N,[wc1 wc],'stop',blackman(N+1));
freqz(h4,1,1024,fs);
title('Band stop blackman');
Previous Post Next Post