0
$\begingroup$

I have a sound file that I need to apply a notch filter to in Matlab.

comparing to original file I have two frequencies which are the noise. Applying a notch filter like this one:

wo = 1750/(44100/2);  bw = wo/35;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
f1 = filter(b, a, f);

This will atenuate the frequency at 1750 Hz. However there is one more frequency that is causing trouble at 820Hz. What I can do is reapply the same notch to the "new" version:

wo = 820/(44100/2);  bw = wo/35;
[b,a] = iirnotch(wo,bw);
fvtool(b,a);
f2 = filter(b, a, f1);

and f2 will be my clean file. However I need to have one vector "b" and one vector "a" that will clean all the noise at one go. Can I apply two notches simultaneously? I am very new to this kind of stuff. Thanks

$\endgroup$
2
$\begingroup$

You want to concatenate the two filters, which is equivalent to convolving the $a$ and $b$ coefficients of the individual notch filters to obtain the coefficients of the resulting filter with two notches.

$\endgroup$
  • $\begingroup$ Could you help me with one more thing? What if I have noise at multiples of a given frequency. For example 400,800,1200... Obviously i don't want to apply notches at all of those points. i would like to kill them all at once. Is it possible? Thank you. $\endgroup$ – Scavenger23 Dec 19 '18 at 15:18
  • $\begingroup$ @KuderaSebastian: If you want to kill them all you need notches at each frequency, so you do exactly the same as in the case of only two narrow-band noise sources. $\endgroup$ – Matt L. Dec 19 '18 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.