Professional Documents
Culture Documents
%Code:
Fs=1000;
Wp = 2*40/Fs; Ws = 2*150/Fs;
[N,Wc] = cheb1ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby1(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)
1
ans =
ans =
%Code:
Fs=1000;
Wp1 = 2*60/Fs;
Wp2 = 2*200/Fs;
Ws1 = 2*10/Fs;
Ws2 = 2*250/Fs;
Wp=[Wp1,Wp2];
Ws=[Ws1,Ws2];
[N,Wc] = cheb1ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby1(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)
%%EXAMPLE 3
% Design a bandpassChebyshev type I filter with a passband of 60 Hz to
200 Hz, with less than 3
%dB of ripple in the passband, and 40 dB attenuation in the stopbands
that are 50 Hz wide on
%both sides of the passband:
%Code:
Fs=1000;
Wp1 = 2*60/Fs;
Wp2 = 2*200/Fs;
Ws1 = 2*10/Fs;
Ws2 = 2*250/Fs;
Wp=[Wp1,Wp2];
Ws=[Ws1,Ws2];
[N,Wc] = cheb2ord(Wp,Ws,3,60);
sprintf('Order of Butterworth Lowpass Filter is N=%d ',N)
sprintf('Cut-off Frequency of Butterworth Lowpass Filter is Wc=%f
',Wc)
[b,a] = cheby2(N,3,Wp);
zplane(b,a)
title('Pole-Zero Plot of System function H(z)')
[H,f]=freqz(b,a,512,Fs);
figure;
plot(f,abs(H))
title('Frequency Response of LP Digital Butterworth Filter')
figure;
freqz(b,a,512,Fs)
ans =
ans =
ans =
ans =