I'm trying to figure out why this stopband filter to remove 60Hz noise makes things worst.
d=designfilt('bandstopiir','FilterOrder',20','HalfPowerFrequency1',58,'HalfPowerFrequency2',62,'SampleRate',31500);fvtool(d)
As you can see the response looks like what I would expect. However, upon applying it to my signal, the 60Hz harmonic looks worst:
out = filter(d,SAMPLE);figure;plot(tt,SAMPLE,'r',tt,out,'b');xlabel('Time (sec)');ylabel('Amplitude (counts');legend({'SAMPLE','out (filtered)'});
Even the power density plots imply that the 60Hz signal and surrounding frequencies were actually amplified:
[pSAMPLE,fSAMPLE]=periodogram(SAMPLE,[],length(SAMPLE),31500);[pOut,fOut]=periodogram(out, [], length(out), 31500);figure;plot(fSAMPLE,20*log10(abs(pSAMPLE)),'r',fOut,20*log10(abs(pOut)),'b');xlabel('Frequency (Hz)');ylabel('dB')
Now admittedly, I'm very new to DSP processing. But, can anyone point out what I'm doing wrong? Shouldn't the periodogram of the filtered signal essentially be SAMPLE's periodogram multipled by the filter (fvtool) response? Thanks for any help! -Scott
Best Answer