On 03/02/2020 04:45 PM, Lukas Haase wrote:
Hi Marcus,
How can (or better: *should*) a fully digital signal source have phase noise?
Also, for 1Hz at 5MSps I always get either 5005789 or 5005790 samples (instead
of 5000000) ... this is fairly deterministic.
Experimenting a bit, I see the weirdest behaviour of the analog signal source.
In my opinion, the source should be fully deterministic. But it is not.
Example 1: I pipe the output of the signal source into a file:
https://snipboard.io/xY1JvE.jpg
and read it with MATLAB:
data = read_float_binary('baszmeg.dat');
Then I compare it to an ideal (=expected) version:
t = 0:1/fs:(length(data)-1)/fs;
plot(t, [data - sin(2*pi*t)' ])
https://snipboard.io/ecTaFL.jpg
Now, I would not care too much about a constant phase shift or similar, but it
can be seen that the frequency slowly drifts (this is also seen if I just plot
them on top of each other).
Example 2: I extend the block diagram with blocks that should never alter the
behaviour as they are only reading samples:
https://snipboard.io/W6kyF0.jpg
Note that the "Controller" is a simple Embedded Python block that only reads
the input samples into a temporary variable:
def work(self, input_items, output_items):
squared_wave = input_items[0]
squared_wave[np.where(input_items[0] > 0)] = 1
output_items[0][:] = input_items[0]
return len(output_items[0])
However, now the saved data is distorted:
https://snipboard.io/amyn3X.jpg
Any suggestions highly appreciated.
Thanks,
Lukas
Someone with more insight into the guts of the signal source needs to
comment here.
It looks like it moves back-and-forth between integer and floating-point
representations, and doing so, finite-precision problems can easily
creep in. But that's just an educated guess on my part.