 # Different frequency data export using ASCII trace export SCPI commands

Question

I’ve noticed a different behavior when reading trace (X and Y) from spectrum using SCPI commands and ASCII Trace Export. I compared the results of SCPI and ASCII Trace Export. Using SCPI, I can see that start frequency and stop frequency is not included.
In my case the start frequency is 1.845GHz and stop frequency is 1,85GHz. When reading the X-values (frequencies) the values are from 1.845005GHz to 1.849995GHz. What happens with the end points? Why is there a difference?

Answer

At first, the two possibilities for reading out the trace frequencies (remote control query, trace ASCII export) follow different algorithms.
This was always the case in the past and can not be changed for reasons of compatibility. Nevertheless both procedures are correct. Here is a simple example to explain the correctness:

For example we have a sweep from 100MHz to 201MHz with 101 sweep points.
Because of the number of sweep points, each pixel (level) represents a subrange of the measured spectrum. In this example you will get the following frequencies:

100,5 MHz

101,5 MHz

102,5 MHz

For the ASCII file export, the span is divided by the number of sweep points minus 1. Because of this calculation, you will get a spacing of 1.01 MHz per pixel.
This algorithm gives you the start frequency and will always add the delta of 1.01 MHz to maintain the spacing. This algorithm results in the following frequencies:

100 MHz

101,01 MHz

102,02 MHz

A sweep runs continuously over frequency axis. E.g. the first pixel covers a frequency subrange of 100 MHz <= f <101 MHz. The second pixel is corresponding to 101 MHz <= f <102 MHz.
So, you can say one point/pixel contains the spectral information of a relatively large subrange, several internally measured values (we say samples) fall on one point/pixel. Which of the samples will be represented by the pixel depends on the selected weighting which is determined by the detector. As you can see in the figure the detected values are grouped together in the respective subranges and displayed as a level.
All frequencies that are within this subrange are correct. In the case of the first pixel, this would be the range 100 MHz <= f <101 MHz

Both algorithms are correct and working properly.