how to design IIR highpass filter with cutoff frequency of 20Hz and FIR bandpass filter with cutoff frequency of 10Hz and 15Hz?
조회 수: 7 (최근 30일)
이전 댓글 표시
Fs = 8000;
Fn = Fs/2;
Wp = 20/Fn;
Ws = 3/Fn;
Rp = 0.2;
Rs = 40;
[n,Wn] = buttord(Wp,Ws,Rp,Rs);
[b,a] = butter(n,Wn,'high');
[sos,g] = tf2sos(b,a);
figure(1)
freqz(sos, 2048, Fs)
댓글 수: 0
채택된 답변
Star Strider
2016년 5월 18일
I can’t design a fir filter to those specifications with any of the fir design functions, regardless of the order of the filter. The normalised frequencies are simply too low and the passband too narrow.
The best I can do is a Chebyshev Type II filter:
Fs = 8000;
Fn = Fs/2;
Wp = [10 15]/Fn;
Ws = [ 6 25]/Fn;
Rp = 10;
Rs = 40;
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs);
[b,a] = cheby2(n,Rs,Ws);
[sos,g] = tf2sos(b,a);
figure(2)
freqz(sos, 2^16, Fs)
set(subplot(2,1,1), 'Xlim', [0 25])
set(subplot(2,1,2), 'Xlim', [0 25])
I also had to increase the fft length 2^16 and narrow the frequency axis to [0 25] to see the details of the passband. Note that a Chebyshev Type II filter has a flat passband, so you can state the passband ripple, ‘Rp’, to be essentially anything you want.
If you want a fir bandpass filter with those characteristics, you would probably have to design separate highpass and lowpass filters and cascade them. The best way to do this would be with dfilt objects, using dfilt.cascade.
댓글 수: 17
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!