Professional Documents
Culture Documents
(ii)
(iii)
(iv)
Algorithm:
1. For Butterworth LPF & HPF, input PB & SB attenuations, PB & SB
frequencies and sampling frequencies.
2. Normalize PB & SB frequencies.
3. Find the order, cut-off frequency and transfer function of the filter
using the corresponding equations.
4. Define the frequency range and find the frequency response.
5. Plot the magnitude and phase responses.
6. For Butterworth BPF & BRF, input PB & SB attenuations, PB & SB
edge frequencies.
7. Repeat steps 2-5.
Command window
wp=(2*fp)/f;
ws=(2*fs)/f;
inputs
angular frequency
plot(w/pi,p);
grid on;
title('phase resp of IIR BW LPF');
xlabel('normalised frequency');
ylabel('phase');
%BW HPF
[b,a]=butter(N,wc,'high');
..
..
Follow similar steps in LPF
%BW BRF
[b,a]=butter(N,wc,'stop');
..
..
Follow similar steps in LPF
(ii)
(iii)
(iv)
Algorithm:
1. For Chebyshev 1 & 2 LPF & HPF, input PB & SB attenuations, PB &
SB frequencies.
2. Normalize PB & SB frequencies.
3. Find the order, cut-off frequency and transfer function of the filter
using the corresponding equations.
4. Define the frequency range and find the frequency response.
5. Plot the magnitude and phase responses.
6. For Chebyshev 1 & 2 BPF & BRF, input PB & SB attenuations, PB &
SB edge frequencies.
7. Repeat steps 2-5.
Program:
Chebyshev-I Filter
clc;
clear all;
close all;
disp('C-I LPF and HPF');
%C-I LPF
ap=input('Enter pb attn in dB: ');
as=input('Enter sb attn in dB: ');
wp=input('Enter pb freq in rad: ');
ws=input('Enter sb freq in rad: ');
[N,wc]=cheb1ord(wp/pi,ws/pi,ap,as);
[b,a]=cheby1(N,ap,wc);
..
..
Follow similar steps in LPF
%C-I HPF
[b,a]=cheby1(N,ap,wc,'high');
..
..
Follow similar steps in LPF
%C-I BRF
[b,a]=cheby1(N,ap,wc,'stop');
..
..
Follow similar steps in LPF
Chebyshev-II Filter
disp('C-II LPF and HPF');
%C-II LPF
ap=input('Enter pb attn in dB: ');
as=input('Enter sb attn in dB: ');
wp=input('Enter pb freq in rad: ');
ws=input('Enter sb freq in rad: ');
[N,wc]=cheb2ord(wp/pi,ws/pi,ap,as);
[b,a]=cheby2(N,as,wc);
..
..
Follow similar steps in LPF
%C-II HPF
[b,a]=cheby2(N,as,wc,'high');
..
..
Follow similar steps in LPF
%C-II BRF
[b,a]=cheby2(N,as,wc,'stop');
..
..
Follow similar steps in LPF
Output:
C-I LPF and HPF
Enter pb attn in dB: 1
Enter sb attn in dB: 15
Enter pb freq in rad: 0.2*pi
Enter sb freq in rad: 0.3*pi
C-I BPF and BRF
Enter pb attn in dB: 2
Enter sb attn in dB: 20
Enter pb edge1 and edge2 freq : [0.2*pi,0.4*pi]
Enter sb edge1 and edge2 freq : [0.1*pi,0.5*pi]
C-II LPF and HPF
Enter pb attn in dB: 1
Enter sb attn in dB: 15
Enter pb freq in rad: 0.2*pi
Enter sb freq in rad: 0.3*pi
C-II BPF and BRF
Enter pb attn in dB: 2
Enter sb attn in dB: 20
Enter pb edge1 and edge2 freq : [0.2*pi,0.4*pi]
Enter sb edge1 and edge2 freq : [0.1*pi,0.5*pi]