Unexpected frequency halving and extra peaks in FFT output when changing sampling time (TS) in Simulink

20 views (last 30 days)
Hi everyone,
I’m running a Simulink model using multiple sine waves generated by Sine Wave blocks, summed together, then passed through:
Zero-Order Hold → Buffer (size = 2048) → FFT → Gain → Abs → Vector Scope (or Spectrum Analyzer)
Each Sine Wave block has a specified frequency (e.g., 100 Hz, 300 Hz, 375 Hz, 500 Hz, 750 Hz) and amplitude.
The Zero-Order Hold has a sample time TS = 1/2048 s initially, and the FFT length and buffer size are both 2048.
When TS = 1/2048, the FFT result looks correct: all expected frequency peaks appear properly.
However, when I change TS (e.g., to 1/4096 s), some strange things happen:
  • The 100 Hz component appears at 50 Hz instead.
  • Extra peaks appear above my highest input frequency (700 Hz).
  • These artifacts persist even when aliasing should not occur (FS ≫ 2× fmax).
I suspect the issue is related to the Spectrum Analyzer / Vector Scope sampling-rate setting or how Simulink scales the frequency axis, not aliasing.
If I manually set the Spectrum Analyzer Sampling Rate to 2/TS, the 100 Hz component displays correctly in one case, but not for other TS values.
I already tried:
  • Matching buffer size and FFT length (2048 each).
  • Confirming sample rates between blocks.
  • Checking aliasing and Nyquist limits.
None of these fixed the inconsistent scaling or the extra peaks.
Question:
How should the Spectrum Analyzer (or Vector Scope) sampling rate and FFT configuration be set to correctly reflect frequency content when TS changes?
Is there a reliable way to synchronize the FFT and analyzer x-axis scaling with the actual sample rate in Simulink?
Any insights or example models would be greatly appreciated!

Answers (1)

sneha
sneha on 11 Nov 2025
Hi,
The Spectrum Analyzer or FFT block is mismatched in its sample rate, it “scales” the x-axis incorrectly, creating fake peaks because the frequencies don’t align with the correct bin mapping.
Things you can try:
  1. Always set the analyser’s Sample Rate = 1/TS — if you change TS, change the Spectrum Analyzer “Sample Rate (Hz)” so its x-axis matches your actual Fs. See Sample Rate (Hz) in https://www.mathworks.com/help/dsp/ug/configure-spectrum-analyzer.html
  2. Make FFT length = samples-per-frame (N)
  3. Remember sample vs frame rate — the analyser needs the underlying sample rate (Fs), not the slower frame-update rate. Confirm that ZOH sample time = TS and downstream blocks use that sample time. See Sample- and Frame-Based Concepts in https://www.mathworks.com/help/dsp/ug/sample-and-frame-based-concepts.html
  4. Use a single-tone sanity test — feed one sine (100 Hz) with the TS you want and verify its bin; this quickly tells you whether the analyser/FFT scaling is wrong. See Spectrum Analyzer block examples / measurements in https://www.mathworks.com/help/dsp/ref/spectrumanalyzerblock.html
  5. If you change TS frequently, automate the analyser Sample Rate — set the Spectrum Analyzer Sample Rate programmatically (or use a model variable) so it always equals 1/TS and you don’t have to update it manually. (See Spectrum Analyzer configuration properties / Sample Rate property in https://www.mathworks.com/help/dsp/ref/spectrumanalyzerconfiguration.html

Products


Release

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!