BUTTERWORTH LOW PASS FILTER MATLAB PROGRAM


 

BUTTERWORTH LOW PASS FILTER


 


 

alphap=4;    %Passband attenuation in db

alphas=30;    %Stopband attenuation in db

fp=400;    %Passband frequency in hz

fs=800;    %Stopband frequency in hz

F=2000;    %Sampling frequency in hz

omp=2*fp/F;oms=2*fs/F;

%To find cutoff frequency and order of the filter

[n,wn]=buttord(omp,oms,alphap,alphas);

%system function of the filter

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

w=0:.01:pi;

[h,om]=freqz(b,a,w,'whole');

m=abs(h);

an=angle(h);

subplot(2,1,1);

plot(om/pi,20*log(m));    

grid;

ylabel('Gain in db');

xlabel('Normalised frequency');

subplot(2,1,2);

plot(om/pi,an);

grid;

ylabel('phase in redians');

xlabel('Normalised frequency');

0 comments: