Menu

#833 FFT places undefined value in last bin

v1.0 (example)
open
None
5
2026-03-03
2026-03-02
No

The primary issue in #829, about incorrect frequency calculation has been resolved by bfe496937.

An earlier commit 5e82b63f6 in pre-master-46 conflicts with the proper fix in bfe496937. When the user requests an 1024 point FFT, 5e82b63f6 instead computes an 1023 point FFT.

This has two bad effects:

  1. The last value in the fft result is not filled in by the call to FFTW, it is an undefined value, originating in whatever fftw_malloc put there by accident.
  2. Again, there is a mismatch between the freqs labels, and the frequency bins actually computed.

5e82b63f6 should be reverted. After reverting, we have made some real progress.

This attached netlist demonstrates the bug regarding the last freq bin.
The signal analyzed is a cosine with amplitude 1 at 2048Hz.

Output for Current pre-master-46 :

FFT: Time span: 0.0078125 s, input length: 32
FFT: Frequency resolution: 128 Hz, output length: 17
Freq     Value
2048 0.0120527

Output After reverting 5e82b63f6:

FFT: Time span: 0.0078125 s, input length: 32
FFT: Frequency resolution: 128 Hz, output length: 17
Freq     Value
2048 0.999997
1 Attachments

Discussion

  • geraldfournier

    geraldfournier - 2026-03-03

    Removed

     

    Last edit: geraldfournier 2026-03-03
  • geraldfournier

    geraldfournier - 2026-03-03

    Sorry, I'll put that in a new ticket.

     
  • geraldfournier

    geraldfournier - 2026-03-03

    I confirm that 6ae057b3e fixed this issue. Can close. Thanks.

     

Log in to post a comment.

MongoDB Logo MongoDB