Hi there,

I'm trying to design an IIR comb filter to keep only 10 Hz harmonics in a noisy signal which is periodic at 10 Hz for noise rejection. The comb filter should then have peaks at 10 Hz, 20 Hz, 30 Hz ... (probably up to 200 Hz), and low amplitude response for other frequencies.

This is the code I've been working on in MATLAB:

clc
clear
close all

% IIR peak filter design by pole placement
temp_tf=1;
fs=15000;

for i=1:5
fp=i*10;
bw=3;
radius=1-(bw/fs)*pi;
gain=1-radius;
% place complex conjugate poles at +- i*10 Hz
poleAngle=2*pi*(fp/fs);
zeroAngle=poleAngle;
zeroCoef = [1 0 1];
poleCoef = [1 -(radius * (exp(-1i * zeroAngle) + exp(j * zeroAngle))) radius^2];
peak_filt=tf(zeroCoef,poleCoef);
% multiply the transfer functions for overall response
temp_tf=temp_tf*peak_filt;
end

[num den] = tfdata(temp_tf, 'v');
[h,w]=freqz(num,den,fs/2);
figure(4)
xlim([1,400])
plot(abs(h))
title('Comb peak filter magnitude response')
xlim([1,400])
xlabel('f (Hz)')
ylabel('|H(f)|')
fvtool(num,den)

When I run the code, the figures I get look like complete mess.

I'm not too concerned about performance trade-offs at the moment - just trying to get a sensible response for now.

Cheers