OpenHantek / OpenHantek6022

OpenHantek6022 is a DSO software for Hantek USB digital signal oscilloscopes 6022BE / BL. Development OS is Debian Linux, but the program also works on FreeBSD, MacOS, RaspberryPi and Windows. No support for non-Linux related issues unless a volunteer steps in!
GNU General Public License v3.0
858 stars 152 forks source link

Frequencybase value does not update in the UI #330

Closed jsiddall closed 1 year ago

jsiddall commented 1 year ago

Describe the bug The Frequencybase setting gets updated when the Timebase setting is changed, but the Frequencybase value is not updated in the UI.

To Reproduce

  1. Start in demo mode
  2. Enable a spectrum display
  3. Change the timebase
  4. The spectrum scale changes but the Frequencybase number remains the same.

Expected behavior The Frequencybase number is updated when the spectrum scale changes

Screenshots

Computer environment (please complete the following information):

Scope device (please complete the following information):

Ho-Ro commented 1 year ago

@jsiddall

Start in demo mode Enable a spectrum display Change the timebase The spectrum scale changes but the Frequencybase number remains the same.

Why should the frequency basis (the spectrum frequency scale per division) change? Time and spectrum are two different ways of looking at the same physical phenomenon. Therefore, the scale can also be chosen independently within the context of the physical conditions - see the basics of the Fourier transform. If you look at the same input signal with different time bases, the spectrum (the position and magnitude of the harmonics) remains the same, only the width of the lobes changes (due to the different duration of the sampling window: longer window -> narrower lobe. The shape of the lobes is the Fourier transform of the window function convolved with the real spectrum, if you were to sample a stationary signal infinitely long, there would be no limiting window function and the lobes would be infinitely narrow). The only required influence of the sampling rate (which also depends on the time base) on the frequency base is that the maximum frequency base cannot be greater than sample rate/20 (due to Nyquist, since the maximum frequency in the spectrum cannot be greater than half the sample rate and since the frequency base is given per division and you have 10 horizontal divisions, the maximum frequency is therefore 10*frequencybase). The other influence of the time base on the frequency display of the demo unit is that at slow sample rates < 100 kS/s, the frequency of the demo signal is also reduced, which can be seen in the frequency display at the bottom right. I chose this physical inaccuracy in order to obtain a usable signal shape even with slow time bases. With the real unit, of course, the input signal remains the same, even if the settings change.

Martin

jsiddall commented 1 year ago

Update: looks this was just an artifact of how demo mode works, not an issue. Thanks for the quick reply!