Skip to content

Commit

Permalink
Merge pull request #1292 from gqrx-sdr/fix-right-pixel
Browse files Browse the repository at this point in the history
Fix the pixels/bin calculation
  • Loading branch information
argilo authored Oct 1, 2023
2 parents b0662a6 + 8e285dc commit 40bef4f
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 40bef4f

Please sign in to comment.