I am working on 50 samples obtained from time domain signal by FFT. It appears at certain frequencies which are -- according to our experimentalist -- due to some issues with their oscilloscope. What is the best way to remove these? They seem to appear at fixed frequencies only but they are not present in all samples to the same degree. enter image description here

  • $\begingroup$ At which frequency do these spikes first occur? Your plots starts at 3 gHz. $\endgroup$
    – Jdip
    Sep 6 at 2:44
  • $\begingroup$ @Jdip changed the picture. $\endgroup$
    – Reza Afra
    Sep 6 at 2:53
  • $\begingroup$ Thank you, but I can't make out where the first spike happens. So, what is the frequency at which the first spike occurs? $\endgroup$
    – Jdip
    Sep 6 at 3:28
  • $\begingroup$ @jdip It is at 250 MHz $\endgroup$
    – Reza Afra
    Sep 6 at 3:29
  • $\begingroup$ Ok, and I'm guessing it's also at 500, 750, 1000, 1250, etc ? $\endgroup$
    – Jdip
    Sep 6 at 3:32

1 Answer 1


These spikes look like harmonics of some sort of line noise at $250 \texttt{MHz}$. To get rid of these, what you need is a comb notch filter.

There are a few ways to build one.

  1. If the fundamental (your first spike) is an integer divisor of the sampling frequency (i.e $f_s/f_0 = \texttt{integer}$), such a filter can be built using the following transfer function:

    $$H(z) = g\frac{1-z^{-n}}{1-az^{-n}}$$ with $$n = \frac{f_s}{f_0}$$

    $$g = \frac{1}{1+\beta}$$ $$a = 2g-1$$ $$\beta = \tan\left(\frac{\pi n\texttt{BW}}{f_s}\right)\cdot\frac{\sqrt{1-\alpha^2}}{\alpha}$$ $$\alpha = 10^{-A/20}$$ with $\texttt{BW}(\texttt{Hz})$ the width of the notch at $-A(\texttt{dB})$.

enter image description here

Matlab Code:

    fs = 20e9;
    fo = 250e6;
    n = fs/fo;
    bw = 2e6;
    A = 3;
    alpha = 10^(-A/20);
    beta = tan(pi*n*bw/(2*fs)) * sqrt(1-alpha^2)/alpha;
    g = 1/(1+beta);
    b = [g zeros(1,n-1) -g]; a = [1 zeros(1,n-1) -(2*g-1)];
    %filter your signal:
    filtered_signal = filter(b,a,input);

2. If $f_s/f_0 \neq \texttt{integer}$, or if the spikes aren't actually harmonics, see [this approach][1]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.