MATLAB CODE TO DESIGN A CHEBYSHEV I LOWPASS FILTER

CODE:


clear all
alphap=1;  %passband attenuation in dB
alphas=15; %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]=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 =4
wn =0.2000
b =0.0018    0.0073    0.0110    0.0073    0.0018
a =1.0000   -3.0543    3.8290   -2.2925    0.5507
 

0 comments:

Post a Comment