Skip to content

Commit

Permalink
Fix the pixels/bin calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
argilo committed Oct 1, 2023
1 parent b0662a6 commit 8e285dc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,8 @@ void CPlotter::draw(bool newData)
const double startFreq = fftCenter - span / 2.0;
const double binsPerHz = fftSize / sampleFreq;

// Scale factor for x -> fft bin. Note that it takes 2 pixels to have a
// span of 1 pixel.
double xScale = sampleFreq * (w - 1) / fftSize / span;
// Scale factor for x -> fft bin (pixels per bin).
double xScale = sampleFreq * w / fftSize / span;

// Center of fft is the center of the DC bin. The Nyquist bin (index 0
// after shift) is not used.
Expand Down

0 comments on commit 8e285dc

Please sign in to comment.