FIR and IIR Comb FIlter
17 views (last 30 days)
Show older comments
Cian O'Farrell
on 29 Aug 2020
Answered: Star Strider
on 29 Aug 2020
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 Comments
Accepted Answer
Star Strider
on 29 Aug 2020
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 Comments
More Answers (0)
See Also
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!