MATLAB CODE TO DESIGN A CHEBYSHEV II BAND REJECT FILTER

CODE:



clear all
alphap=2;  %passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=[.1*pi,.5*pi]; % passband freq. in radians
ws=[.2*pi,.4*pi]; % stopband freq. in radians
%to find cutoff freq. and order of the filter
[n,wn]=cheb2ord(wp/pi,ws/pi,alphap,alphas) %syatem function of the filter
[b,a]=cheby2(n,alphap,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 =  3
wn =0.2000    0.4000
b =0.8622   -3.0407    5.9953   -7.2774    5.9953   -3.0407    0.8622
a =1.0000   -3.3568    6.2813   -7.2539    5.6903   -2.7480    0.7433
 

0 comments:

Post a Comment