Sei sulla pagina 1di 5

EX NO:6

IIR FILTER DESIGN

AIM:
To design a butterworth low pass and high pass filter and a chebyshev low pass and high pass filter.

BUTTERWORTH LOW PASS FILTER CODING:


clc clear all; wp=input('enter the pass band frequency'); ws=input('enter the stop band frequency'); ap=input('enter the pass band atteneaution'); as=input('enter the stop band atteneaution'); [n,wn] = buttord(wp,ws,ap,as); disp('the order of the filter is'); n [b,a] = butter(n,wn,'low'); freqz(b,a)

OUTPUT: enter the pass band frequency.2 enter the stop band frequency.4 enter the pass band atteneaution-3 enter the stop band atteneaution-20 the order of the filter is n =3

Magnitude (dB)

-50 -100 -150 -200

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Phase (degrees)

-100

-200

-300

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

BUTTERWORTH HIGH PASS FILTER CODING:


clc clear all; wp=input('enter the pass band frequency'); ws=input('enter the stop band frequency'); ap=input('enter the pass band atteneaution'); as=input('enter the stop band atteneaution'); [n,wn] = buttord(wp,ws,ap,as); disp('the order of the filter is'); n [b,a] = butter(n,wn,'high'); freqz(b,a)

OUTPUT: enter the pass band frequency.4 enter the stop band frequency.2 enter the pass band atteneaution-3

enter the stop band atteneaution-20 the order of the filter is n =3


0

Magnitude (dB)

-50

-100

-150

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Phase (degrees)

-100 -200 -300 -400

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

CHEBYSHEV TYPE 1 LOW PASS FILTER CODING:


clc clear all; wp=input('enter the pass band frequency'); ws=input('enter the stop band frequency'); ap=input('enter the pass band atteneaution'); as=input('enter the stop band atteneaution'); [n,wn] = cheb1ord(wp, ws, ap, as); disp('the order of the filter is'); n [b,a] = cheby1(n,wp,wn,'low'); freqz(b,a)

OUTPUT: enter the pass band frequency.2

enter the stop band frequency.4 enter the pass band atteneaution-3 enter the stop band atteneaution-20 the order of the filter is n=3
0

Magnitude (dB)

-50 -100 -150 -200

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Phase (degrees)

-100

-200

-300

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

CHEBYSHEV TYPE 1 HIGH PASS FILTER CODING:


clc clear all; wp=input('enter the pass band frequency'); ws=input('enter the stop band frequency'); ap=input('enter the pass band atteneaution'); as=input('enter the stop band atteneaution'); [n,wn] = cheb1ord(wp, ws, ap, as); disp('the order of the filter is'); n [b,a] = cheby1(n,wp,wn,'high'); freqz(b,a)

OUTPUT: enter the pass band frequency.4 enter the stop band frequency.2 enter the pass band atteneaution-3 enter the stop band atteneaution-20 the order of the filter is n =3
0

Magnitude (dB)

-50

-100

-150

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

Phase (degrees)

-100 -200 -300 -400

0.1

0.2

0.3 0.4 0.5 0.6 0.7 0.8 Normalized Frequency ( rad/sample)

0.9

RESULT: Thus the butterworth and chebyshev filters are designed and normalized frequency vs magnitude and phase graphs are plotted.

Potrebbero piacerti anche