Weird issues with 60 Hz noise filtering
3 Ansichten (letzte 30 Tage)
I am trying to evaluate the performance of a notch filter (for eliminating 60Hz noise) designed in Matlab. I am doing so by calculating spectrogram of the signal before and after filtering and then comparing the 'power' in the ~60 Hz bin of the spectrogram. Here is the code that I am using for that.
% taking spectrogram of the original signal
f(relrow) % this is around 60 Hz
fi_pre=medfilt1(s(relrow,:),11); % median filtering the spectrogram row to smooth it
xlabel('Median filter applied to 60Hz bin of spectrogram of ORIGINAL signal','fontsize',12,'fontweight','bold')
d = designfilt('bandstopiir','FilterOrder',2, ...
filtv = filtfilt(d,vdata(:,i+1));
% taking spectrogram of the filtered signal
xlabel('Median filter applied to 60Hz bin of spectrogram of FILTERED signal','fontsize',12,'fontweight','bold')
xlabel('First plot minus second plot','fontsize',12,'fontweight','bold')
Here is output of the code:
My expectation was that the 'power' values in the spectrogram of the filtered signal would be lower, but they are actually higher (note that the third plot is mostly below zero during the first half). The only times when they are lower are those when the original signal has 60 Hz noise. I find this strange. Why do you think this is happening? p.s. Its possible that my expectation or my method of evaluating a filter's performance is improper. I may be missing something very obvious to signal processing geeks. For the record this is how the signal looks like: