ADVANCED DSP FILTER RESPONSE...

by barkkathulla 2012-09-20 19:59:24

<font size=6><font color=#FF0000>%HIGH PASS FILTER</font></font>
disp('high pass filter');
wp=input('enter the pass band edge frequency wp=');
ws=input('enter the stop band edge frequency ws=');
ap=input('enter the pass band attenuation ap=');
as=input('enter the stop band attenuation as=');
[N wn]=CHEB1ORD(wp,ws,ap,as);
[b a]=CHEBY1(N,.5,wn,'high');
disp('THE ORDER OF THE FILTER N=');
disp(N);
disp('the cutoff frequency of the filter wn=');
disp(wn);
[h f]=freqz(b,a);
H=20*log10(abs(h));
subplot(2,2,2);
plot(f/pi,H);
title('HIGH PASS FILTER');
xlabel('normalized frequency');
ylabel('gain');
%BAND PASS FILTER
disp('band pass filter');
wp=input('enter the pass band edge frequency wp=');
ws=input('enter the stop band edge frequency ws=');
ap=input('enter the pass band attenuation ap=');
as=input('enter the stop band attenuation as=');
[N wn]=CHEB1ORD(wp,ws,ap,as);
[b a]=CHEBY1(N,.5,wn);
disp('THE ORDER OF THE FILTER N=');
disp(N);
disp('the cutoff frequency of the filter wn=');
disp(wn);
[h f]=freqz(b,a);
H=20*log10(abs(h));
subplot(2,2,3);
plot(f/pi,H);
title('BAND PASS FILTER');
xlabel('normalized frequency');
ylabel('gain');

%BAND STOP FILTER
disp(' band stop filter');
wp=input('enter the pass band edge frequency wp=');
ws=input('enter the stop band edge frequency ws=');
ap=input('enter the pass band attenuation ap=');
as=input('enter the stop band attenuation as=');
[N wn]=CHEB1ORD(wp,ws,ap,as);
[b a]=CHEBY1(N,.5,wn,'stop');
disp('THE ORDER OF THE FILTER N=');
disp(N);
disp('the cutoff frequency of the filter wn=');
disp(wn);
[h f]=freqz(b,a);
H=20*log10(abs(h));
subplot(2,2,4);
plot(f/pi,H);
title('BAND STOP FILTER');
xlabel('normalized frequency');
ylabel('gain');
PROG 73
clear all;
clc;
%LOW PASS FILTER
disp('low pass filter');
wp=input('enter the pass band edge frequency wp=');
ws=input('enter the stop band edge frequency ws=');
ap=input('enter the pass band attenuation ap=');
as=input('enter the stop band attenuation as=');
[N wn]=buttord(wp,ws,ap,as);
[b a]=butter(N,wn);
disp('THE ORDER OF THE FILTER N=');
disp(N);
disp('the cutoff frequency of the filter wn=');
disp(wn);
[h f]=freqz(b,a);
H=20*log10(abs(h));
subplot(2,2,1);
plot(f/pi,H);
821
like
0
dislike
0
mail
flag

You must LOGIN to add comments