Sunday, October 7, 2018

matlab - How to apply two notch filters simultaneously


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



Answer



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.


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...