[b, a] =
pei_tseng_notch (frequencies, bandwidths)
¶Return coefficients for an IIR notch-filter with one or more filter frequencies and according (very narrow) bandwidths
to be used with filter
or filtfilt
.
The filter construction is based on an allpass which performs a reversal of phase at the filter frequencies.
Thus, the mean of the phase-distorted and the original signal has the respective frequencies removed.
See the demo for an illustration.
Original source: Pei, Soo-Chang, and Chien-Cheng Tseng "IIR Multiple Notch Filter Design Based on Allpass Filter" 1996 IEEE Tencon doi: 10.1109/TENCON.1996.608814)
The following code
sf = 800; sf2 = sf/2; data=[[1;zeros(sf-1,1)],sinetone(49,sf,1,1),sinetone(50,sf,1,1),sinetone(51,sf,1,1)]; [b,a]=pei_tseng_notch ( 50 / sf2, 2/sf2 ); filtered = filter(b,a,data); clf subplot ( columns ( filtered ), 1, 1) plot(filtered(:,1),";Impulse response;") subplot ( columns ( filtered ), 1, 2 ) plot(filtered(:,2),";49Hz response;") subplot ( columns ( filtered ), 1, 3 ) plot(filtered(:,3),";50Hz response;") subplot ( columns ( filtered ), 1, 4 ) plot(filtered(:,4),";51Hz response;")
Produces the following figure
Figure 1 |
---|
Package: signal