FIR and IIR Comb FIlter
조회 수: 21 (최근 30일)
이전 댓글 표시
Hello, I'm trying to build an FIR and IIR comb filter to demonstrate different effects on a wav file, can anyone direct me to useful resources?
댓글 수: 0
채택된 답변
Star Strider
2020년 8월 29일
I like IIR filters, because at least in my experience they are computationally more efficient (specific elliptic designs), however it necessary to put them in series in a loop to do the same sort of thing.
One example:
Fs = 44100; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Rp = 1; % Passband Ripple (Attenuation)
Rs = 50; % Stopband Ripple (Attenuation)
pbmtx = [48 51] + (0:50:150).';
for k1 = 1:size(pbmtx,1)
Ws = pbmtx(k1,:)/Fn;
Wp = Ws + [-2 2]/Fn;
[n,Wp] = ellipord(Wp,Ws,Rp,Rs);
[z,p,k] = ellip(n,Rp,Rs,Wp,'stop');
[sos{k1},g(k1)] = zp2sos(z,p,k);
[h(:,k1),f] = freqz(sos{k1},2^14,Fs);
end
figure
hold on
for k = 1:size(pbmtx,1)
plot(f, db(abs(h(:,k))/max(abs(h(:,k))))) % Normalisation For Display Purposes, Since ‘freqz’ Does Not Always Calculate The Magnitudes Correctly
end
axis([min(f) 300 -100 10])
grid
Use filtfilt to do the actual filtering with respect to both of these, once with the FIR filter and in a loop with the IIR filters, with the input of one filter being the output of the filter in the previous iteration.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!