1

I have a signal in time domain whose sample frequency is Fs=25600. I would like to remove from the fundamental F=285Hz and all its harmonics (2*F,3*F,etc). I tried to use the comb filter in Matlab using this code :

Fs=25600;
N=43;
BW=285;
Apass=200;
[b, a] = iircomb(N, BW/(Fs/2), Apass);
Hd= dfilt.df2(b, a);
x1 = filter(b, a, signal); 

Here is the spectrum of the original signal over the frequency interval up to around 400Hz enter image description here

Here is the result after applying the filter cited above: enter image description here I don't get the awaited result. Is there a way to accomplish this in Matlab?

chsafouane
  • 183
  • 1
  • 2
  • 8
  • Can you share the signal file with us? – learner Aug 20 '17 at 21:13
  • Can you please show your input and output signals, designed filter impulse response and frequency response etc, both as plots and as data files appreciated... – Fat32 Aug 20 '17 at 21:14
  • @Fat32 I've shared the spectra – chsafouane Aug 20 '17 at 21:27
  • Nice. What about the filter? Please also plot its frequency response. It's bettter if you plot the full spectrum of the filter. Not everybody has the access to the function **iircomb**. It will be better if you could also upload the filter coefficients *a* and *b* for similar reasons. – Fat32 Aug 20 '17 at 22:09

1 Answers1

1

You have a problem with the comb filter design. According to Matlab documentation the following line creates the filter you want:

[b,a] = iircomb(round(25600/285), 2*285/25600/35,'peak');

Looking at the frequency response of the designed filter: enter image description here

Seems to be able to solve your problem...

Fat32
  • 26,011
  • 3
  • 20
  • 46
  • @chsafouane Note that since your fundamental frequency $f_o=285$ Hz do not divide the sampling frequency $F_s = 25600$ Hz in an integer number of times, the **exact** notch/peak frequency you get will not be $285$ Hz by this design method, unless you change your sampling frequency properly. Also note that the Matlab function options *notch* and *peak* do not place the central frequencies at the same place. – Fat32 Aug 21 '17 at 15:33