BUTTERWORTH BAND PASS FILTER MATLAB PROGRAM

BUTTERWORTH BAND PASS FILTER


 


 

alphap=2;    %Passband attenuation in dB

alphas=20;    %stopband attenuatio in dB

wp=[.2*pi,.4*pi];    %Passband frequency in radians

ws=[.1*pi,.5*pi];    %Stopband frequency in radians

%To find cutoff frequency and order of the filter

[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas);

%system function of the filter

[b,a]=butter(n,wn);

w=0:.01:pi;

[h,ph]=freqz(b,a,w);

m=20*log(abs(h));

an=angle(h);

subplot(2,1,1);

plot((ph/pi),m);

grid;

ylabel('Gain in dB');

xlabel('Normalised frequency');

subplot(2,1,2);

plot((ph/pi),an);

grid;

ylabel('phase in radians');

xlabel('Normalised frequency');


 

0 comments: