You are on page 1of 3

%Write a MATLAB program to design Chebyshev-II Low

Pass Filter.
%Programme:
clc; %Clear the window
close all; %Close all files
clear all; %Clear the screen
Ap=input('Enter the passband attenuation in dB: ');
As=input('Enter the stopband attenuation in dB: ');
f1=input('Enter the Passband digital
frequency(between 0 to 1): ');
f2=input('Enter the Stopband digital
frequency(between 0 to 1): ');
fs=1;
L=((10^(.1*As))-1);
fc=f1
N=ceil((acosh(sqrt(L)))/acosh(f2/fc))
[b,a]=cheby2(N,As,fc)
w=0:.01:pi;
[H,NF]=freqz(b,a,w);
M=20*log10(abs(H));
subplot(2,1,1)
plot((NF/pi),M)
title('Magnitude Response');
xlabel(' (a) Normalized Frequency -->');
ylabel(' Gain in dB -->');
an=angle(H);
subplot(2,1,2)
plot((NF/pi),an)
title('Phase Response');
xlabel(' (b) Normalized Frequency -->');
ylabel(' Phase in Radians -->');
COMMAND WINDOW
Enter the passband attenuation in dB: 10
Enter the stopband attenuation in dB: 50
Enter the Passband digital frequency(between 0 to 1): 0.5
Enter the Stopband digital frequency(between 0 to 1): 0.6

fc =

0.5000

N=

11

b=

Columns 1 through 9

0.0353 0.1607 0.4465 0.8844 1.3582 1.6707 1.6707 1.3582 0.8844

Columns 10 through 12

0.4465 0.1607 0.0353

a=

Columns 1 through 9

1.0000 0.4636 2.1485 1.2185 1.8473 1.0466 0.7948 0.3697 0.1613

Columns 10 through 12

0.0492 0.0108 0.0012

OUTPUT

You might also like