I ran a finite-difference simulation and the behavior of an output signal, $s$, in time, $t$ (sampled with period $\Delta t$) behaves approximately as in the figure below. It is well-described by a slowly-varying pulse plus a rapidly oscillating signal of the same envelope with lower amplitude.

signal with noise

For concreteness, I computed this sample signal in MATLAB with the following code.

f_noise = 20;
t = linspace(-4,4,2e3);
signal = exp(-t.^2);
noise = 0.25*exp(-t.^2).*sin(2*pi*f_noise*t);
signal_w_noise = signal + noise;

I emphasize that this is just a sample signal and not the actual data I want to analyze.

I wish to compute the "time-average" of the signal. By this I mean the signal without the rapidly oscillating component (which we could call noise). To get a clear picture of the problem, I calculated the Fourier transform of the signal approximately using MATLAB's fft function and obtained the spectra below.

spectra of signal and signal with noise

From this plot, I suspect a notch-filter could do the trick. However, I know very little of signal processing and I know how to use first-order filters from undergraduate electric-circuit courses. What is a simple to use but effective notch-filter I could use? I am particularly looking for the transfer function in the frequency domain of such notch-filter, because the software I use to generate the data is equipped with a FFT algorithm, so I'd like to do the processing there and avoid exporting the whole data to, say, MATLAB.

  • 3
    $\begingroup$ you can get a simple and effective second-order IIR notch filter from this. sorry i haven't done a pdf copy with decent math markup. i dunno why i haven't. $\endgroup$ – robert bristow-johnson Oct 19 '17 at 3:28
  • $\begingroup$ Using a notch filter means that you know the frequency of your noise. If that is the case, why don't you give us a little more detail about your application, maybe it could help propose a better solution than the notch filter. $\endgroup$ – Pier-Yves Lessard Nov 19 '17 at 3:21
  • $\begingroup$ Could you share the signal samples? $\endgroup$ – Royi May 18 '18 at 5:09

i might also recommend a low-pass filter over a notch filter unless the OP is absolutely certain, in advance, what the frequency of the "noise" is. if the OP has less information about the high-frequency noise that the OP desires to remove (leaving the moving average), then a LPF with DC gain of 1 (or 0 dB) and a cutoff frequency lower than the lowest expected frequency component in the noise is indicated. not a notch filter.

whether it's a Kaiser-windowed-sinc FIR or an IIR LPF (perhaps a simple 2nd-order IIR suffices) is a design and performance issue.

but i would not recommend a notch unless it is known apriori that the "noise" is sinusoidal and what the frequency of the sinusoidal "noise" is.

| improve this answer | |

I would suggest that you use a lowpass filter rather than a notch filter to filter out the noise (assuming the signal is slow varying with respect to noise as mentioned). Use a FIR low pass filter designed by Kaiser Window Method (Ref: Chapter 7, Discrete Time Signal Processing, Alan V. Oppenheim, Third Edition)

| improve this answer | |
  • $\begingroup$ Why Kaiser? Why not any other window? Why windowed and not optimum, or adaptive, or...? Why not IIR? Why not a blunt passive RLC? $\endgroup$ – a concerned citizen Dec 19 '17 at 7:14

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.