I'm learning to use the spectral analyser in Simulink, and tested it with a 500kHz square wave (sampled at 1MHz). When I set the Resolution Bandwidth (RBW) to 700Hz, the plot was beautiful and shows only one spike at 500kHz (the higher frequency harmonics are invisible because the sampling rate is not high enough I suppose). enter image description here

However, when I set the RBW to auto (Simulink set it to 488.281Hz), there are multiple spikes downwards. I kept most of the default configurations and only tweaked the RBW. enter image description here


1 Answer 1


First rule of reading graphs: Read units, scales and labels.

The data in your second graph is between -400dBm and -3400dBm. -400dBm is a power of $10^{-43}W$. That's essentially all zeros and what you are looking at here is just residual numerical noise. The negative spikes are simply frequencies where the numerical noise exactly zero and the level in dB of zero is $-\infty$. The display needs to cut this off somewhere.

The graph we expect would be all zeros except at 500 kHz. That's exactly what your 2nd graph is. If you squint a bit you can see the spike at 500 kHz at about +30 dBm. It's just hard to see since the dynamic range of the display is huge.

The reason it looks weird is that you can't properly display zero on a logarithmic scale, and the way your program handles this exception is kind of stupid. Typically you put a display threshold in that is your max level minus your credible/useful dynamic range. -100dBm would have been a good starting point here.

The more interesting question is: why doesn't your first graph look like this ? The answer is "spectral leakage". It's due to the fact that at 500kHz is not an integer multiple of 700Hz. That means all the energy at 500 kHz does not fall into a single DFT bin but is smeared out over all DFT bins. The math behind this is fairly complicated. But if you are planning to do more spectral analysis, I would encourage you to read up on spectral leakage and on windowing which is the standard method of managing it.

  • $\begingroup$ Thanks for your answer, but in the second graph, RBW = 488.281Hz, which is not able to divide 500k as well. If the RBW is set to 600Hz, the display is also similar to the second graph. Why is that? $\endgroup$
    – George guo
    Jan 19 at 17:52
  • $\begingroup$ The frequency resolution of the spectrum analyzer is the sample rate divided by the FFT size. I'm guessing the FFT size is 2048, which makes the resolution indeed 488.28125Hz. We have $488.28 = \frac{10^6}{1024}$ so it is an integer divider. I'm not sure what happens at 600 Hz and how the algorithm exactly implements RBW. Please note that you also have aliasing. You want the sample rate to be larger than twice the highest frequency in the signal. Equal is generally not good enough $\endgroup$
    – Hilmar
    Jan 19 at 21:04

Your Answer

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

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