MATLAB CODE TO DESIGN A CHEBYSHEV I BANDPASS 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]=cheb1ord(wp/pi,ws/pi,alphap,alphas) %syatem function of the filter
[b,a]=cheby1(n,alphap,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('noramlised frequency')

OUTPUT:


n =3
wn =0.2000    0.4000
b =0.0083         0   -0.0248         0    0.0248         0   -0.0083
a =1.0000   -3.2632    5.9226   -6.6513    5.0802   -2.3909    0.6307



1 comments: