MATLAB CODE TO DESIGN A CHEBYSHEV II LOWPASS FILTER

CODE:



clear all
alphap=1;  %passband attenuation in dB
alphas=20; %stopband attenuation in dB
wp=.2*pi; % passband freq. in radians
ws=.3*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)
w=0:.01:pi;
[h,ph]=freqz(b,a,w);
m=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.3000
b =0.7164   -0.3652    1.0067   -0.3652    0.7164
a =1.0000   -0.6698    1.1096   -0.2540    0.5234


0 comments:

Post a Comment