MATLAB CODE TO DESIGN A BUTTERWORTH BAND REJECT FILTER

CODE:

clear all
alphap=2;  %passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=[.2*pi,.4*pi]; % passband freq. in radians
ws=[.1*pi,.5*pi]; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[n,wn]=buttord(wp/pi,ws/pi,alphap,alphas) %syatem function of the filter
[b,a]=butter(n,wn,'STOP')
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('noramlised frequency')


OUTPUT:

n =  4
wn = 0.1950    0.4082
b =  0.4086   -2.0201    5.3798   -9.1468   10.8962   -9.1468    5.3798   -2.0201    0.4086
a =1.0000   -3.8710    7.9699  -10.6417   10.0781   -6.8167    3.2579   -1.0044    0.1670


1 comments:

  1. Nice. Thank you for sharing such thorough details. A few months back, I was looking for a band reject filter and looked in several places. However, the cost is high in a few nearby locations, so I started looking for the best website for band reject filters on the internet. Finally, I found anatech electronics one of the best website online for band reject filter. I was able to get all of my required filter at the greatest pricing in a short period of time. Pick anatech electronics to save your money on buying band reject filter.

    ReplyDelete