Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Designing an IIR comb (peak) filter

Status
Not open for further replies.

bobby_k

Newbie level 1
Joined
Sep 3, 2019
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
17
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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top